Direct Facebook Messenger Integration
This procedure is for a direct integration with Facebook Messenger. We recommend using the integration via Conversation API.
You can receive customer messages via your Facebook page when you have an application with Messenger connected to the Facebook page.
Integration Overview
The integration utilizes three different components: SMS Server, Facebook Messenger, and the Facebook Webhook service, configured with the Facebook application. The purpose of the Webhook service is to monitor Facebook Messenger page. If a new chat is initialized, the Webhook delivers the message to a preconfigured destination. In this case the destination is the SMS Server that takes care of incoming and outgoing chat messages.
Configuring Facebook Messenger
The configuration may change so you should check the latest instructions from Facebook.
- If you already have a developer account, open https://developers.facebook.com
and log in.
Otherwise create or promote an existing Facebook account by clicking the Log In button. For more information, see https://developers.facebook.com/docs/messenger-platform/guides/setup.
- Go to My Apps and click Add a New App.
- Insert details for your new application.
- Assign new products to your application:
- Go to the Add a Product section and select Messenger.
- Click Set Up.
A new application with the Messenger is created. Now you connect this application to a Facebook page. If you don't have one, create it at https://www.facebook.com/pages/create.
- Assign the Facebook page with Messenger in
A popup window is opened requesting a permission. Accept it.
and then select your page. - Enable the Webhooks service by scrolling down the page to the Webhooks section and clicking Setup Webhooks.
- Configure a new page subscription:
- Insert a callback URL that points to Sinch Contact Pro
SMS Server .
This is of format http[s]://[smsserverlocalhttpserverip]:[port]/sms/facebook/facebook.
It should be via proxy or directly pointing to SMS Server in
. - Add a random string, for example 12345678, to the Verify
Token field.
A verify token is required although it's not used by Sinch Contact Pro.
- In the Subscription Fields section, select messages.
- Click Verify and Save.
If everyting works, you'll see Webhooks icon turning to green on the left pane. An error message is displayed if Facebook fails to connect to the SMS Server. For more information, see Troubleshooting and Tips.
- Insert a callback URL that points to Sinch Contact Pro
SMS Server .
- Add a Send Message button to your Facebook page by opening the page and clicking Add a Button.
- Click the Contact you row.
- Select Send Message and click Next.
- Select Facebook Messenger and click Finish.
Creating Facebook Messenger Service in Sinch Contact Pro
- Define the following SMS Server variables in
Infrastructure Administrator (IA):
-
Local HTTP Server Address
-
Local HTTP Port
-
Local HTTP Certificate (optional)
If HTTPS is not used then certificates are not necessary. But if you use HTTPS, the certificate name should be same as the server address (IP address or domain name).
-
HTTP Proxy Policy:
Named: Give the HTTP proxy address in the HTTP Proxy Name field
Automatic: The proxy setting will be taken from the Internet options of the HAC user
Default Proxy: Retrieves the static proxy or direct configuration from the registry. This option is deprecated in OS win 8.1 and newer.
No Proxy: No proxy is used.
-
HTTP Proxy Name:
The address of the proxy server if the value Named is selected for HTTP Proxy Policy
-
- Define the SMS Server to run in HTTP mode in
- In the SMS Interface block, choose the option HTTP for the Session Object field.
- Reset SMS Server.
: -
Configure a Facebook messaging service in:
- Click Add New and choose facebook.
- In the Basics block, enter:
- a descriptive name for the messaging service
- https://graph.facebook.com/v10.0/me/messages as a service connection.Note: The API version in the URL can change. You should use the latest version.
- In the Authentications block, enter:
- Facebook app ID and secret
The system will work without the configuration of app ID and secret but then there is no security check. Therefore, for security reasons, we recommend that you configure them.
- One or more entries of page ID and page access token
Table 1. Facebook Configuration Item Authentication ID Password App
There can be only one app in Sinch Contact Pro .
Enter app ID located in app:.
with a prefixFor example: app:1234567890123
Note:Only one account can have the app: prefix.
Enter the app secret located in
.Page
There can be as many pages as needed.
Enter page ID located in
.Enter page access token located in
.Note: If you change your Facebook password, you have to generate a new token in and enter it here as a password.
- Facebook app ID and secret
- Create a chat new queue or update an existing one in [PageID]@facebook.com.
Depending on the configuration, one queue can handle multiple pages, or there can be one queue per page.
and as a queue address add