Setup
You will need:
Install the integration
- In Botpress Studio, select Explore Hub in the upper-right corner.
- Search for the Webhook integration, then select Install Integration.
- Copy the generated webhook URL.
Configure the integration
The integration has the following configuration options:- Secret (Optional): A secret that must be sent with the request as a header called
x-bp-secret
. Leave empty to allow all requests without a secret. - Allowed Origins: List of allowed origins for CORS. Leaving this field empty blocks all requests originating from a browser and only allows requests from a server.
Send data to your webhook
You can make requests to your webhook from any environment that supports HTTP requests:Webhooks don’t return any data in the response body.
Use webhook data in Studio
You can test the webhook in the Studio’s emulator to make sure you’re handling requests properly.
- In Botpress Studio, add the Webhook Event Trigger to the Workflow you want to use the request’s data in.
- Connect any Nodes you want to the Trigger—they’ll execute whenever the webhook receives an request.
- Now, you can read the event’s payload to access information about the webhook request:
Read the payload
Here’s the structure of a webhook event’s payload:Information about the webhook request.
event.payload
are overwritten as soon as the bot or the user sends a new message. If you need to access a webhook request’s data later, consider storing it in a variable.