Use Landbot interface for users and third party helpdesk apps for agents (livechat) - API Integration

Pau Sanchez Updated by Pau Sanchez

Landbot offer a Chat section where agents can interact with the end user that is using Landbot Web Interface to interact with a bot. But for some business reasons you might need to use a different solution (like Crisp, Slack, Microsoft Teams...) to offer the agents to interact with the end user.

Here are the main topics you need to know before you start building your custom integration:

1. API Basics

API Documentation

Authentication
  1. API Key (& agent)

Where to find it:

Where you will need to use it:

El agente será el usuario del cual estés usando su API Key

Params
  1. customer_id

Where to find it:

Where you will need to use it:

  1. channel_id

Where to find it:

Where you will need to use it:

  1. agent_id

Where to find it:

Where you will need to use it:

  1. bot_id

Where to find it:

Where you will need to use it:

  1. node id

API methods
  1. Send_text
  2. Assign_to

  1. Unassign

  1. Assign_bot (specific node)

Subscribe to events - MessageHooks

To be able to get all the information you should....

2. FLOW SETUP BUILDER BOT

The best approach would be to automate the conversation initially using Landbot and getting some data from the user necessary for your agent.

Every helpdesk app, have a different way of working but we would suggest at least to get the name and email.

Once you have done that, in some cases, before you start the conversation with the agent, you might want to create such profile in your system with a previous request using the information gather.

After your request is done with the Webhook block to assign in your system the conversation to an agent and while is waiting for such agent to answer, you need to keep the user in a closed loop while is waiting. It has to be a closed loop so that the user don't "finish" the session.

Once the SendText method is triggered, from that point the bot will stop managing the conversation, and from that point you will control all the interaction with the API.

To be able to capture all the inputs from the user, the best approach is to use the MessageHooks. Don't try to set up a closed loop.

Styling - CSS

In case you want to hide the notification of the human takeover, please add this in the Design > Custom Code > Add CSS section:

.htomessage { display: none; }

2. COMMUNICATION ARCHITECTURE

The best approach is to set up 3 middle-services that take care of specific flows of the communication:

1 - User to Helpdesk agent

User (Landbot Inteface) > Landbot API (MessageHooks) > YOUR MIDDLESERVICE > YOUR MIDDLESERVICE > 3rd Party APP (Helpdesk)

Continuous listening

La manera para controlar los inputs del usuario y los eventos, es mediante los MessageHook (webhooks): https://dev.landbot.io/api/index.html#api-MessageHooks y https://help.landbot.io/article/n9zxrqx1ig-message-hooks-landbot-webhooks

2 - Helpdesk agent to User

3rd Party APP (Helpdesk) > MIDDLESERVICE > Landbot API (Send Text) > Landbot Interface

API method to send texts to the end user:

Los mensajes que se envía por parte del agente de tipo text se hacen con este método: https://dev.landbot.io/api/index.html#api-Customers-PostHttpsApiLandbotIoV1CustomersCustomer_idSend_text

3 - Socket Timeout reassignment

Landbot API (MessageHooks) > You middleservice > Landbot API Assign

Timeout and reassigment

A los minutos de estar el usuario y el agente sin interacción la conversación se desasigna. Por lo cual ni el agente ni el usuario puede interactuar. En el caso de unassign. Via API se puede volver a assignar dicha conversación y restablecer el flujo. El método para asignar la conversación al agente (https://dev.landbot.io/api/index.html#api-Customers-PutHttpsApiLandbotIoV1CustomersCustomer_idAssignAgent_id

How did we do?

Contact