When you have integrated a chatbot with Facebook Messenger, the bot will handle all of the inquiries from your end users. As a result, all inquiries will automatically be stored in the Done folder in Facebook.
This can be problematic if your end user needs help from a human agent. Therefore, it’s important to create a takeover process between the bot and the human agent. Creating a human takeover will allow your human agents to take control of conversations in either Facebook’s panel or through a third-party app, so the bot remains silent unless the human agent returns the conversation back to the bot.
In this article, we will cover:
Preparing your Facebook account for human takeover
There are some cases wherein the bot should take the end user to another Facebook app or to the Facebook page inbox, so a human can take over.
To do so, you will need to go to the listed apps linked to your Facebook page in the Messenger Platform page. Here, you will need to make sure that Codemonkey is integrated with your Facebook site.
This is automatically done when you integrate your chatbot on the Codemonkey Platform. Facebook will automatically list the Page Inbox app at the bottom of the list as an app that may receive traffic as any other third-party app. Make sure that the Codemonkey app is the primary receiver, and any other app is set as a secondary receiver. In this way, the bot will work as first-line support.
If you don't have any other app and want your human agents to interact with your bot’s users through Page Inbox, select "Page Inbox" as the secondary receiver.
Setting up your bot for human takeover
To be able to take over a conversation from your bot, you can have a Module in your chatbot that asks whether or not the end user wants to be handed over to a human agent. If the end user says "Yes", you should send them to a Module where you can ask end users to confirm their choice.
In the connection of this Module, you should create a connection where there is a condition that accepts some sort of user input, as this will trigger the Webhook.
You should also add two types of action to the connection: add the following Webhook, and also add where the user should be sent to after this Module. This Webhook ensures that the conversation gets handed over to the secondary receiver on your Facebook page:
https://app.certainly.io/fbbot/api/passcontrol/? target_app_id=<secondary app id> &metadata=<string_to_pass_to_the_secondary_app_at_the_time_of_handover>
In the Webhook, there are two parameters:
- The first parameter is <secondary app="" id="">. This can be found on the Messenger Platform site under the Apps section, and it should be a string of numbers.
- The second parameter is <string_to_pass_to_the_secondary_app_at_the_time_of_handover>. This is just a label that can indicate to your human agents what the subject is about. Please be aware that spaces are not allowed, so either use ‘_’ or an encoder for this message.
Both parameters are optional. If target_app_id parameter is not present, control will go to the Page Inbox app by default.