This method of collecting events is used when an External App uses a single webhook per connected application rather than allows creating any number of connection-layer webhooks. In this case, the single webhook should be configured by the developer of the connected application and events received through this webhook need to be routed to a correct Tenant and Connection but the Global Webhooks mechanism. This mechanism consists of two parts:Documentation Index
Fetch the complete documentation index at: https://docs.getmembrane.com/llms.txt
Use this file to discover all available pages before exploring further.
- 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.