- Global Webhook definition inside a Connector.
- External Event definition with
global-webhookimplementation type.
Global Webhook Definition
Global webhooks are defined inside a Connector. They are defined as connector files insideglobal-webhooks directory, for example:
You should provide details on how to do this in the connector documentation.
spec.yml
Global webhook specification looks like this:handle
The handle function is called when data is sent to the webhook. Example: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 appparameters– connector parameters configured on the integration the webhook belongs torawBody– 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 events. Each event has the following properties:selector(string) – selector to find matching external event subscriptions (see External Events)payload– arbitrary event payload that will be passed to matched subscriptions.
response– object, optional HTTP response with properties:headers– objectstatus– numberdata– HTTP body (based on Content-Type)
Global Webhook Event
External Events implemented through global webhook look like this:Functions
The following functions can be implemented for events withglobal-webhook implementation type:
getEventsSelector
This method returns data that will be used to route the event to the correct connection.
Supported implementation types: javascript, mapping
Example:
parameters– object of parameters (matchingparametersSchema) of this particular event.
globalWebhookKey– key of the global webhook defined in the connector (see Global Webhooks)globalWebhookEventSelector– string that is used to route the event to the correct subscription. This string typically needs to be generated dynamically based on the event parameters and information we can get from the current connection (using apiClient or credentials).
globalWebhookKeyreturned from this method matches the key of the global webhookglobalWebhookEventSelectorreturned from this method matches the event selector associated to the event returned by thehandlemethod of the global webhook.