Unique name for the webhook
The URL to be called
A custom payload
Additional headers that will be sent
All the events you will be notified for
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
import { buildClient } from '@datocms/cma-client-node';async function run() {const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });const webhookId = '312';const webhook = await client.webhooks.update(webhookId, {name: 'Item type creation/update',url: 'https://www.example.com/webhook',custom_payload: '{ message: 'Successfully published record!' }',headers: {'X-Foo': 'Bar'},events: [{entity_type: 'item_type',event_types: ['update','create'],filter: {entity_type: 'item_type',entity_ids: ['42','43']}}],http_basic_user: 'user',http_basic_password: 'password',enabled: true,payload_api_version: '3',nested_items_in_payload: true});console.log(webhook);}run();
{id: '312',name: 'Item type creation/update',enabled: true,url: 'https://www.example.com/webhook',custom_payload: '{ message: 'Successfully published record!' }',http_basic_user: 'user',http_basic_password: 'password',headers: {'X-Foo': 'Bar'},events: [{entity_type: 'item_type',event_types: ['update','create'],filter: {entity_type: 'item_type',entity_ids: ['42','43']}}],payload_api_version: '3',nested_items_in_payload: true}