Choose your language:
    Update a webhook
    name  string  Optional

    Unique name for the webhook

    url  string  Optional

    The URL to be called

    customPayload  string, null  Optional

    A custom payload

    headers  object  Optional

    Additional headers that will be sent

    events  Array  Optional

    All the events you will be notified for

    httpBasicUser  string, null  Optional

    HTTP Basic Authorization username

    httpBasicPassword  string, null  Optional

    HTTP Basic Authorization password

    enabled  boolean  Optional

    Whether the webhook is enabled and sending events or not

    payloadApiVersion  string  Optional

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

    nestedItemsInPayload  boolean  Optional

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

    Returns a webhook object.


    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.update(webhookId, {
    name: 'Item type creation/update',
    url: '',
    customPayload: '{ message: 'Successfully published record!' }',
    headers: {
    xFoo: 'Bar'
    events: [
    entityType: 'item_type',
    eventTypes: [
    filter: {
    entityType: 'item_type',
    entityIds: [
    httpBasicUser: 'user',
    httpBasicPassword: 'password',
    enabled: true,
    payloadApiVersion: '3',
    nestedItemsInPayload: true
    Returned output:
    > node example.js
    "id": "312",
    "name": "Item type creation/update",
    "enabled": true,
    "url": "",
    "customPayload": "{ message: 'Successfully published record!' }",
    "httpBasicUser": "user",
    "httpBasicPassword": "password",
    "headers": {
    "xFoo": "Bar"
    "events": [
    "entityType": "item_type",
    "eventTypes": [
    "filter": {
    "entityType": "item_type",
    "entityIds": [
    "payloadApiVersion": "3",
    "nestedItemsInPayload": true