Webhook
The Webhook channel provides a way to build a custom integration with Chatlayer that acts as a channel.
Last updated
The Webhook channel provides a way to build a custom integration with Chatlayer that acts as a channel.
Last updated
With the Webhook channel you can enrich the information sent via certain channels. For example, instead of using the direct Facebook Messenger or Whatsapp channel, you can use Webhook to send messages to Messenger or Whatsapp.
The Webhook channel should not be confused with with Webhook offloading, designed for offloading to human agents.
Chatlayer provides:
a Webhook message API endpoint: to send a user message to the bot
a Webhook configuration: Enables notifications when the bot responds to user messages sent via the Webhook Message API, as detailed here. This API operates in near real-time, allowing you to trigger event-based actions immediately upon receiving a bot response. This setup facilitates seamless integration of the bot's flow logic into your application or messaging platform.
The overall mechanism is loosely based on Pubsub protocol and relies on HTTP request containing the bot message response being sent to a consumer Endpoint URL. The customer webhook Endpoint URL can be configured on our platform as described in this section.
To add a Webhook API to your bot:
Add a Webhook channel to your bot.
Configure the Webhook URL field.
This URL must either be publicly available, or at least available from our platform's IP range. We strongly advise using HTTPS for this endpoint.
Optionally, configure the Verify token field.
This can be any arbitrary string, but we recommend you use the one provided, which was randomly generated.
POST
customer webhook endpoint URL configured in Chatlayer.ai
When a user message is sent to the Webhook message API, the bot response(s) will be sent to the customer Webhook endpoint URL.
The bot response body payload object will include the bot message. This message can have a different object structure based on the message type.
A bot message sent to the customer Webhook endpoint URL and returned as response to a user messages can have different object structures, depending on the message type. Want to learn how to build these message objects? Read about it here:
Message types