This article covers all necessary steps to setup automation for your Facebook Messenger if you have your Facebook page up and running already. If you don't, please refer to this Facebook article, How do I create a Facebook page, to setup a Facebook page first.
Here are the steps to follow to setup Facebook Messenger automation:
- Create a Facebook app
- Create Test App
- Add Messenger as a product to the app
- Configure Messenger
- Enter Integration Parameters and Turn on Automation Engine in ultimate.ai
- Back to Facebook to Configure Webhooks and Add Subscriptions
- Test integration
- Set up the main Facebook app
- Prepare to Submit for App Review
- Submitting for Review
- Launch the Bot
|❗ If this is your first time creating a Facebook App, please have a look at Step9: Prepare to Submit for App Review first to understand all the materials requested by Facebook.|
Step 1: Create a Facebook App
First, create an app in Facebook. This is the main Facebook app, as opposed to the Test App, and it will be the final app to use when we launch the bot.
- Log in to https://developers.facebook.com/.
- If it says Get Started in the top right corner, that means you need to register aa a developer first. Here's Facebook's guide on How to register as a Facebook Developer.
- Select Manage Business Integrations, click Continue.
- Go to My Apps and click Create App.
- Enter the App Display Name for your app and Contact Email.
- If applicable, select App Purpose and Business Manager Account.
- Click Create App.
- This will be your main facebook app.
Step 2: Create Test App
Now that you have the main facebook app, we need to create a test app version of it as well. The test app is to test the integration before going live with the bot. It can be deleted once the bot is live.
- In the left panel, click the drop-down menu in the top left corner and click Create Test App.
Step 3: Add Messenger as a product
We will first set everything up for the Test App, then once all goes well, step 3-6 will need to be repeated for the actual app.
In the left panel click the + sign next to Products
Look for Messenger on the right then click Set up
Messenger should now appear under Products in the left panel
Step 4: Configure Messenger
In the left panel, go to Messenger > Settings
In the right panel, scroll down to Access Token
Click Add or Remove Pages and add your Facebook page
- Choose the Facebook page and click Generate Token. Copy the Page Token for the next step.
- Leave this page open as we will come back here.
Step 5: Enter Integration Parameters and turn on Automation Engine in ultimate.ai
- In a separate tab, login to your ultimate.ai's Dashboard.
- Go to Settings > Chat Platforms
- Add Integration > Facebook
- Click Integration Parameters and a drawer will pop out from the right. Enter the Page ID and Page Token. They can be found in the Facebook settings page that you were on in Step 4. *In the drawer you wold also see Escalation App ID. This is only needed if you already have an existing Facebook App connected to a third party CRM platform. e.g. salesforce, Clarabridge, etc.
By adding this Escalation App ID, the bot will redirect the conversation to the human agents once an escalation is requested.
- Turn on Automation Engine under Connection Status.
6. Copy your Bot ID for the next step.
|❗ Your bot ID is the string of numbers and letters in the URL. For example: https://dashboard.ultimate.ai/bot/BOT-ID/platform-settings|
Step 6: Back to Facebook to Configure Webhooks and Add Subscriptions
- Go to Webhooks section below Below Access Tokens
- Add Callback URL and Verify Token
- Callback URL: https://chat.ultimate.ai/api/facebook
- Verify Token: Your Bot ID that was copied in the previous step
- Click Verify and Save
- Once saved, click Add Subscriptions
- Select messages and messaging_postbacks
- Click Save.
Step 7: Test Integration
Only Page admins or testers can test this.
|❗ Want to add admins and testers? Read this article to find out more.|
- Go to your Facebook page and in the left menu bar Settings > Messaging
- Go to Your Messenger URL, click Copy Link
- Open the link in another tab, and you'll see a Facebook Messenger window (See below for example).
- Start chatting. If the bot is connected successfully it should respond to you.
|✅ Congrats! Now that you've tested the test app and the bot is working. We just need to do the same for the main Facebook app.|
Step 8: Setup the main Facebook app
- First, remove the test app.
- Select the test app in the top left dropdown menu. Then Settings > Advanced, Click Remove App.
2. Go to your ultimate.ai's Dashboard and turn off Automation Engine.
Step 9: Prepare to Submit for App Review
There are a few things to do here to prepare your main Facebook App for review:
- Read the Facebook Before You Submit guide.
- Prepare screen recordings - this will act as a guide for Facebook to test your App.
- Confirm the materials below are complete in the Settings > Basic tab in Facebook.
Make sure your App Icon does not include any of our trademarks or logos.
This is the URL that Facebook present to app users in the Facebook Login interface so they can decide whether or not to grant your app any permissions it is requesting.
Set this to Support my own business if your app is only available to people who have a role on your app, or a role in a Business that has claimed your app. Otherwise set it to Provide services to other businesses.
Make sure to select a category that accurately describes your app.
Make sure you have access to the email account displayed here. Email notifications pertaining to your App Review submission will be sent to this address.
Step 10: Submitting for Review
As Facebook has specific steps to follow, please refer to their article on submitting app for review.
Note that once you accept the terms and submit, your submission will be queued and you should receive a decision within a week.
Step 11: Launch the Bot
Once Facebook informs you their acceptance of the app, follow the steps in Step 7 Test Integration to see if you bot is chatting.
If your app was rejected, please follow their instruction and provide information as instructed by them.