To jump straight into some template code, you can go to our integration-guides repository on GitHub and pay close attention to the directories under
Create your own webhook
You can define one webhook URL for a brain, and then call the webhook from one or more dialog nodes. To create your own webhook go to your brain > Webhooks > + Create webhook. You need to provide the following:
- Verification token
You can also add any headers that you want to pass to the service during the webhook call.
The only headers that you aren't allowed to add are:
Test your webhook
You can test your webhook by clicking on Send test request.
On the right side you will receive:
- The status code
- The execution time
- The response or any error
Update context variables
Upon receiving your webhooks response, you can select Update context variables in order to use the values returned by the webhook in the brain while setting context variables from auto-complete functionality.
The Advanced test section allows you to edit the payload of the request.
Testing with cURL
We provide an integration-guides repository on GitHub, which includes ready-made webhooks that you can use in your brains and that might also function as the templates for your own custom implementations.
Random number generator
This is a simple function that returns a random number based on the values of the query parameters. It can be used for simple examples such as A/B testing, and more. You can make an example call to the webhook using curl:
Get recent purchases
This function is more involved and returns a carousel of recent purchases for the user. It takes into consideration a time-cursor so that it can keep loading older cards in the carousel message.