How to connect Facebook Messenger with a human-agent service

Understanding Quickwork Chat. Quickwork provides a no-code, API-based SaaS platform with pre-integrated apps for automation of business workflows and messaging.

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 Quickwork Chat. 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 Quickwork Chat 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. Quickwork Chat

  2. Facebook Messenger

Creating a multichannel inbox

Login to your Quickwork Chat 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.

Figure 1: The Multichannel option

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 Quickwork Chat agent.

Configuring the trigger

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

  2. Under the Trigger section, choose the Facebook Messenger app from the drop-down menu in the Apps field 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:

Figure 2: Facebook Messenger connection window

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

Figure 3: Facebook permission window

8. 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:

Figure 4: Facebook Messenger trigger

Configuring the action

To do this, perform the following steps:

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

  2. Choose the Quickwork Chat 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 Quickwork Chat 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:

Figure 5: Quickwork Chat connection window

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:

Figure 6: Quickwork Chat action

6. Click the Save changes button and start the execution by clicking the Start Journey 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 Quickwork Chat 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 Trigger section, choose the Quickwork Chat app from the dropdown menu in the Apps field present right below the New Trigger button.

  3. Select the trigger event, New text message from agent, 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:

Figure 7: Webhook URL

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

Figure 8: FBM Communication inbox

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

Figure 9: Quickwork Chat trigger

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:

Figure 10: Facebook Messenger action

9. Now click the Save changes button and then the Start Journey button to push it in execution. Both the configured journeys shall now look like this:

Figure 11: Configured multichannel journey

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 Quickwork Chat account.

  3. Now to check if the agent has received the message or not, let’s go back to the Quickwork Chat 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 Mine and Resolved filters:

Figure 11: FBM Communication inbox

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:

Figure 12: Conversation dashboard

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:

Figure 13: Agent sending message from the dashboard

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

Figure 14: Reply from agent on Facebook Messenger

Hence this is how a human-agent can connect with a user on Facebook Messenger with the help of Quickwork Chat and Quickwork Journey Builder.