How to connect Facebook Messenger with a human-agent service

Integrate Facebook Messenger with Quickwork to chat with Facebook users and solve their queries. Eliminate the constraint of web widgets since messaging platforms are more prominent for conversations.

In the previous document, we used the multichannel feature and configured journeys allowing agents to interact with the users on WhatsApp. This document is a resemblance that features Facebook Messenger as a communication channel integrating with Conversation Management. Let's drill through this document and understand the usage of the multichannel feature using Facebook Messenger.

Use case

Communicate with a user on Facebook Messenger and make him/her understand the product functioning using Conversation Management as a messaging platform.

To implement this use case, we need to build two journeys with the following two adapters. The journeys will execute in synchronization thus facilitating the flow of messages in real-time:

  1. Conversation Management by Quickwork

  2. Facebook Messenger

Creating a multichannel inbox

Login to your Conversation Management dashboard and click the gear icon located on the left to open the Settings section. Click on Inbox Settings from the navigation menu on the left and then click on the Add New Inbox button to start creating a new inbox. Select the Multichannel option to proceed:

Enter a name for the inbox, for example, FBM Communication, and click Continue. Add any agents if you want to assign specific agents for this inbox or else assign it to yourself and then click Continue. Your inbox is now ready. Scroll down and click on the Go To Dashboard button to redirect to the conversations dashboard of the respective inbox which will be blank as of now.

Creating the first multichannel journey

Let’s create the first journey that will fetch new messages sent by users from Facebook Messenger and will forward those to a Conversation Management agent.

Configuring the trigger

  1. Create a new journey named New message from an FBM user.

  2. Under the Event section, choose the Facebook Messenger app from the Apps list present right below the New Trigger button.

  3. Select the trigger event as New text message from the drop-down menu in the Triggers field.

  4. To authorize and connect your Facebook Messenger account, click on the Link an account button. Click here to know how to connect to Facebook Messenger. You can either use an existing connection from the drop-down or click on the + Create new connection option to create a new connection.

  5. On clicking the Link an account button, the Connect to Facebook Messenger window will appear. Enter a new name for your connection and the Page ID and click on the Link account button:

6. On clicking the Link Account button, you will be redirected to Facebook’s permission management page. Select your suitable configuration and continue:

7. Once the authorization has been completed, the new window that had opened for Messenger’s authorization will automatically close and you will get a notification message in the journey stating Your connection has been successfully established. Your trigger should then look like this:

Configuring the action

To do this, perform the following steps:

  1. Under the Steps section, click on the Simple Action button.

  2. Choose the Conversation Management by Quickwork app from the drop-down menu present in the Apps field.

  3. Select the Forward message to agent action in the Actions field.

  4. Create a new connection with the FBM Communication inbox that you had just created. To do so, click the + Create new connection option if you have existing Conversation Management by Quickwork connections, and then click on the Link an account button and specify the API key and Inbox ID of this inbox. You’ll get these in the Toolkits window of the FBM communication inbox present in the Inbox Settings option on the Settings page. After entering the required data, click the Link account button:

Note: The API key is common for all the inboxes of an account whereas the Inbox ID is unique for each inbox.

5. Once the connection has been successfully created, the input fields will open up automatically. Drag the Sender ID and Text Message data pills from the Data Tree Output and drop them into the Multichannel Identifier and Message fields, respectively. Select Facebook Messenger as the Multichannel type from the drop-down given. Your action should now look like this:

6. Click the Save changes button and start the execution by clicking the Save & Start button.

Creating the second multichannel journey

Let’s configure the second journey which will allow an agent to reply to the user’s queries on Facebook Messenger via the Conversation Management portal.

Configuring the trigger

Follow the steps as given below:

  1. Create a new journey named Reply from QC agent to the Facebook Messenger user.

  2. Under the Event section, choose the Conversation Management by Quickwork app from the Apps list present right below the New Trigger button.

  3. Select the trigger event, New agent message, from the drop-down menu present in the Triggers field.

  4. From the drop-down menu of selecting existing connections use the same connection that you had created in the previous journey with the inbox named FBM communication.

  5. In the event field, enter the text Message from an agent. The journey builder will return a webhook URL as shown below:

6. Now copy this URL and go to Inbox Settings for the FBM Communication inbox in your Conversation Management account. Then go to the Webhook tab and paste this URL in the Agent Response Webhook field:

7. Click the Save Changes button. Your successfully configured trigger shall now look like this:

Configuring the action

To do this, follow the given steps:

  1. Under the Steps section, click on the Simple Action button and choose the Facebook Messenger app from the drop-down menu in the Apps field.

  2. Select the Send Message action from the drop-down menu present in the Actions field.

  3. Select the same existing connection which was created in the previous journey for the Facebook Messenger account in the drop-down menu with the title Existing connections of Facebook Messenger and then click on the Link Account button.

  4. Once the connection has been successfully created, all the input fields will get loaded.

  5. Select the Message type as Response from the drop-down.

  6. Now drag the MultiChannel Identifier data pill from the Data Tree Output and drop it in the Recipient field.

  7. Similarly, drag the Content data pill from the Data Tree Output and drop it into the Message text field.

  8. Your action should now look like this:

9. Now click the Save changes button and then the Save & Start button to push it in execution.

Executing the multichannel functionality

  1. Open your Facebook Messenger account and find the page with which you have created a connection in your journeys from the Search bar if it is a new conversation.

  2. Now let’s send a Hi and check if we receive the same on our dashboard in our Conversation Management account.

  3. Now to check if the agent has received the message or not, let’s go back to the Conversation Management dashboard. Click on the Conversation icon on the left and select the inbox named FBM communication.

  4. Now in the filters dropdown above, which is located exactly beside the inbox name, use that to select the Unassigned filter option:

You shall now see all the conversations that you receive on the connected page from Facebook Messenger here. As soon as you text via Facebook Messenger, you will see a conversation get created here as shown below. Click on it to open it:

Now the agent can start sending messages to the user directly from the dashboard and users, too, can follow up with agents directly and conveniently on Facebook Messenger:

The agent’s response gets automatically synced on Facebook Messenger as well and the user receives the response sent by the agent via Conversation Management’s dashboard:

Hence this is how a human agent can connect with a user on Facebook Messenger with the help of Conversation Management and Quickwork.

Last updated