ChatBot webhooks allows you to easily return any Bot Response(s) or Attribute(s) directly from your external service to the ongoing chat. Thanks to Webhooks, you can connect the conversation context with any data stored on your backend side and return a bot message or attribute based on that.
When should I use Webhooks?
Webhooks allow you to make your bot story dynamic and different for every end-user. There are many use-cases in which Webhooks come in handy, but here are the few most popular ones:
Checking if the visitor is our existing customer
Providing VIP customers with special bot responses (for example: transfer to the agent for VIPs only)
Returning account data to the end-user inside the chat (for example: account balance, contact details, subscription status)
Activating customer account via ChatBot conversation
As you can notice, there is an unlimited number of ideas to cover with Webhooks, and this section will help you understand how you can implement Webhooks for your ChatBot story.
Setting up your first Webhook
Please go to our Help Center to see how to set up a Webhook step by step:
[1] Our ChatBot webhook service sends a POST request to your backend service with all of the data connected with the current chat. Example body of POST request sent by ChatBot:
External ID of the User coming from our Channel Integrations (LiveChat, Facebook, Slack)
node.id
ID of the webhook block.
node.name
Name of the triggered webhook block.
node.webhookId
ID of the webhook configured in the webhook block.
node.webhookName
Name of the triggered webhook.
userAttributes
User attributes.
attributes
Attributes collected in the ongoing chat.
[2] After that, you can return in response to a Webhook with a Bot Response(s) or Attribute(s) that you can use later in your ChatBot story. For example:
[3] (optional) - You can also create a response in which you will return Attributes only, without any Bot Response. To do so, simply remove the “responses” part from your webhook’s code. You can use these Attributes with Filters attached right to the Webhook’s “Success” branch, and your bot will instantly redirect the end-user to the specific branch, depending on the filtered attribute value. For example:
{
"attributes": {
"foo": "bar",
"baz": ""
}
}
Properties
Property
Description
responses
Array of the responses which you want to send from your backend service.
attributes
Object with the attributes passed from your backend service.
Working Hours Detector - advanced webhook example that collects current time and returns different attributes depending on the time of the day. This allows you to filter by these values in your bot story and return different responses to the customers, depending on the time of the day.