Example code:
const { SiteClient } = require('datocms-client');
async function run() {
const client = new SiteClient('YOUR-API-TOKEN');
const webhookId = '312';
const webhook = await client.webhook.destroy(webhookId);
console.log(webhook);
}
run();
Returned output:
> node example.js
{
"id": "312",
"name": "Item type creation/update",
"enabled": true,
"url": "https://www.example.com/webhook",
"customPayload": "{ message: 'Successfully published record!' }",
"httpBasicUser": "user",
"httpBasicPassword": "password",
"headers": {
"xFoo": "Bar"
},
"events": [
{
"entityType": "item_type",
"eventTypes": [
"update",
"create"
],
"filter": {
"entityType": "item_type",
"entityIds": [
"42",
"43"
]
}
}
],
"payloadApiVersion": "3",
"nestedItemsInPayload": true
}