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.

  1. 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.

  2. Go to My Apps and click Add a New App.
  3. Insert details for your new application.
  4. Assign new products to your application:
    1. Go to the Add a Product section and select Messenger.
    2. 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.

  5. Assign the Facebook page with Messenger in App Dashboard > Products > Messenger > Settings > Token Generation and then select your page.

    A popup window is opened requesting a permission. Accept it.

  6. Enable the Webhooks service by scrolling down the page to the Webhooks section and clicking Setup Webhooks.
  7. Configure a new page subscription:
    1. Insert a callback URL that points to Sinch Contact Pro.

      You receive this from Sinch but depending on the AWS region in which your service is running, the format is:

      Region URL
      Europe https://login-eu-c1.cc.sinch.com/[tenantname]/sms/facebook/facebook
      North America https://login-na-w2.cc.sinch.com/[tenantname]/sms/facebook/facebook
      Australia https://login-au-s2.cc.sinch.com/[tenantname]/sms/facebook/facebook
      Africa https://login-af-s1.cc.sinch.com/[tenantname]/sms/facebook/facebook
    2. 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.

    3. In the Subscription Fields section, select messages.
    4. 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 .

  8. Add a Send Message button to your Facebook page by opening the page and clicking Add a Button.
  9. Click the Contact you row.
  10. Select Send Message and click Next.
  11. Select Facebook Messenger and click Finish.

Creating Facebook Messenger Service in Sinch Contact Pro

  1. Configure a Facebook messaging service in System Configurator > System Management > Messaging Services:
    1. Click Add New and choose facebook.
    2. In the Basics block, enter:
    3. 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 Facebook Graph API Explorer > Settings > Basic with a prefix app:.

        For example: app:1234567890123

        Note:

        Only one account can have the app: prefix.

        Enter the app secret located in Facebook Graph API Explorer > Settings > Basic.

        Page

        There can be as many pages as needed.

        Enter page ID located in Facebook Graph API Explorer > Products > Messenger > Setting.

        Enter page access token located in Messenger > Setting > Access Tokens.

        Note: If you change your Facebook password, you have to generate a new token in Facebook > Settings > Access Tokens and enter it here as a password.
  2. Create a chat new queue or update an existing one in Queue Management > Queues and as a queue address add [PageID]@facebook.com.

    Depending on the configuration, one queue can handle multiple pages, or there can be one queue per page.