Show examples in:
    Retrieve a webhook

    Returns

    Returns a webhook resource object.

    Examples

    Example code:
    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.find(webhookId);
    console.log(webhook);
    }
    run();
    Returned output:
    {
    id: '312',
    name: 'Item type creation/update',
    enabled: true,
    url: 'https://www.example.com/webhook',
    custom_payload: '{ \message\: \'{{event_type}} event triggered on {{entity_type}}!\', \entity_id\: \'{{#entity}}{{id}}{{/entity}}\'] }',
    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
    }