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 My Apps in the upper right corner:
Choose 'Add New App':
Then, give your app a name and provide your email address:
Once you've created your app, you'll land on your app's Dashboard. Choose 'Get Started with the Pages API' then click 'Submit':
At this point, you’ll need to fill in information about your bot, such as Business Use, Category, and an App Icon:
Next, click 'Dashboard' on the left-hand side. Once there, scroll down to the 'Add a Product' section and click 'Set Up' for the Messenger tile:
Scroll down to the 'Token Generation' section, select your page, follow the prompted directions, and your Page Access Token will be automatically generated:
Once you’ve received your Access Token, navigate to your Nyaruka account in a separate tab and claim a Facebook channel. First, go to your account page, and click on the gear icon and choose 'Add Channel':
Scroll down until you see the option to add a Facebook bot:
Enter your Page Access Token, Page Name, and Page ID to receive your callback URL:
Note that you can find your Page ID within your page's 'About' section:
Back in your Facebook Developer page, within the 'Webhooks' section, click ‘Setup Webhooks’:
Next, enter your Webhook or Callback URL and Verify Token (found in your Nyaruka account) and check all boxes to subscribe to all incoming Facebook events:
Webhook URL and Verify Token are found in your Nyaruka account:
Enter the Webhook or Callback URL and the Verify Token into the fields of the New Page Subscription pop up on your Facebook Developer page and check any of the Subscription Fields you wish to use:
- ‘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.
After submitting, scroll back down to the 'Webhooks' section, and select the page whose events you'd like the webhook to subscribe to and click 'Submit':
Prior to submission, navigate to your 'Dashboard' and click 'View Details' for your app:
In the upper right-hand corner toggle your app to from 'Off' to 'On':
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.
Click on 'App Review' and click on 'Current Request'. Scroll down to the ‘Requested Permissions and Features’ section in your Facebook Developer Platform and fill out the requested information.
Finally, click 'Submit for Review' to complete the submission process.
While creating and submitting your bot may be challenging, the process can be completed successfully. For more information about how to submit your bot for review, take a look at Facebook's help docs.
Editing your Bot
Note that if you edit your bot, you will need to update your Webhooks subscriptions in your account.
First, re-enter the 'Webhooks' section within your Facebook Developer's page.
Next, Choose the component you need to update:
Click on 'Edit Subscriptions':
Next, enter the 'Verify Token':
The 'Verify Token' is found back in your TextIt account. Go to your Facebook page's channel and click 'Settings':
Here you will find the Token:
- 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).