Setting Up Your Facebook App

When your Facebook app is in Development Mode, plugin and API functionality will only work for admins, developers and testers of the app. After your app is approved and public, it will work for the general public.

A Facebook app is what links your Facebook Page to your webhook, and is where you will configure various settings for your Messenger bot, generate access tokens, and choose what events are sent to your webhook.

In this guide, you will learn how to set up your Facebook app so that you can start building on the Messenger Platform.

Requirements

Before you begin, you will need to create a few things. Please ensure you have all of the following:

  • Facebook Page: A Facebook Page will be used as the identity of your bot. When people chat with your app, they will see the Page name and the Page profile picture. To create a new Page, visit https://www.facebook.com/pages/create

  • Facebook Developer Account: Your developer account is required to create new apps, which are the core of any Facebook integration. You can create a new developer account by going to the Facebook Developers website and clicking the 'Get Started' button.

  • Facebook App: The Facebook app contains the settings for your Messenger bot, including access tokens. To create a new app, visit your app dashboard.

  • Webhook URL: Actions that take place in conversations with your bot, such as new messages are sent as events to your webhook. For more information on setting up your webhook, see Set Up Your Webhook.

Setup Steps

Before you begin, make sure you have completed all of the requirements listed above.

1
Add the Messenger Platform to your Facebook app
  1. In the sidebar of your app settings under 'PRODUCTS', click '+ Add Product'.
  2. Hover over 'Messenger' to display options.
  3. Click the 'Set Up' button.

The Messenger Platform will be added to your app, and the Messenger settings console will be displayed.
2
Configure the webhook for your app
  1. In the 'Webhooks' section of the Messenger settings console, click the 'Setup Webhooks' button.
  2. In the 'Callback URL' field, enter the public URL for your webhook.
  3. In the 'Verify Token' field, enter the verify token for your webhook. See Step 4 of Webhook Setup for further reference into what a verify token is
  4. Click 'Verify and Save' to confirm you callback URL

The Messenger Platform will send a GET request to your webhook with the verify token you provided. If your webhook is valid and properly set up to respond to the verification request, your webhook settings will be saved.
3
Subscribe your app to a Facebook Page
  1. Click 'Add or Remove Pages' and select the pages you want to subscribe your app to. Your webhook will receive events for each selected page when people chat with it through Messenger.
  2. In the 'Access Tokens' section there will be a Generate Token button for each authorized Page. Make sure to save the access token, it's needed to send messages using the Send API.
  3. For each authorized Page, the 'Webhooks' section will contain the fields the app can subscribe to. Click on "Add Subscriptions" to select desired fields. At a minimum, we recommend you choose messages and messaging_postbacks to get started.

The Messenger Platform will now be able to send the webhook events you subscribed to for the selected Page to your webhook.
4
Test your app subscription
To test that your app set up was successful, go to Messenger and send a message to your Page. If your callback URL receives a webhook event, you have fully set up your app for receiving messages!
5
Build something awesome!

Learn how to build a simple Messenger bot with our Quick Start Tutorial, or check out the rest of the docs to see all the things you can do with the Messenger Platform.