Summary
LiveAgents mediator acts as a middleware and allows forwarding an user from a conversation with an automated bot to a live chat with a real agent.
This mediator has been designed to receive and send messages from the final user to the agent and viceversa, and its not linked to an specific channel.
Architecture
In order to establish a conversation with a live agent, the user must be placed in the queue and wait for an agent to take the conversation. Once these steps has been completed, messages will flow between the user and the agent through the middleware.
Bot building platforms usually allows users to contact the automated bot through different channels, such as SMS, Social Networks Chats (Facebook Messenger, WhatsApp, Telegram and more) as well as from a web chat. At that point, the conversation is managed by the automated bot that may be implemented in platforms such as RapidPro, Google DialogFlow and similars.
When user requests a live chat session, the bot must perform this request to the LiveAgents Mediator by posting the required fields (see examples section). The posted data allows the mediator to register the user as a visitor in the live chat management platform, which for this implementation will be RocketChat.
Once the user has been registered, the mediator will place the conversation in the corresponding queue depending on the requested DEPARTMENT. This department must be a valid one at the RocketChat server and will be the bot who must decide the value for it.
A list of departments will be available for each project and country and will result in a single string that will have the format: COUNTRY_PROJECT[_SUBPROJECT], e.g. GTM_HIV_GENERAL , GTM_FP.
After the user has been registered and placed in the queue, available agents will be notified and suddenly one of them will take the conversation and now the user will be chatting with a real agent.
Each user message should be delivered as a new request to the corresponding endpoint from the mediator including the required parameters so it can be correctly delivered to the agent. In the other hand, messages coming from the agent to the user, will be delivered to the bot building platform (e.g. RapidPro) by using its API. Since the API will be used for delivering messages, the LiveAgents Mediator MUST know the corresponding credential to establish the correct communication and perform the needed requests. These credentials will be stored safely in the mediator.