Facebook Messenger Integration

Facebook Messenger Integration

Flow

Message will come to the chat server with a POST request within the message of a Facebook user. With this request, webhook events are listened to and data such as text messages and sender_id sent by the user are received. sender_id is a unique parameter for the Facebook user, and a user's sender_id on different Facebook pages is also different. 

The request from the chat server goes to Habanos and comes to the Agent Screen as a New Chat Request, where sender_id is used to create the room. Since it is not possible to terminate the chat started on the Facebook side, messaging should be terminated at the initiative of the Agent. 

Opening and closing messages, which indicate the initiation and termination of messaging, can be set in System Admin → Chat Widgets. Also, chat applications are divided into two types in the Chat Widgets section: Facebook Messenger and Call Center Studio Chat.

Setup:

The Facebook Messenger Bot application offered by Messenger Platform is required for the integration of Facebook Messenger and a third party application. For a Messenger Bot application, a Facebook Application and a Facebook Page linked to this application must be created first. A new Facebook Application can be created by clicking "Add a New Product" at the address below.


After clicking "Add a New Product" from this address, a screen will appear where the application name and e-mail address fields are requested. 

The application will be formed after filling these fields with the necessary information and clicking “Create APP ID” button. 

By clicking on the Product menu on the left side of the application, the products that can be added to the application will appear on the screen. 

First, set up the Messenger:


After the Messenger is set up, Messenger will be added to the application on the next screen, but it will appear as not active. To activate Messenger:

1. An application linked Facebook Page must be created or an existing Facebook Page must be subscribed to the application.

2. To listen to Webhook events, webhooks must be installed (Setup Webhooks).


Step 1: Creating a Facebook Page

A new page can be created by saying "Create a new page" (if you don't have one). After clicking the button, Facebook Page will be created by following the steps. You can give the Facebook Page the name you want. "Alotech Communication Technologies" is used as an example in this document. 

After refreshing the Facebook Application screen, the page created in the "Select a Page" section will appear. After clicking it, the Page Access Token that connects the page with the application will be obtained.




Step 2: Uploading Webhooks

Install webhooks by clicking the "Setup Webhooks" button.

In this screen, the Callback URL field is the address that allows GET and POST requests to reach the chat server. This address will be given by creating a chat widget from the System Manager → Chat Widgets section.

Verify Token is a random string that is put into practice for security purposes (to be determined when creating the Chat widget.). The verify token on the application screen must match the verify token in the generated  chat widget . If it does not match, an error will be received and webhook installation and updating will fail. 

Important:  Only messages and messaging_postbacks events should be opened from subscribed events. One of these events may cause errors in messaging because we will not use other events.



Step 3: Creating a Chat Widget

After that, go to the System Manager → Chat Widgets section. Chat applications in Chat Widgets are divided into two types. For Facebook Chat Integration, select the Facebook Messenger type and the Verify Token (arbitrary) and Page Access Token (facebook developer → messenger settings → token generation) fields must be filled. 

Verify Token is the area shown in the screenshot above and the same value must be entered in the Chat Widget Screen to establish a connection. 

Callback URL is the URL that will be produced exclusively for namespace after the Chat Widget is registered. (After the chat widget is saved, the URL can be accessed by pressing show.)





After entering the Page Access Token and other mandatory fields obtained during the Verify Token and Page creation phase, save the Chat Widget. Click the Show button of the generated Chat Widget, the Callback URL that will be entered into the Facebook application will be ready. 

Copy and paste it into the Facebook application and click Verify and Save.

Webhooks will appear installed on the Facebook application.

Step 4: Incoming Chat settings

Enter the System Admin → Incoming Chat screen. Create a new Incoming Chat and select the Chat Widget that was saved as Chat Widget on this screen. From this section, working hours can be selected for the chat to work and an offline message can be created. An offline message is displayed to a user who writes from Facebook outside office hours.

The tenant is ready to receive messages from Facebook Page after the Chat Widget and Incoming Chat settings are completed. After the message is sent, the chat request enters the queue and goes to the Customer Representative in Ready status. 

Quick Replies

The Quick Replies method provided by the Messenger Platform is available to learn the email address and phone number information from a Facebook user. Facebook user's email address or phone number.

If registered on Facebook, this information can be shared by the Customer with the Customer representative. This information is also recorded in the Quality Control and Supervisor Screen Chat Records.

To submit a request e-mail address "Email", telephone number to request, "Phone" must be used by the customer representative keywords. These buttons that will come to the Facebook user's screen are clickable and when clicked, this message is read with the messaging_postback event. In this regard, Quick Replies differs in reading webhooks of other text messages.

App Review:

In order for an application created on Facebook to be opened to public use, it must be examined and approved by Facebook testers.

Choose the app we created on the developer screen.


Then, it is necessary to enter the Messenger Setting on the left side of the dashboard.
 
There is an app review for the Messenger section at the bottom in Settings. Select the api (pages_messaging) that we send in this section and click “add to submission”.

We will come across such an answer and we need to complete a few steps to submit a "submit for review".

Click Add Details, then, tick the checkbox that says “I agree to Facebook's permission and feature usage guidelines.”

Underneath the part where it mentions “Tell us about the use case(s) for your app will use the permission for”, check the box that says "involved business integration to support live chat by humans.” 

As an explanation(optional); “We generate a platform for call center usage. When someone writes a message to facebook page, it comes to our special interface for responding. (as shown in the video that I dropped).” can be written.
 
Under Test and reproduce the functionality of your integration, we should select the page on which page we want to use our app from the "select a page" button.
 
Next, write down the phases step by step that facebook testers need to follow in order to test.
 
“Step1: Go to the relevant (we can also type the page url) page.
Step2: Click on “Send message”, and get Started.
Step3: Write a message and send.
Step4: Wait for someone to respond. “ 
 
Finally, add a video that shows what will occur.

Example video: 

Do not forget to press the "Save" button.
 
There are areas we need to edit in the "Settings" section of our page.

It is mandatory to fill in the "privacy policy, app icon, category and business use" sections in this field.

Category is the company's own industry.

There are two radio buttons for business use, “support my own business” should be selected. 
 
After performing this step, “individual verification” should be done lastly. At this step, it will be sufficient to upload one of the documents such as identity photo, driver's license, e-government identity card.

After completing these steps, save. And press the "submit for review" button in the current submission section. (If the button is not active, there is a missing section, go back and complete the steps.)
After all these steps are performed, the app will be ready for review. 

Whichever tenant and queue was integrated into the queue, it is recommended that a customer representative be in hibernation in that tenant and queue. 

It is also necessary to determine how many messages the customer representative can receive at the same time from the advanced settings. (Recommended for testing is 4) Facebook runs various tests during the day.

It can be used in Development mode until it passes the App Review process and is approved. In Development mode, the application is not open to everyone, only Admin, Developer and Tester added from the application can be seen.

There is no clear time to go through the review. Approval comes within an estimated 3 days.
 
After the App Review process is approved, the Facebook page is made public by pulling the application to Live mode.





    • Related Articles

    • Zendesk Widget Integration

      Goals Widget integration for Zendesk users Background and Strategic Fit Plenty of e-commerce companies are using Zendesk for their support processes. Our primary intention is for Zendesk users to adjust the widget settings and to carry out the ...
    • QUEUES- Administrator Guide -

      Call Center Studio - Administrator Guide Queues Queues To access Queues, from the administrator screen, press the button shown below: They are lines in which the automatic call distribution system (ACD) keeps inbound calls to distribute to customer ...
    • Call Center Studio CRM Integrations Technical Guide

      Call Center Studio CRM Integration Document Intro Call Center Studio is a technology company that aims to offer all the call center functions as a ''service'' to businesses that want to offer their customers an enterprise grade call center. Many ...
    • APPLICATIONS- Administrator Guide -

      Call Center Studio - Administrator Guide Applications Applications To access Applications , from the administrator screen, press the button shown below: A special app token is created through Call Center Studio API. Created app tokens can be used in ...
    • Reporting Module Guide

      Call Center Studio - Reporting Guide Reports Reports Functions of Keys in Reports; It is used to apply filtering on behalf of the agent, queue name, start and end times in the report. It is used to export the report in excel format. It is used to ...