API Documentation
Webhooks
Webhooks to be notified about Task status changes
You can configure webhook endpoints to be notified about Task status changes.
Event Object
The webhooks return an Event object**,** with the following attributes
- type : event type (ex:
task.completed
) - data : event payload
- task
- id : task id
- status : the new task status
- info
- any additional info from the task’s
integrations
information
- any additional info from the task’s
- task
- sentAt : datetime at which the webhook is sent
{
"type": "task.completed",
"data": {
"task": {
"id": "1",
"status": {
"name": "DONE",
"userId": "1",
"at": "2023-10-27T13:57:12.924742+00:00"
}
},
"info": {}
},
"sentAt": "2023-10-27T13:57:12.933484+00:00"
}
Event types
We currently support the following webhooks
-
on_assign : when a Task goes from
TODO
→ASSIGNED
status→ type
task.assigned
-
on_unassign : when a Task goes from
ASSIGNED
→TODO
status→ type
task.unassigned
-
on_start : when a Task goes from
ASSIGNED
→STARTED
status→ type
task.started
-
on_pause : when a Task goes from
STARTED
→ASSIGNED
status→ type
task.paused
-
on_complete : when a Task goes from
STARTED
→DONE
status→ type
task.completed
Registering a webhook
- Register the webhook on your Fragment account, and write down the ID. For example
webhook_1234
(for now, you need to ask someone from the Fragment’s team to do it for you) - Add the webhook’s ID to the task
integrations
payload as follows
{
"id": "1",
"title": "Test",
"url": "https://google.com"
"integrations": {
"webhook_1234": {
"externalId": "123"
}
},
"status": {
"at": "2023-10-27T14:16:51.173671+00:00",
"name": "TODO"
},
"tags": {
"name": "test",
"priority": "High"
},
"createdAt": "2023-10-27T14:16:51.173671+00:00",
"dueAt": "2023-10-27T14:16:51.173671+00:00",
}
The externalId
will be returned as part of the webhooks
Example
- Create a webhook receiver endpoint on https://webhook.site
- Register it with ID
webhook_1234
- Create a task with the integrations information (see above)
"integrations": {
"webhook_1234": {
"externalId": "abc"
}
},
- Use Fragment to assign or start the task
- Go back to your webhook, you should see a new payload
{
"type": "task.started",
"data": {
"task": {
"id": "1",
"status": {
"name": "STARTED",
"userId": "1",
"at": "2023-10-27T14:10:19.225944+00:00"
}
},
"info": {
"externalId": "abc"
}
},
"sentAt": "2023-10-27T14:10:19.234762+00:00"
}