Integrations with Chatlayer, how does it work?
Would you like to start your integration journey with Chatlayer? Great choice!
This page will help you to get started and guide you in the right direction.
Chatlayer offers multiple ways of integration, all with their own possibilities.
The API integration is an integration that allows you to make API calls to your server and process the result as responded by your server. You can find this in an action dialog > API.
You can best use API when you want to make an API call to your server for the following use-cases:
- To easily create a GET or POST request with only filling in the headers and parameters.
- When you want your server to respond to a particular message.
- When you want to get details to be stored in the session from your server.
- Integrate with your own API where you can make changes if need be.
Our own REST JSON API, as described in our API documentation, can be used to make the API calls to Chatlayer and can be used as another way to integrate your service to Chatlayer.
One of the most common use cases of using the Chatlayer (REST JSON) API would be to integrate Webhook channel. We also provide a variety of service via our API some of which are:
- Get all conversations
- Get all messages in a conversation
- Send messages
- Set session
- Pause/unpause the bot
- Trigger a specific dialog of the bot
- Extract the NLP for an expression
While making request to chatlayer API, Chatlayer expects a bearer token to be passed for the authorization. In case of unauthorized token, we respond with
401 Unauthorizedstatus code.
Some of the endpoints are rate limited and those can be figured out by checking the headers as defined below:
HTTP/1.1 200 OK
x-ratelimit-limit- the rate limit ceiling that is applicable for the current request.
x-ratelimit-remaining- the number of requests left for the current rate-limit window.
x-ratelimit-reset- the time at which the rate limit resets, specified in UTC epoch time (in seconds) code editor
The example request samples can be seen on the right side of the page for each request. Some of the sample responses can also be seen on the bottom right of page.
You can expand all the request body schema to find all the schemas of the objects that can be sent in as the request to the Chatlayer API as shown in the image below and on this page.
You can best use Code editor if you want:
- Custom logic to be added into the bot, deciding where the flow should go next. This can also be done with Go Tos, but the code editor allows for more complex conditions than the Go To.
- To use the response sent by the server during an API call and want to first analyse the data sent by the server before further processing it.
The Webhook channel is best used when you want to use our amazing NLP engine and the bot flow that is provided by the Chatlayer along with your own custom page that handles the chat UI. Webhook integration can also be used if you want to integrate a bot in Chatlayer with another bot that you have running somewhere else.
The concept behind this integration is that Chatlayer will work behind the scenes to process your queries and then once the query is processed, Chatlayer will call your API with the result. This makes this integration more lightweight and can be easily integrated with other channels . For the processing intensive tasks, you do not have to keep waiting for the response from Chatlayer as we will call your own API URL when the processing is done.
You can activate Webhook channel in the 'Channels' page on the platform. All you have to do is provide the URL where we need to make the API call when the webhook request is processed.
You now have chosen which integration type is best for your bot, great!
Now, you will need to start mapping out what your integration will look like.
For every integration, except the Webhook channel, it is important to visualise which information you first need to collect from the user before you send it to the external system. For example, when creating a ticket in an external ticketing system, first decide which variable you need, such as category, description, email address etc. Then, make sure all these variables are sent over correctly to the external ticketing system.
With response integrations, you would need to visualise what you would like to do with each response from the external system. Which responses can you receive from that system? Is there a certain logic, that response X leads to a different bot dialog in Chatlayer than response Y?
Asking yourself these questions beforehand, and preparing your integration to cover all scenarios, will make it easier to build your integration on Chatlayer.
Here you can find some frequently asked questions about our integration options:
Chatlayer API works as request and response format, so a request is sent to the external system and a response is sent back.
The Webhook API works as an event triggering system where, when the processing of certain request is complete, we do an API call to your system with the data that you expected from the previous call.