Guide
Use webhooks to update other tools based on changes in Fibery.
There is no webhooks UI at the moment, so please use /api/webhooks/v2 endpoint to add or delete a webhook.
Managing webhooks requires Architect access to either Space or Database.
Add webhook
Add a webhook to subscribe to Entity changes of a particular Type API.
In the interface, Type = Database, App = Space. To find out why, check Terminology.
When one or several changes occur, Fibery sends a JSON with new and previous values to the specified URL.
Filter and process the payload in your integration. If you need some extra fields, send a request to the regular API (check Select Fields for more).
Please note that you can send correlationId, as shown in API call example, to match it with webhook call.
Then you will receive the same correlationId in corresponding webhook event.
Limitations:
Webhooks do not support rich text Field changes at the moment.
curl -X POST https://YOUR_ACCOUNT.fibery.io/api/webhooks/v2 \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d \
'{
"url": "http://webhook.site/c2d6d113-aebe-4f68-a337-022ec3c7ab5d",
"type": "Cricket/Player"
}'
Result:
{
"id": 5,
"url": "http://webhook.site/c2d6d113-aebe-4f68-a337-022ec3c7ab5d",
"type": "Cricket/Player",
"state": "active",
"version": "2",
"runs": []
}
Once you update a couple of Fields:
curl -X POST https://YOUR_ACCOUNT.fibery.io/api/commands \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d \
'[
{
"command": "fibery.command/batch",
"correlationId": "cd4490f1-21d8-4881-b85c-423ef98edc3d",
"args": {
"commands": [
{
"command": "fibery.entity/update",
"args": {
"type": "Cricket/Player",
"entity": {
"fibery/id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4",
"fibery/modification-date": "2019-07-30T07:18:48.449Z",
"Cricket/name": "sir Curtly Ambrose"
}
},
},
{
"command": "fibery.entity/add-collection-items",
"args": {
"type": "Cricket/Player",
"field": "user/Former~Teams",
"entity": { "fibery/id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4" },
"items": [
{ "fibery/id": "d328b7b0-97fa-11e9-81b9-4363f716f666" }
]
}
}
]
}
}
]'
the endpoint receives an array of effects:
{
"sequenceId":392,
"authorId":"4044090b-7165-4791-ac15-20fb12ae0b64",
"creationDate":"2021-04-22T12:40:14.325Z",
"command": {
"correlationId": "cd4490f1-21d8-4881-b85c-423ef98edc3d"
},
"effects":
[
{
"effect": "fibery.entity/update",
"id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4",
"type": "Cricket/Player",
"values": {
"fibery/modification-date": "2019-07-30T07:18:48.449Z",
"Cricket/name": "sir Curtly Ambrose"
},
"valuesBefore": {
"fibery/modification-date": "2019-07-04T11:12:13.423Z",
"Cricket/name": "Curtly Ambrose"
}
},
{
"effect": "fibery.entity/add-collection-items",
"id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4",
"type": "Cricket/Player",
"field": "user/Former~Teams",
"items": [
{
"fibery/id": "d328b7b0-97fa-11e9-81b9-4363f716f666"
}
]
}
],
}
Delete webhook
Delete a webhook when you no longer need it to save the account resources.
curl -X DELETE https://YOUR_ACCOUNT.fibery.io/api/webhooks/v2/WEBHOOK_ID \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
Status code 200 means that the deletion has been successful.
Get webhooks
Get a list of webhooks together with their latest 50 runs.
curl -X GET https://YOUR_ACCOUNT.fibery.io/api/webhooks/v2 \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
Result:
[
{
"id": 5,
"url": "http://webhook.site/c2d6d113-aebe-4f68-a337-022ec3c7ab5d",
"type": "Cricket/Player",
"state": "active",
"runs": [
{
"http_status": "200",
"elapsed_time": "209",
"request_time": "2019-07-30T07:18:49.883Z"
},
{
"http_status": "200",
"elapsed_time": "181",
"request_time": "2019-07-30T07:23:06.738Z"
}
]
}
]