Facebook Messenger API
Facebook Messenger API uses OAuth 2. You should sign up for an application on Facebook first and get an OAuth client ID and client secret.
Note: The process of having your app approved by Facebook may be lengthy (~5 days).
Setting up your Partner App
Log into your Facebook account.
Create a Facebook Developer account if you don’t already have one: https://developers.facebook.com
My Apps: https://developers.facebook.com/apps
Create App, and select Business as the app type.
Complete the following sections:
App Display Name This is the name your users will see when they grant consent to access their data.
App Purpose (set to
Create App(You will then be asked to enter your password).
You should be faced with a screen entitled Add Products to Your App. Under Facebook Messenger, select
This should now be added. In the menu on the left, select
Under Valid OAuth Redirect URIs enter
https://Your Service Domain/connector/callback
(Your service domain can be found in your Cyclr console under Settings > General Settings > Service Domain.) and click
In the menu on the left, select
Settings. Scroll down to the
Access Tokenssection , and select
Add or Remove Pages.
Complete the required steps, adding the Facebook page you wish to use.
Under Settings, Basic on the left menu, you'll be able to complete any missing sections, and copy your App ID and App Secret. Once your app has been approved by Facebook, you'll be able to use these to authenticate your App in Cyclr.
Authenticating your Facebook Cyclr Connector
Go to your Cyclr Console > Connectors > Application Connector Library > Facebook Messenger API > Setup
Client ID: The App ID of your Facebook app.
Client Secret: The App Secret of your Facebook app.
Scopes: This is a comma separated list of scopes to request from Facebook during authentication. For detail on the scopes please visit the official documentation.
Verify Token: This is used for Webhook validation. For more details please see the Webhook section below.
Your Facebook Messenger API connector is now set up!
Facebook Messenger webhooks utilize a single webhook URL, so you need to configure your Facebook application:
In your Cyclr console, go to Connectors > Application Connector Library > Facebook Messenger > Setup
Set the Verify Token to an alphanumeric string of your choice. Make a note of the string.
Copy the Webhook URL to your clipboard.
Navigate to the Facebook Developers App Dashboard, and select the application you use with Cyclr.
Within the application, navigate to Products > Messenger > Settings.
Scroll down to the Webhook section.
Select the Edit Callback URL button to open a dialog.
Paste the Webhook URL from your clipboard, and enter the Verify Token you noted down in step 2.
Select Verify and Save, so Facebook verifies the endpoint.
Drag the Webhook step from the sidebar into the Builder.
Open the Webhook settings, and enter the Page ID.
Connect the Webhook to another step.
Select Run to start the Cycle. The step contacts Facebook and subscribes the page to message Webhooks.
If you want to remove the Webhook and cancel the Page subscription, stop the Cycle, and Delete the Webhook step. The deletion of the Webhook step triggers Cyclr to contact Facebook and unsubscribe the Page from message Webhooks.
Webhook field configuration
The body of the incoming message varies depending on the message type received, so only a set of core fields are mapped by default. Use the Edit Connector page to add the fields you want to use. For more information, see the Facebook documentation on message events.
Add new Facebook pages
To use a new Facebook page with an authenticated connector, you need to reauthenticate with Facebook. During the OAuth flow, use the Edit Settings button to select the new page, and grant the permissions.
Roles and test users
If your application isn't approved by Facebook, you need to set the users that can interact with the application from the developer console. To create a test user, select the menu on the left side of the screen, and select Roles > Test Users.