MessageHooks
MessageHooks
19 min
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 go to the integrations section select "developers tools" select "messagehooks" press "messagehooks" tab, next to "description" press "add a new message hook" 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 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 https //requestbin com/ 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 https //dev landbot io/api/index html#api messagehooks