Show examples in:
Update a webhook

Body Parameters

name  Optional  string  Example: "Item type creation/update"

Unique name for the webhook

url  Optional  string  Example: ""

The URL to be called

custom_payload  Optional  string, null  Example: "{ \"message\": \"{{event_type}} event triggered on {{entity_type}}!\", \"entity_id\": \"{{#entity}}{{id}}{{/entity}}\"] }"

A custom payload

headers  Optional  object  Example: {"X-Foo":"Bar"}

Additional headers that will be sent

events  Optional  Array  Example: [{"entity_type":"item_type","event_types":["update","create"],"filter":{"entity_type":"item_type","entity_ids":["42","43"]}}]

All the events you will be notified for

http_basic_user  Optional  string, null  Example: "user"

HTTP Basic Authorization username

http_basic_password  Optional  string, null  Example: "password"

HTTP Basic Authorization password

enabled  Optional  boolean  Example: true

Whether the webhook is enabled and sending events or not

payload_api_version  Optional  string  Example: "3"

Specifies which API version to use when serializing entities in the webhook payload

nested_items_in_payload  Optional  boolean  Example: true

Whether the you want records present in the payload to show blocks expanded or not


Returns a webhook resource object.


Example Basic example
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, {});