Unique name for the webhook
The URL to be called
Additional headers that will be sent
A custom payload
HTTP Basic Authorization username
HTTP Basic Authorization password
Whether the webhook is enabled and sending events or not
Specifies which API version to use when serializing entities in the webhook payload
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.
import { buildClient } from '@datocms/cma-client-node';async function run() {const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });const webhook = await client.webhooks.create({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'});console.log(webhook);}run();