Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Webhooks are no longer restricted to pro users. Now any user can use them.

...

There's currently no limit on webhooks and they can be installed per deployment from an individual users account using the webhooks control panel. The control panel can be accessed from the administration configuration page → api → webhooks.

Access

Only pro users and up can utilise webhooks. This doesn't mean other users cannot register them on behalf but webhooks will only fire on objects the owner of the object has view access to. For example, If Alice registers to receive notifications whenever a task assignee changes. She will not receive notifications for any tasks she cannot view from within Accelo.

Limitations

We do not limit the amount of webhooks per deployment or user but we do enforce a 10 second timeout rule. If your trigger url takes more than 10 seconds to respond to webhook delivery, we will cancel the request. If this occurs too many times, we will delete your webhook subscription automatically.

...

Event IDDescription
assign_taskAny time a task assignee changes. This includes going from assigned to unassigned.
unassign_taskAny time a task is unassigned.
create_quoteAny time a new quote is created.
create_requestAny time a new request is created.
update_request_statusAny time a request status changes.
create_invoice_pdfAny time a PDF resource is generated.

Payloads

Each event will bundle together a payload containing the details of what happens and a resource url pointing you where to go for more fields of the object affected.

...

HeaderDescription
X-Accelo-EventID of the even event that triggered the delivery. For example, "assign_task"
X-Hub-SignatureHMAC hex digest of the payload using your configured subscriptions secret.

Unsubscribe Status

Your integration can tell Accelo to automatically unsubscribe by responding with a HTTP Status Gone 410. The dispatcher will respect this and instantly remove the subscription that caused the webhook trigger. Alternatively you can use the delete subscription endpoint mentioned below.

Endpoints

You can manage webhooks from the public api. This is particularly useful if you wish your integration to automatically manage subscriptions on behalf of authorized user.

...

Parameters

namedescription
trigger_urlURL we will trigger a HTTP POST to upon firing the registered event. For example, "https://your-domain.com/callback".
event_idUnique event identifier. You can grab a list of possible subscription events from the get subscription types endpoint.
content_typeContent-type we will HTTP POST to your trigger URL. This can be either "application/x-www-form-urlencoded" or "application/json"
secretOptional secret that we will use to generate a HMAC hex digest of the payload. The digest will be included in the triggered requests "X-Hub-Signature" header.

Underline indicates required.

Sample

Code Block
titleRequest
POST /api/v0/webhooks/subscriptions HTTP/1.1
Host: your-deployment.api.accelo.com
Content-Type: application/json

{
	"trigger_url": "https://your-domain.com/callback",
	"event_id": "assign_task"
}
Code Block
titleResponse (201)
{
  "meta": {
    "status": "ok_created",
    "more_info": "https://affinitylive.jira.com/wiki/display/APIS/Status+Codes#ok_created",
    "message": "A resource was successfully created."
  },
  "response": {
    "subscription": {
      "event_id": "assign_task",
      "user": {
        "email": "simon.jackson@accelo.com",
        "name": "Simon Jackson",
        "id": 1
      },
      "user_id": 1,
      "user_deployment": "hq",
      "trigger_url": "http://your-domain.com/callback",
      "content_type": "application/x-www-form-urlencoded",
      "subscription_id": "583f4b8028dc59073860a6d1",
      "trigger_type": "update",
      "trigger_table": "task"
    }
  }
}

Delete Webhook Subscription

Delete a given webhook subscription. Once this is done, you will no longer receive webhooks to the registered URL.

Code Block
DELETE /api/v0/webhooks/subscriptions/{subscription_id}.{json|xml|yml}

Trigger Webhook Subscription

Manually trigger a given subscription. This will queue the event to all other subscriptions and execute asynchronously. Use this if you want to trigger a subscription for an event for others, otherwise please see dispatch webhook subscription.

Code Block
POST /api/v0/webhooks/subscriptions/{subscription_id}/trigger.{json|xml|yml}

Dispatch Webhook Subscription

Manually dispatch a given subscription synchronously. Unlike triggering, this will only execute the current subscription so other subscriptions of the event will not be affected. As it's synchronously you will get the HTTP status of the webhook result.

Code Block
POST /api/v0/webhooks/subscriptions/{subscription_id}/dispatch.{json|xml|yml}

Sample Response

Code Block
{
	"status": 200
}