Table of Contents

MessageHooks - Landbot Webhooks

Pau Sanchez Updated by Pau Sanchez

Listen and capture all the messages (and events) from the bot, users and agents easily

What are MessageHooks?

MessageHooks allows you to be "notified" to all the messages and events going on in your bot. Other platforms call them "webhooks" as they trigger an HTTP POST Request to a designated (by you) endpoint, every time a message or specific event is triggered in the bot.

Those requests, contains in it's payload a range of information, that can be very useful to automate process on your end or for your custom integrations

MessageHooks are useful for

Integrate Landbot with third party HelpDesk softwares (for agents)

The most common use of MessageHooks would be to create an integration where you want to let the user interact with a Landbot bot, but you want to let the agents reply from a third party platform. Then MessageHooks come handy to get all the messages to the agents. And the also the events, to control the assignment of the conversations.

Transcriptions

If you want a transcription of all the messages between the bot (and agent) and the user, you can capture all of them easily with the MessageHook, store it in your database in real time.

Custom Analytics dashboard for clients

With those notifications, you can store a great arrange of data that can be useful to feed your dashboard and database for a custom analysis for your clients, that is used specially by Agencies.

Machine Learning

Feed your database with the conversations between the bot and the user, MessageHooks will let you make this with ease, as all the data is coming from a single endpoint to process.

How to set up a MessageHook (Landbot webhook)

Once you have a bot already created and saved with a unique name:

  1. Go to the Integrations section

  1. Select "Developers Tools":

  1. Select "MessageHooks"

  1. Press "MessageHooks" tab, next to "Description"
  2. Press "Add a new Message Hook"

  1. A screen will pop up to input the parameters:

Name: To find it after. Is required, you can edit after

Hook URL: the endpoint where you want to get the post requests sent. Is required, you can edit after

Channel: the dropdown will help you find the bot/channel that you want to track. Only one. It is required, can edit after

Token: In case you want to add an extra layer of security. Not required. You can edit after

  1. Once is filled press CONFIRM:

And that's it. Now you can will start receiving POST requests in your desired end point.

As a tip to test you can use a service like RequestBin.

Sample POST body payload

Below is a sample of a webhook payload when the user clicks on a button:

{
"body": {
"messages": [
{
"_raw": {
"extra": {},
"chat": 65363911,
"type": "button",
"channel": 761536,
"timestamp": 1606145527.9043446,
"read": true,
"readed_at": 1606145527.9062998,
"message": "Hi!",
"payload": "$0"
},
"type": "button",
"data": {
"body": "Hi!",
"payload": "$0"
},
"timestamp": 1606145527.9043446,
"sender": {
"id": 65462634,
"name": "Visitor #65462634",
"type": "customer"
},
"customer": {
"country": "Spain",
"url": "https://chats.landbot.io/v3/H-761536-PPDHF49M02RV6HV4/index.html",
"id": 65462634
},
"channel": {
"id": 761536,
"name": "MessageHooks Docs Example",
"type": "landbot"
}
}
]
}
}

Types of messages tracked

Below you will find a list of the most common types of messages you will receive

By Type

Button

Triggered when user clicks a button

type: button

Text

Triggered when bot displays a text question

type: text

Dialog

Triggered when bot displays options for the user to select

type: dialog

Image

Triggered when bot displays media block

type: image

Iframe

Triggered when bot displays media block with Youtube

type: iframe

Event

Triggered when bot event (like agent taking over). More information in "By event" below

type: event

By Sender

Customer

When the final user interacts with the bot or agent

"sender": {
"id": 65462634,
"name": "Visitor #65462634",
"type": "customer"
}

Bot

When the bot displays an automated message

"sender": {
"id": 781777,
"name": "MessageHooks Docs Example",
"type": "bot"
}

Agent

When user interacts with user

        "sender": {
"id": 40684,
"name": "Pau San",
"type": "agent"
}

By Event Action

Assign

When a conversation is assigned to an agent

 "action": "assign"         

Unassign

When a conversation is unassigned of an agent. This will happen after few minutes with inactivity from the agent or the user or closed by the agent

 "action": "unassign"

API documentation

You can also find more information about our MessageHooks in the API Docs

How did we do?

APIs

Contact