Creating a webhook
To add a new webhook, open the Webhooks page from the left sidebar in the Frigade dashboard and click the “Add webhook” button.Supported events
The following events are currently supported:flowResponse.startedFlow
When a user starts a Flow
flowResponse.completedFlow
When a user completes a Flow
flowResponse.abortedFlow
When a user aborts a Flow
flowResponse.startedStep
When a user aborts a Step in a Flow
flowResponse.completedStep
When a user completes a Step in a Flow
Webhook payload
The payload of the message includes the type of the event in thetype
property.
The data property contains the actual payload sent by Frigade.
The payload can be a different object depending on the event type.
For example, for flowResponse.* events, the payload will always be a Flow Response object.
Verifying webhooks
When you create a webhook, Frigade will generate a secret key for you. You can use this key to verify that the webhook is coming from Frigade.If you don’t verify the request, your app will be susceptible to a number of attacks since your webhook endpoint is open to the public.
data
field using the secret key as the key and compare it to the value signature
field.
Note that when JSON-encoding the data
field it needs to match the order of the keys in the payload and not contain any whitespace between the keys and values.
For example, in Node.js, you can do it like this:
Verifying timestamps
Thetime
field in the payload is the time when the event occurred. You can use this field to verify that the request is not a replay attack by ignoring older events.