fbpx

Adding your Facebook page to RapidPro

This document is intended to guide the process of including, validating and publishing a Facebook channel on RapidPro.

Understanding

To add the bot to Facebook chat it is necessary first to understand the tools involved in establishing communication:

  1. Creating a Facebook Page – Unlike a profile, a page is linked to an establishment, entity, body, or service. This page is where users will have access to chatbot through Facebook Messenger. Posts, comments, posts sharing or markings will not be interpreted by the chatbot.
  2. Creating an App – In the site for Facebook developers should be created an application that will function as a messaging gateway. During development/testing the app gives access to chatbot only to its administrators, to make the app public access it needs to go through an evaluation process and fulfill some Facebook requirements.
  3. Link app with chat – You need to configure app-supplied tokens as well as webhooks with callback URLs.

Step 1 – Creating the page

Note:
Skip to step 2 if you already have a configured page.

Select the Create Page option and follow the steps presented according to the characteristics of your goal. At this point, it is important to provide as much information as possible because Facebook can block your access if it detects that it may be a fake page.

Create Page

Step 2 – Creating the app

Note:
Go to https://developers.facebook.com to create your app

Select the option Add a new application and follow the steps that will appear according to your goal.

Create Page

Give a name and place the email that will be responsible for the app.

Create Page

At this point you may receive a validation request.

On the main management screen of your new app add Messenger by clicking Configure in the Messenger section.

Create Page

Select the Basic option under Settings, fill out the form and save your changes.

Create Page

Now we will generate the token to configure the channel in RapidPro. To do this, select Settings inside the Messenger section and choose the page that will be linked to this app. After selecting the page you will be asked permission of the app to the page, just confirm.

Important
The profile that generates the Token cannot have its permission to the app changed or be removed. Should this occur the Token will become invalid and the app will stop working until the process is run again.

Create Page

After this procedure, an Access Token will be generated, which will be configured in RapidPro.

Create Page

Step 3 – Linking the app to RapidPro to create the channel

With the Page Access Token, open the properties of your Org in RapidPro (click the Org name in the upper right corner of the screen) and then select the add channel option.

Add Channel

Scroll down to the social media channels section and select the Facebook option.

Facebook Channel

On the add channel screen fill in the Access Token (identifier you generated in the app), Page Name (for channel ID in RapidPro), and Page ID (this number can be purchased in the About section of your page).

Note
The user who creates the channel must not have their permission in RapidPro changed nor removed. Should this occur the Token will become invalid and the app will stop working until the process is run again.

Facebook Channel data

This procedure will generate the callback URLs to be configured in the Webhooks section in the app.

Facebook Channel Callback settings

Go back to the App on the Facebook developer site and go to Configure Webhooks within the messenger settings.

Facebook App Webhook option

Fill in the information according to the data generated in the addition of your channel in RapidPro, check the Messages, Messaging_postbacks, Messaging_optins, Message_deliveries and Messanging_referrals options and click Check and Save.

Facebook App Webhook settings

When you complete this procedure, make sure that the parameters have been correctly selected and that the page has been properly entered in the Webhooks.
Facebook App Webhooks

Finishing channel functionality

Now all we need is to configure how the conversation will be interpreted by the chatbot. This is done in RapidPro through a trigger that only appears after adding a Facebook channel successfully. To do this go to the Triggers section in RapidPro and click Create trigger.

RapidPro Trigger

From the available options select the one as shown in the figure below, which will cause a Get Started button to appear on the chat once a new conversation with the page is started and thus allow the user to approve the exchange of messages with the chatbot.

RapidPro Facebook Trigger

Select the Facebook channel you just created in RapidPro, the flow that will be triggered when you the conversation is started, and click Create Trigger.

RapidPro Facebook Trigger Settings

The screen will return to the triggers creation page and display the one you just created.
RapidPro Facebook new conversation trigger

Conclusion

That’s all it takes to add your Facebook page as a channel to RapidPro. Completing the above steps the chat will appear as follows when clicking the button to send message.

Facebook Page chat

And clicking on Get Started chatbot takes over.

Facebook Page chat starts

Note
Perform all bot functionality tests and make any necessary adjustments. Only after everything is OK, start the approval process to make the app public.

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.