Sorry, no results found for "".

Show examples in:
Javascript HTTP

Content Management API > Webhook call

List all webhooks calls

Query parameters

page object

Parameters to control offset-based pagination

offset integer

The (zero-based) offset of the first entity returned in the collection (defaults to 0)

limit integer

The maximum number of entities to return (defaults to 30, maximum is 500)

filter object

Attributes to filter

ids string

IDs to fetch, comma separated

Example: "42,554"
fields object
webhook_id object
eq string
entity_type object
eq enum

The subject of webhook triggering

Example: "item"
item_type
item
upload
build_trigger
environment
maintenance_mode
sso_user
cda_cache_tags
event_type object
eq enum

The event that triggers the webhook call

Example: "update"
create
update
delete
publish
unpublish
promote
deploy_started
deploy_succeeded
deploy_failed
change
invalidate
status object
eq enum

The current status

Example: "success"
pending

The delivery attempt is currently in process

success

Delivery completed successfully

failed

Delivery attempt(s) failed due to errors/timeouts

rescheduled

The last delivery attempt failed, a new one will be retried later

last_sent_at object
gt date-time
lt date-time
next_retry_at object
gt date-time
lt date-time
created_at object
gt date-time
lt date-time
order_by enum

Fields used to order results

Example: "name_DESC"
webhook_id_asc
webhook_id_desc
created_at_asc
created_at_desc
last_sent_at_asc
last_sent_at_desc
next_retry_at_asc
next_retry_at_desc

Returns

Returns an array of resource objects of type webhook_call

Other examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
// Make sure the API token has access to the CMA, and is stored securely
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const webhookCalls = await client.webhookCalls.list();
console.log(webhookCalls);
}
run();
[
{
id: "84033321",
type: "webhook_call",
request_url: "https://www.example.com/webhook",
request_payload: '{ \
"environment": "main", \
"entity_type": "item", \
"event_type": "create", \
"entity": { \
"id": "Ke9nrZ4iRHWpKbJplG_zdQ", \
"type": "item", \
"attributes": { \
"text_field": "Test" \
}, \
"relationships": { \
"item_type": { \
"data": { \
"id": "Dq4WEbdjStWIeSeH_lBA-Q", \
"type": "item_type" \
} \
}, \
"creator": { \
"data": { \
"id": "104280", \
"type": "account" \
} \
} \
}, \
"meta": { \
"created_at": "2024-04-03T22:47:43.488+01:00", \
"updated_at": "2024-04-03T22:47:43.496+01:00", \
"published_at": "2024-04-03T22:47:43.532+01:00", \
"publication_scheduled_at": null, \
"unpublishing_scheduled_at": null, \
"first_published_at": "2024-04-03T22:47:43.532+01:00", \
"is_valid": true, \
"is_current_version_valid": true, \
"is_published_version_valid": true, \
"status": "published", \
"current_version": "QXuPXVc6SDmXcDh1MnImHQ", \
"stage": null \
} \
}, \
"related_entities": [ \
{ \
"id": "Dq4WEbdjStWIeSeH_lBA-Q", \
"type": "item_type", \
"attributes": { \
"name": "Example Model", \
"singleton": true, \
"sortable": false, \
"api_key": "example_model", \
"ordering_direction": null, \
"ordering_meta": null, \
"tree": false, \
"modular_block": false, \
"draft_mode_active": false, \
"all_locales_required": false, \
"collection_appearance": "table", \
"has_singleton_item": true, \
"hint": null, \
"inverse_relationships_enabled": false \
}, \
"relationships": { \
"fields": { \
"data": [ \
{ \
"id": "TuzswqxpQXyzJGv_3JtBAA", \
"type": "field" \
} \
] \
}, \
"fieldsets": { \
"data": [] \
}, \
"singleton_item": { \
"data": { \
"id": "Ke9nrZ4iRHWpKbJplG_zdQ", \
"type": "item" \
} \
}, \
"ordering_field": { \
"data": null \
}, \
"title_field": { \
"data": { \
"id": "TuzswqxpQXyzJGv_3JtBAA", \
"type": "field" \
} \
}, \
"image_preview_field": { \
"data": null \
}, \
"excerpt_field": { \
"data": null \
}, \
"workflow": { \
"data": null \
} \
}, \
"meta": { \
"has_singleton_item": true \
} \
} \
] \
}',
request_headers: {
Accept: "*/*",
"X-Site-Id": "128378",
"User-Agent": "DatoCMS (datocms.com)",
"Content-Type": "application/json",
"X-Webhook-Id": "27321",
"X-Environment": "main",
},
response_status: 200,
response_headers: {
date: "Wed, 03 Apr 2024 21:47:44 GMT",
"content-length": "2",
},
created_at: "2024-04-03T21:47:44.093Z",
response_payload: "OK",
entity_type: "item",
event_type: "create",
webhook: { id: "27321", type: "webhook" },
},
// etc
]

The webhookCalls.list() method does NOT support serverside filtering.

If you wish to filter the calls by some payload attribute, you must fetch them from the server and then filter them clientside, after decoding their request_payload fields with JSON.parse().

This example shows how to filter the calls by their environment names.

import { buildClient } from "@datocms/cma-client-node";
async function run() {
// Make sure the API token has access to the CMA, and is stored securely
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
// Which environment to look for
const environmentNameToFilterBy = "main";
// Because we can't filter serverside, we'll have to fetch all the calls and then deal with them clientside
const iterator = await client.webhookCalls.listPagedIterator();
// Empty array will be filled by the iterator
let filteredWebhookCalls = [];
// Go through the async iterable one at a time
for await (const call of iterator) {
// Parse the stringified webhook payload
const payload = JSON.parse(call.request_payload);
// Only push to the array if the environment matches
const environment = payload.environment;
if (environment === environmentNameToFilterBy) {
filteredWebhookCalls.push(call);
}
}
console.log(filteredWebhookCalls);
}
run();
[
{
id: "84033321",
type: "webhook_call",
request_url: "https://www.example.com/webhook",
request_payload: '{ \
"environment": "main", \
"entity_type": "item", \
"event_type": "create", \
"entity": { \
"id": "Ke9nrZ4iRHWpKbJplG_zdQ", \
"type": "item", \
"attributes": { \
"text_field": "Test" \
}, \
"relationships": { \
"item_type": { \
"data": { \
"id": "Dq4WEbdjStWIeSeH_lBA-Q", \
"type": "item_type" \
} \
}, \
"creator": { \
"data": { \
"id": "104280", \
"type": "account" \
} \
} \
}, \
"meta": { \
"created_at": "2024-04-03T22:47:43.488+01:00", \
"updated_at": "2024-04-03T22:47:43.496+01:00", \
"published_at": "2024-04-03T22:47:43.532+01:00", \
"publication_scheduled_at": null, \
"unpublishing_scheduled_at": null, \
"first_published_at": "2024-04-03T22:47:43.532+01:00", \
"is_valid": true, \
"is_current_version_valid": true, \
"is_published_version_valid": true, \
"status": "published", \
"current_version": "QXuPXVc6SDmXcDh1MnImHQ", \
"stage": null \
} \
}, \
"related_entities": [ \
{ \
"id": "Dq4WEbdjStWIeSeH_lBA-Q", \
"type": "item_type", \
"attributes": { \
"name": "Example Model", \
"singleton": true, \
"sortable": false, \
"api_key": "example_model", \
"ordering_direction": null, \
"ordering_meta": null, \
"tree": false, \
"modular_block": false, \
"draft_mode_active": false, \
"all_locales_required": false, \
"collection_appearance": "table", \
"has_singleton_item": true, \
"hint": null, \
"inverse_relationships_enabled": false \
}, \
"relationships": { \
"fields": { \
"data": [ \
{ \
"id": "TuzswqxpQXyzJGv_3JtBAA", \
"type": "field" \
} \
] \
}, \
"fieldsets": { \
"data": [] \
}, \
"singleton_item": { \
"data": { \
"id": "Ke9nrZ4iRHWpKbJplG_zdQ", \
"type": "item" \
} \
}, \
"ordering_field": { \
"data": null \
}, \
"title_field": { \
"data": { \
"id": "TuzswqxpQXyzJGv_3JtBAA", \
"type": "field" \
} \
}, \
"image_preview_field": { \
"data": null \
}, \
"excerpt_field": { \
"data": null \
}, \
"workflow": { \
"data": null \
} \
}, \
"meta": { \
"has_singleton_item": true \
} \
} \
] \
}',
request_headers: {
Accept: "*/*",
"X-Site-Id": "128378",
"User-Agent": "DatoCMS (datocms.com)",
"Content-Type": "application/json",
"X-Webhook-Id": "27321",
"X-Environment": "main",
},
response_status: 200,
response_headers: {
date: "Wed, 03 Apr 2024 21:47:44 GMT",
"content-length": "2",
},
created_at: "2024-04-03T21:47:44.093Z",
response_payload: "OK",
entity_type: "item",
event_type: "create",
webhook: { id: "27321", type: "webhook" },
},
// other calls filtered out, so only this one remains
]