Webhooks allow you to subscribe to notifications about events that occur on Asana resources (e.g., tasks, projects, stories, etc.).
Webhooks tutorial
For a more detailed explanation of webhooks see the overview of webhooks.
WebhookCompact
A Compact
object reflects the default fields returned after a successful API request. See input/output options to include more fields in the response.
Property | Type | Description |
---|---|---|
gid | string | Globally unique identifier of the resource, as a string. |
resource_type | string | The base type of this resource. |
active | boolean | If true, the webhook will send events - if false it is considered inactive and will not generate events. |
resource | object | A generic Asana Resource, containing a globally unique identifier. |
resource .gid | string | Globally unique identifier of the resource, as a string. |
resource .resource_type | string | The base type of this resource. |
resource .name | string | The name of the object. |
target | string(uri) | The URL to receive the HTTP POST. |
{
"gid": "12345",
"resource_type": "webhook",
"active": false,
"resource": {
"gid": "12345",
"resource_type": "task",
"name": "Bug Task"
},
"target": "https://example.com/receive-webhook/7654"
}
Webhook
Webhook objects represent the state of an active subscription for a server to be updated with information from Asana. This schema represents the subscription itself, not the objects that are sent to the server. For information on those please refer to the event schema.
Property | Type | Description |
---|---|---|
gid | string | Globally unique identifier of the resource, as a string. |
resource_type | string | The base type of this resource. |
active | boolean | If true, the webhook will send events - if false it is considered inactive and will not generate events. |
resource | object | A generic Asana Resource, containing a globally unique identifier. |
resource .gid | string | Globally unique identifier of the resource, as a string. |
resource .resource_type | string | The base type of this resource. |
resource .name | string | The name of the object. |
target | string(uri) | The URL to receive the HTTP POST. |
created_at | string(date-time) | The time at which this resource was created. |
delivery_retry_count | integer | The number of times the webhook has retried delivery of events to the target (resets after a successful attempt). |
filters | [object] | Whitelist of filters to apply to events from this webhook. If a webhook event passes any of the filters the event will be delivered; otherwise no event will be sent to the receiving server. |
ยป {} .action | string | The type of change on the resource to pass through the filter. For more information refer to Event.action in the event schema. This can be one of changed , added , removed , deleted , and undeleted depending on the nature of what has occurred on the resource. |
ยป {} .fields | [string] | Conditional. A whitelist of fields for events which will pass the filter when the resource is changed. These can be any combination of the fields on the resources themselves. This field is only valid for action of type changed |
ยป {} .resource_subtype | string | The resource subtype of the resource that the filter applies to. This should be set to the same value as is returned on the resource_subtype field on the resources themselves. |
ยป {} .resource_type | string | The type of the resource which created the event when modified; for example, to filter to changes on regular tasks this field should be set to task . |
last_failure_at | string(date-time) | The timestamp when the webhook last received an error when sending an event to the target. |
last_failure_content | string | The contents of the last error response sent to the webhook when attempting to deliver events to the target. |
last_success_at | string(date-time) | The timestamp when the webhook last successfully sent an event to the target. |
{
"gid": "12345",
"resource_type": "webhook",
"active": false,
"resource": {
"gid": "12345",
"resource_type": "task",
"name": "Bug Task"
},
"target": "https://example.com/receive-webhook/7654",
"created_at": "2012-02-22T02:06:58.147Z",
"last_failure_at": "2012-02-22T02:06:58.147Z",
"last_failure_content": "500 Server Error\\n\\nCould not complete the request",
"last_success_at": "2012-02-22T02:06:58.147Z",
"delivery_retry_count": 3,
"next_attempt_after": "2012-02-22T02:06:58.147Z",
"failure_deletion_timestamp": "2012-02-22T02:06:58.147Z",
"filters": [
{
"resource_type": "task",
"resource_subtype": "milestone",
"action": "changed",
"fields": [
"due_at",
"due_on",
"dependencies"
]
}
]
}
WebhookFilter
A WebhookFilter can be passed on creation of a webhook in order to filter the types of actions that trigger delivery of an event
Property | Type | Description |
---|---|---|
action | string | The type of change on the resource to pass through the filter. For more information refer to Event.action in the event schema. This can be one of changed , added , removed , deleted , and undeleted depending on the nature of what has occurred on the resource. |
fields | [string] | Conditional. A whitelist of fields for events which will pass the filter when the resource is changed. These can be any combination of the fields on the resources themselves. This field is only valid for action of type changed |
resource_subtype | string | The resource subtype of the resource that the filter applies to. This should be set to the same value as is returned on the resource_subtype field on the resources themselves. |
resource_type | string | The type of the resource which created the event when modified; for example, to filter to changes on regular tasks this field should be set to task . |
{
"action": "changed",
"fields": [
"due_at",
"due_on",
"dependencies"
],
"resource_subtype": "milestone",
"resource_type": "task"
}