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 Facebook for Developers 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.
  4. Under 'Subscription Fields', select the webhook events you want delivered to you webhook. At a minimum, we recommend you choose messages and messaging_postbacks to get started.
  5. Click the 'Verify and Save' button.

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. In the 'Token Generation' section of the Messenger settings console, click the 'Select a Page' dropdown and select the Facebook Page you want to subscribe this app to. This is the Page that you want your webhook to receive events for when people on Messenger chat with it.
  2. Copy the token that appears in the 'Page Access Token' field. You will use this token later to make API requests.
  3. In the 'Webhook' section of the Messenger settings console, click the 'Select a Page' dropdown and select the same Facebook Page you generated a Page access token for. This will subscribe your app to receive webhook events for the Page.
  4. Click the 'Subscribe' button next to the dropdown.

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, send a message to your Page from facebook.com or in Messenger. If your webhook receives a webhook event, you have fully set up your app!
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.