Table of Contents

How to create an API chat bot and set up the Hook Url

Pau Sanchez Updated by Pau Sanchez

With an API Chat bot, you would be able to create visually in our builder the main logic. Once is created the bot in builder, in the Channels section, you will set up the Hook Url, where all the events and messages, will be posted.

Create API Chat bot

  1. Go to the main Dashboard and click "Build a Chatbot", and select "Landbot ApiChatbot"

After this, the builder will display. Set a name and save it.

Set the Hook URL

Events from the bot will be sent to your app endpoint to be processed. Here is how you can set the hook url:

  1. Go the Channels section
  2. Select APIChatbot
  3. On the top right corner press "CREATE A NEW CHANNEL"
  4. A new screen will be displayed,
  5. Introduce the Channel name, that is private and only for you, you can also change it later
  6. Introduce the Hook URL, where all the messages and events will be send via POST REQUESTS.

You can have more than one Hook Url:

  1. Once is done, press CONFIRM

  1. Once is confirmed an Auth Token gill be generated below:

And also, you will see a new tab called "Linked Bot", press it

  1. Here is where you will select the API chat bot you created in the Dashboard, bear in mind you can only select an APIchat bot:

Confirm the selection, and that's it.

Hook requests

Here is an example of how the requests will come in case is a message:

For more information please check here: https://dev.landbot.io/chat/index.html#api-Webhooks-PostYour_webhook_url

Send your first Message to the API Chat bot

Here is an example of the Request needed:

curl --location --request POST 'https://chat.landbot.io/v1/send/' \--header 'Authorization: Token 12345ABCD' \--header 'Content-Type: application/json' \--data-raw '{ "message": { "type": "text", "message": "Hello World" }}'

For more information: https://dev.landbot.io/chat/index.html#api-Send-PostHttpsChatLandbotIoV1SendCustomer_token

The Auth token needed to send message, is the one generated earlier in the Channel:

How to preview your API Chat bot

The only way to preview this channel is to integrate it with another platform. To do this, you can make a web bot and then use the Jump To block to link up the APIChatbot with the web bot.

The API Platform

In case you want to control other elements of the bot, from variables (customer fields) to assignations, please check here: http://dev.landbot.io/docs/?content=api_platform

Note: The url where this section indicated the channel id:



In this case this will be the 483663

The Auth token to use the platform API is the one in the Accounts section

How did we do?

Create an SMS bot with ClickSend and API Chatbot

Building a Slack APP Bot with Landbot APIChat and Node JS

Contact