Skip to main content
Skip table of contents

Facebook Messenger

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.

The process of having your app approved by Facebook may take around 5 business days.

Setting up your Partner App

  1. Log into your Facebook account.

  2. Create a Facebook Developer account if you don’t already have one: https://developers.facebook.com

  3. Go to My Apps: https://developers.facebook.com/apps

  4. Click 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 Clients.)

  5. Click Create App (You will then be asked to enter your password).

  6. You should be faced with a screen entitled Add Products to Your App. Under Facebook Messenger, select Set Up.

  7. This should now be added. In the menu on the left, select Facebook Login > Settings.

  8. 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 Save Changes.

  9. In the menu on the left, select Facebook Messenger > Settings. Scroll down to the Access Tokens section , and select Add or Remove Pages.

  10. Complete the required steps, adding the Facebook page you wish to use.

  11. 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!

Webhook setup

Facebook Messenger webhooks utilize a single webhook URL, so you need to configure your Facebook application:

  1. In your Cyclr console, go to Connectors > Application Connector Library > Facebook Messenger > Setup

  2. Set the Verify Token to an alphanumeric string of your choice. Make a note of the string.

  3. Copy the Webhook URL to your clipboard.

  4. Navigate to the Facebook Developers App Dashboard, and select the application you use with Cyclr.

  5. Within the application, navigate to Products > Messenger > Settings.

  6. Scroll down to the Webhook section.

  7. Select the Edit Callback URL button to open a dialog.

  8. Paste the Webhook URL from your clipboard, and enter the Verify Token you noted down in step 2.

  9. Select Verify and Save, so Facebook verifies the endpoint.

Use webhooks

  1. Drag the Webhook step from the sidebar into the Builder.

  2. Open the Webhook settings, and enter the Page ID.

  3. Connect the Webhook to another step.

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

Official Facebook Documentation

https://developers.facebook.com/docs/apps/register

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.