Methods
The following methods can be implemented for webhook events:Subscribe
- Method key:
subscribe - Supported implementation types:
javascript,rest-api-mapping,graphql-api-mapping
webhookUri– string, URI webhooks should be sent to. It should be passed to the external app.parameters– object, parameters (matchingparametersSchema) of this particular event.
state– object, subscription state. This state will be saved and passed asstatetounsubscribeandhandlefunctions.nextRefreshTimestamp– number, optional, timestamp in milliseconds when the next refresh should be performed. Used to refresh the subscription if the external app requires it.
Handle
- Method key:
handle - Supported implementation types:
javascript,mapping
If the external app requires a response, you can specify parameters (
headers, data) for the response in the response property (optional).
This can be useful if the external API requires confirmation of the webhook URI.
Arguments:
query– object, webhook request query received from the external appdata– object, webhook request body received from the external app (parsed based on Content-Type)headers– object, webhook request headers received from the external appstate– object, state returned fromsubscribefunctionparameters– object, parameters (matchingparametersSchema) of this particular eventrawBody– string, raw unparsed body of the webhook request (useful for signature verification or when you need access to the original request body)
events– list of objects, list of events extracted from the webhook. Eacheventis an object withtypeandrecordfields.response– object, optional HTTP response with properties:headers– objectstatus– numberdata– HTTP body (based on Content-Type)
state– a new value of the state if it needs to be updated.
Unsubscribe
- Method key:
unsubscribe - Supported implementation types:
javascript,rest-api-mapping,graphql-api-mapping
webhookId received in the subscribe method.
Arguments:
state– state returned fromsubscribeparameters– object, parameters (matchingparametersSchema) of this particular event
Refresh (optional)
- Method key:
refresh - Supported implementation types:
javascript,rest-api-mapping,graphql-api-mapping
This method should be implemented if the
nextRefreshTimestamp is returned from the subscribe method.
Arguments:
state– state returned fromsubscribewebhookUri– string, URI webhooks should be sent toparameters– object, parameters (matchingparametersSchema) of this particular event
state– updated state information if it needs to be updatednextRefreshTimestamp– number, timestamp in milliseconds when the next refresh should be performed