retailCRM Documentation

Integration with Facebook Messenger

Before activating the module in the “Integration” section, you should create an API key which will be used to send messages. The key is available in the section Administration > Integration > API Access Keys.

Enable all methods of the “Integration” section for the key.

Integration is made by means of application created in Facebook for Developers. First of all, you should sign in to your personal account on page https://developers.facebook.com and add a new application to “My apps” menu.

After creating the application, you find yourself in the “Products” section where it is necessary to add a new product “Messenger” by clicking the “Set up” button on the plate with the product. The integration will work due to it.

Let's proceed to setting up the application. When all things are set up, Facebook verifies and moderates your application that is why it is recommended to have a look at Facebook`s helpful resources prior to setting up. Here are the links:

Quick Start Tutorial
Complete Documentation
Documentation for Developers
Messenger Platform Developers Community

Now it is time to speak about “Token generation” section. This token will link your Facebook page to a chat in your system. For token generation you should select a page to which this token will be bound. It is possible either to use already created page just selecting it from the list or to create the new one.

After selecting the page in “Page Access Token” field, a key will be generated; the key is to be specified in the settings of the integration module. Open the section Administration > Integration, click on the “Facebook Messenger” module and on the “Connect” button.

Then on the module`s page (“CRM settings”) should be specified the full URL of your system and the API key created earlier. A new tab “Bots” will appear after saving, in which you should specify the bot name and the token you received at the token generation stage. Click on the button “Add a bot”.

Options “en/ru” are for specifying the language of system notifications within this widget in retailCRM Chat.

If the bot is added, the following data is displayed:

The appeared webhook and token are to be specified in the Facebook application. This is done by clicking the icon in the “Webhook” column to copy the connection key of the webhook.

Return to the page “Facebook for developers” and click on the button “Setup Webhooks”.

Paste the webhook you have copied into the field “Callback URL” of a pop-up window. Return to the settings of the integration module and copy the token. Paste the token into the field “Verify Token” in “Facebook for Developers”.

Also, check the following parameters in the “Subscription Fields” block:

Verify and save changes.

After saving, the page will be reloaded automatically and additional fields for settings will appear. We should subscribe the created application to the public page.

For this, select the page created earlier in the “Webhooks” block and click the “Subscribe” button.

It's done! We have set up the Facebook application and the integration module: they are interconnected now. What is left to specify in the application is what it will do - in our case it is sending and receiving messages using a Facebook page. Enable “pages_messaging” parameter in the block “App Review for Messenger” for this.

Specify additional information which will be required for moderation.

Before submitting for review, complete the details listed by “Facebook for Developers”.

We recommend to specify all data about your company and the application also.

After submitting, you will receive a message from moderator to confirm the information. Moderators will also send a request for supporting documentation on your company's existence. All messages from moderators will be sent to your E-mail address and uploaded to “Messages” section.

After successful moderation you should publish your application by means of option button at the top of the “Facebook for Developers” page.

Settings for binding are made. Now when receiving messages at the subscribed page, the messages will be uploaded to your system automatically.

In order to find your page and start messaging, it is possible to use a unique link to the messenger in the “About“ section of the page.

More details about working with chats you can read in the article “Chats”.


PrintEditHistory
Page last modified on May 27, 2019, at 12:25 PM