The Webhook channel provides a way to build a custom integration with Chatlayer that acts as a channel.
With the Webhook channel you can enrich the information sent via certain Channels. For example, instead of using the 'regular' Facebook Messenger or Whatsapp channel, you can use Webhook as a channel and send your messages via Webhook to Messenger or Whatsapp.
With a regular channel integration, the channel is directly connected to Chatlayer
By using the Webhook channel, the channel of choice is indirectly connected with Chatlayer
The two images above show the difference between using the channel of your choice directly, or if you would like to use Webhook to enhance the channel possibilities.
Our platform provides the following features:
- a Webhook message API endpoint to send a user message to the bot
- a Webhook configuration to be notified when bot messages are returned as response to a user messages sent to the webhook message API as described in this section. This API is almost realtime and the purpose is to be able to trigger event-based behavior as soon as a bot message response occurs . This way you will be able to integrate the bot flow logic in your own application or message channel.
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.
You can register a webhook API by adding a new channel type webhook in your channel configuration:
Now configure both settings:
- Webhook URL: 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.
- Verify token: This can be any arbitrary string, but it is recommended to be chosen at random.
customer webhook endpoint URL configured in Chatlayer.ai
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: