Hierarchy

Properties

active: boolean

Whether the Webhook is active. If set to false, no calls will be made

filters?: WebhookFilter[]

Webhook filters

headers: WebhookHeader[]

Headers that should be appended to the webhook request

httpBasicPassword?: string

Password for basic http auth

httpBasicUsername?: string

Username for basic http auth

name: string

Webhook name

sys: BasicMetaSysProps & {
    space: SysLink;
}

System metadata

topics: string[]

Topics the webhook wants to subscribe to

transformation?: WebhookTransformation

Transformation to apply

url: string

Webhook url

Methods

  • Deletes this object on the server.

    Returns

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

    const contentful = require('contentful-management')

    const client = contentful.createClient({
    accessToken: '<content_management_api_key>'
    })

    client.getSpace('<space_id>')
    .then((space) => space.getWebhook('<webhook_id>'))
    .then((webhook) => webhook.delete())
    .then((webhook) => console.log(`webhook ${webhook.sys.id} updated.`))
    .catch(console.error)

    Returns Promise<void>

  • List of the most recent webhook calls. See https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-call-overviews for more details.

    Returns

    Promise for list of calls

    const contentful = require('contentful-management')

    const client = contentful.createClient({
    accessToken: '<content_management_api_key>'
    })

    client.getSpace('<space_id>')
    .then((space) => space.getWebhook('<webhook_id>'))
    .then((webhook) => webhook.getCalls())
    .then((response) => console.log(response.items)) // webhook calls
    .catch(console.error)

    Returns Promise<CollectionProp<{
        errors: any[];
        eventType: string;
        requestAt: string;
        responseAt: string;
        statusCode: number;
        sys: { type: string; id: string; createdBy?: SysLink | undefined; createdAt: string; };
        url: string;
    }>>

  • Sends an update to the server with any changes made to the object's properties

    Returns

    Object returned from the server with updated changes.

    const contentful = require('contentful-management')

    const client = contentful.createClient({
    accessToken: '<content_management_api_key>'
    })

    client.getSpace('<space_id>')
    .then((space) => space.getWebhook('<webhook_id>'))
    .then((webhook) => {
    webhook.name = 'new webhook name'
    return webhook.update()
    })
    .then((webhook) => console.log(`webhook ${webhook.sys.id} updated.`))
    .catch(console.error)

    Returns Promise<WebHooks>