Summary
Webhooks in Wati's Chatbot Builder allow you to send and receive real-time data between your chatbot and external applications using GET or POST API requests. This feature enables dynamic chatbot interactions, such as fetching user details, verifying data, or integrating with third-party services.
Note: The Webhook feature is available only in the Pro & Business plans. If you're on the Standard plan, you can create and save chatbots with webhooks, but you will need to upgrade to use them in Keyword Action or Default Action workflows.
Instructions
Advanced Chatbot Builder is available in the Pro & Business Plan only.
How to Use Webhooks in Chatbot Builder
1. Adding a Webhook to Your Chatbot
Open the Wati Chatbot Builder.
Drag and drop the Webhook icon into the chatbot workflow.
Connect it to a relevant chatbot step.
2. Configuring the Webhook Node
URL & Method
Choose a request method:
GETorPOST.Enter the URL endpoint of the external API.
Make the URL dynamic by inserting variables using the Variables button.
Example:https://webhook-wa-testing.clare.ai/123456789?name={{name}}
Customize headers
Headers let you include extra details in your request, such as content type or authorization.
Headers are optional and turned off by default.
They must follow a key-value format.
Example:
Key = Content-Type
Value = application/json
Customize the body
The request body is where you include the data sent to the external API.
The body is optional and turned off by default.
When enabled, the body must always be in JSON format.
Set your test variables
Define test variables manually to simulate API responses while setting up your webhook.
3. Test the webhook request
Click Test the request to check if the API call works as expected.
4. Save API responses as variables
You can capture values from the API response and store them in variables or custom attributes.
If the API returns JSON with key-value pairs, you can extract and save specific values.
Example: storing "result": "success" from an API response:
{ "result": "success" }
Storing Values Inside an Object
Use the format:
objectKey.keyName.Example: To store
QuoteIdfrom the response below, useResult.QuoteId.
{
"Result": {
"QuoteId": "xxxxx",
"QuoteNumber": "xxxxxx",
"PolicyNumber": null
},
"MessageValidation": null,
"QuoteReferrals": null
}Store values inside an array of objects
To extract and store a value from an array of objects, use the format:
$.[0].objectKey.keyName[0].value
Example: To capture the value of current_status, use:
$.[0].tracking_data.shipment_track[0].current_status
Sample JSON:
[
{
"tracking_data": {
"track_status": 1,
"shipment_track": [
{
"id": 1278937320,
"current_status": "Delivered"
}
]
}
}
]
5. Using Response Routing
Response routing allows you to split chatbot actions based on response status codes.
You can define different chatbot flows depending on the API response.
By integrating Webhooks, you can enhance chatbot functionality with external data, automate workflows, and improve user interactions dynamically.
Frequently Asked Questions (FAQs)
General questions
1. What are webhooks in Wati’s Chatbot Builder?
Webhooks let your chatbot send or receive real-time data from external applications using GET or POST API requests. This helps you create dynamic and personalized chatbot responses.
2. Which plans support the webhook feature?
Webhooks are fully available in the Pro and Business plans. Users on the Standard plan can create and save chatbots with webhooks but must upgrade to use them in Keyword Action or Default Action workflows.
3. How do I add a webhook to my chatbot?
Open the Chatbot Builder, drag the Webhook icon into your workflow, and connect it to the chatbot step where you want the API call to happen.
4. What methods and URLs can I use for webhook requests?
You can use either GET or POST requests. Enter the required API endpoint and insert variables in the URL if you want to pass dynamic user data.
5. Are headers and request body required?
No, both are optional. Add headers only if the API needs extra details like authorization or content type. Enable the body only when you must send JSON data to the external API.
Testing and response handling
6. How do I test if my webhook is working?
Use the Test the request option to confirm the API call is working as expected during setup.
7. Can I store values from the API response?
Yes, you can save returned values in variables or custom attributes. This works for simple responses, nested JSON objects, and arrays.
8. How do I extract values from nested objects or arrays?
Use dot notation for objects (for example: Result.QuoteId) and the array format for lists (for example: $.[0].tracking_data.shipment_track[0].current_status).
9. What is response routing?
Response routing lets you define different chatbot flows based on API status codes so the chatbot can respond differently to successful or failed API calls.





