Skip to content

Webhook

http.webhook : object

Use webhooks via a PostalPoint cloud relay service.

Kind: static namespace of http

webhook.geturl(sourcename) ⇒ Promise.<string>

geturl - Returns a public URL that can be used as a webhook target/endpoint for third-party integrations.

Kind: static method of webhook
Returns: Promise.<string> - A URL for the webhook.

Param Type Description
sourcename string Unique identifier for the webhook

webhook.poll(sourcename) ⇒ Promise.<Array.<Object>>

poll - Returns an array of webhook payloads received by the webhook identified by sourcename.

Kind: static method of webhook
Returns: Promise.<Array.<Object>> - Payloads as received by the webhook relay service.

Param Type Description
sourcename string Unique identifier for the webhook

Example

[
     {
         // Unique ID. Used for ack(webhookid).
         id: 123,

         // UNIX timestamp (in seconds) of when the data was received by the webhook URL.
         timestamp: 1234567890,

         // Source name set in geturl()
         source: "sourcename",

         // JSON string of all the HTTP headers sent to the webhook URL.
         headers: "{'Content-Type': 'application/json'}",

         // Entire HTTP request body sent to the webhook URL.
         body: ""
     }
]

webhook.ack(webhookid)

ack - Acknowledge receipt of a webhook payload, deleting it from the relay server.

Kind: static method of webhook

Param Type Description
webhookid number Numeric unique ID received with the payload. See poll.