Facebook requires each new Bot to be submitted for review. Before beginning this process, login to your Nyaruka account and build your Bot. This is an important step, as Facebook recommends submitting a video depicting an interaction with your Bot.
Login to your Nyaruka account to use the following links to access specific pages in your account.
For this integration, you’ll need:
- a Facebook App: Your Facebook App will contain your Bot’s Messenger settings. This is where you'll setup your Webhook, retrieve your page access token and submit your app for approval.
- a Facebook Page: A Facebook Page will be act as your Bot’s identity. When people chat with your Bot, they’ll see the Page’s name and profile pic.
- a WebHook URL: Facebook uses secure callbacks to send messaging events to your account with us.
Creating your Bot
First, create an account on Facebook's Developer Platform. If you've never created an app before, click Get Started in the upper right corner:
Then, give your app a name and provide your email address:
If you already have a developer account and you'd like to create a new app, simply log in and click the My Apps menu in the top righthand corner to select Add New App.
Name your new app and provide your email address:
Once you've created your app, scroll down to the Add a Product section within your account and click the 'Set Up' button for Messenger:
Once you’ve received your Page Access Token, navigate to your Nyaruka account in a separate tab and claim a Facebook channel. Enter your Page Access Token to receive your callback URL.
Note that you can find your Page ID by entering the page on your Facebook account, and then navigating to the 'About' section. Here, you will find the ID under the 'More Info' section.
Back in your Facebook Developer Platform, within the 'Webhooks' section, click ‘Setup Webhooks’:
Next, enter your Callback URL and Verify Token (found in your Nyaruka account) and check all boxes to subscribe to all incoming Facebook events:
- ‘messaging_optins’ subscribes your app to authentication callbacks via the Send-to-Messenger Plugin.
- ‘messages’ allows your app receive text messages or messages with attachments (image, video, audio).
- ‘message_deliveries’ subscribes your app to message delivery receipts.
- ‘messaging_postbacks’ subscribes to post back callbacks, in case your app incorporates buttons.
Within the same 'Webhooks' section, select the page whose events you'd like the webhook to subscribe to:
Next, navigate to the ‘Settings’ tab on the lefthand side of your Facebook Developer Platform page. Click 'Basic', then scroll down to click ‘Add Platform’:
There, you can add the URL of your website as your platform. Once added, click 'Save Changes' to finish this step.
Prior to submission, navigate to the ‘App Details’ tab and click 'Finish Setup':
Submitting your Bot
Now you’re ready to submit your app. Note that each new Messenger Bot is subject to an internal review process; use the information in this link to ensure your content is acceptable per Facebook's approval criteria.
Scroll down to the ‘App Review for Messenger’ section in your Facebook Developer Platform page and click ‘Add to Submission’ for each of the items you'd like to add. In the example below, we've added ‘pages_messaging’ from the list:
Once you've selected the 'items' you'd like to add, click the 'edit' links next to them to fill out their corresponding forms:
Finally, click 'Submit for Review' to complete the submission process.
- The Messenger Platform is intended for customer-initiated interactions. As such, Facebook Messenger doesn't allow you to reach Facebook contacts without them contacting you first. Your contacts can reach you via your Page, or search for your Bot via the Messenger app.
- Facebook uses unique contact IDs per page, so you won't be able to access contacts you talked to previously on a Facebook page with a new page. For this reason, we recommend assigning one Facebook page to each Messenger app (Facebook channel) connected to your Nyaruka account.
- Until your app is approved by Facebook, only admins will be allowed to message your app (even if you've made it 'public' prior to approval).