Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WebHooks

Hierarchy

  • { headers: {}; httpBasicPassword: string; httpBasicUsername: string; name: string; sys: MetaSysProps; topics: string[]; transformation?: undefined | { body?: undefined | object; contentType?: undefined | string; includeContentLength?: undefined | false | true; method?: undefined | string }; url: string }
  • DefaultElements<WebhookProps>
    • WebHooks

Index

Properties

headers

headers: {}

Headers that should be appended to the webhook request

Type declaration

  • [key: string]: string

httpBasicPassword

httpBasicPassword: string

Password for basic http auth

httpBasicUsername

httpBasicUsername: string

Username for basic http auth

name

name: string

Webhook name

sys

System metadata

topics

topics: string[]

Topics the webhook wants to subscribe to

Optional transformation

transformation: undefined | { body?: undefined | object; contentType?: undefined | string; includeContentLength?: undefined | false | true; method?: undefined | string }

Transformation to apply

url

url: string

Webhook url

Methods

delete

  • delete(): Promise<void>
  • Deletes this object on the server.

    Returns Promise<void>

    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)

getCall

  • getCall(id: string): Promise<Record<string, unknown>>

getCalls

  • getCalls(): Promise<Record<string, unknown>>

getHealth

  • getHealth(): Promise<Record<string, unknown>>

toPlainObject

update

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

    Returns Promise<WebHooks>

    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)