Sorry, no results found for "".
Must be exactly "webhook"
.
Unique name for the webhook
"Item type creation/update"
The URL to be called
"https://www.example.com/webhook"
Additional headers that will be sent
{ "X-Foo": "Bar" }
The subject of webhook triggering
"item"
A custom payload
'{ "message": "{{event_type}} event triggered on {{entity_type}}!", "entity_id": "{{#entity}}{{id}}{{/entity}}"] }'
HTTP Basic Authorization username
"user"
HTTP Basic Authorization password
"password"
Whether the webhook is enabled and sending events or not
Specifies which API version to use when serializing entities in the webhook payload
"3"
Whether the you want records present in the payload to show blocks expanded or not
If enabled, the system will attempt to retry the call several times when the webhook operation fails due to timeouts or errors.
Returns a resource object of type webhook.
POST https://site-api.datocms.com/webhooks HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "type": "webhook", "attributes": { "name": "Item type creation/update", "url": "https://www.example.com/webhook", "headers": { "X-Foo": "Bar" }, "events": [ { "entity_type": "item", "event_types": [ "update" ] } ], "custom_payload": "{ \"message\": \"{{event_type}} event triggered on {{entity_type}}!\", \"entity_id\": \"{{#entity}}{{id}}{{/entity}}\"] }", "http_basic_user": "user", "http_basic_password": "password" } }}
curl -g 'https://site-api.datocms.com/webhooks' \ -X POST \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3" \ -H "Content-Type: application/vnd.api+json" \ --data-binary '{"data":{"type":"webhook","attributes":{"name":"Item type creation/update","url":"https://www.example.com/webhook","headers":{"X-Foo":"Bar"},"events":[{"entity_type":"item","event_types":["update"]}],"custom_payload":"{ \"message\": \"{{event_type}} event triggered on {{entity_type}}!\", \"entity_id\": \"{{#entity}}{{id}}{{/entity}}\"] }","http_basic_user":"user","http_basic_password":"password"}}}'
await fetch("https://site-api.datocms.com/webhooks", { method: "POST", headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", "Content-Type": "application/vnd.api+json", }, body: JSON.stringify({ data: { type: "webhook", attributes: { name: "Item type creation/update", url: "https://www.example.com/webhook", headers: { "X-Foo": "Bar" }, events: [{ entity_type: "item", event_types: ["update"] }], custom_payload: '{ "message": "{{event_type}} event triggered on {{entity_type}}!", "entity_id": "{{#entity}}{{id}}{{/entity}}"] }', http_basic_user: "user", http_basic_password: "password", }, }, }),});
HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "webhook", "id": "312", "attributes": { "name": "Item type creation/update", "url": "https://www.example.com/webhook", "enabled": true, "headers": { "X-Foo": "Bar" }, "events": [ { "entity_type": "item", "event_types": [ "update" ] } ], "http_basic_user": "user", "http_basic_password": "password", "custom_payload": "{ \"message\": \"{{event_type}} event triggered on {{entity_type}}!\", \"entity_id\": \"{{#entity}}{{id}}{{/entity}}\"] }", "payload_api_version": "3", "nested_items_in_payload": true, "auto_retry": true } }}