Creating a Facebook Messenger Bot

There are 2 ways to set up a Facebook Messenger bot. The easiest (and default) method is page-only. This will connect a Facebook page to Flow XO's own app. It's highly recommend you follow this route.

For more advanced users, you can set up a bot with an app and a page. This will require more set up steps, and also a manual app review from Facebook.

Set Up Page-Only (recommended)

Getting Your Page

Before you can set up your bot in Flow XO, you'll need a Facebook Page. If you don't already have one, you should create one. The page profile pic and name will be used to form the 'identity' of your bot and is what people will see when they engage it.

Creating a Bot in Flow XO

When you have a Facebook Page, follow these steps:

  1. In Flow XO, click Bots in the top menu bar, then choose New Bot.
  2. Now choose Messenger as the platform.
  3. Type in a descriptive name for the bot.
  4. If you like, you can fill out the Welcome Text box. This is optional.
  5. Click the Facebook button. This will allow us to fetch the list of pages associated with your Facebook profile, and also give us the necessary permissions to run your bot once you've selected a page.
  6. A list of Facebook Pages should now show up. Choose the page that you want your bot to identify as.
  7. Finally, click Next and your bot should now be connected and working.

Set Up Using App & Page (advanced)

Getting Your App & Page

Before you can set up your app & page bot in Flow XO, you'll need a Facebook App and a Page. If you don't have either of those, follow the links and set them up. The page profile pic and name will be used to form the 'identity' of your bot and is what people will see when they engage it.

Creating a Bot in Flow XO

When you have a Facebook App and Page, follow these steps:

  1. In Flow XO, click Bots in the top menu bar, then choose New Bot.
  2. Now choose Messenger as the platform.
  3. Type in a descriptive name for the bot.
  4. If you like, you can fill out the Welcome Text box. This is optional.
  5. Tick the option to Use own app (advanced).
  6. Next you'll need to copy and paste in your Facebook App ID & Facebook App Secret. Sign in to Facebook Developers to get these. Go to the dashboard of your app and you'll see the ID and secret:
  7. Click the Facebook button. This will only fetch the list of pages associated with your Facebook profile.
  8. A list of Facebook Pages should now show up. Choose the page that you want your bot to identify as.
  9. Now head back to Facebook Developers, and find your app. Under Products, click Add Product, and finally select Messenger.
  10. Under Products, click the Messenger product you just added.
  11. In the Token Generation section, choose the Facebook Page you selected in Flow XO:
  12. Copy the token that is generated into the Facebook Page Access Token field in Flow XO.
  13. Finally, click Next and your bot should now be connected and working.

App Review

Note that app review is only applicable to bots set up with an app & page. If you connect your bot with the page-only option, then you won't need to go through a review process.

Currently, Facebook require that all apps go through a (free) manual review process.

Once you've set up the bot, you'll be given a link so that you can connect with your bot. Until your app is approved by Facebook, only you (as the app owner) can see it and use it.

As soon as you're happy with how your bot behaves, you should follow Facebook's App Review guide to submit your app for approval.

Testing

You can test your bot either by using the shortlink, or by finding your own page and clicking the Message button.

Distributing Your Bot

Facebook currently offer these options:

  • If your app is public, you can be discovered through search in Messenger.
  • You can create a shortlink with the format http://m.me/<PAGE_USERNAME>
  • Use the Message Us plugin to add a button to your site.

Get Started Button & Referral Links

When the user connects to the bot for the first time (they click the 'Get Started' button in Messenger), the message 'start' will be sent to the bot. You can look for the presence of this to know that the user clicked 'Get Started' and welcome the user for the first time.

If a referral parameter has been used (i.e. a link in the format http://m.me/mybot?ref=myparam) or the Send-to-Messenger Plugin, the value of ref will be sent in a data output field called Metadata along with the message 'start'.

Handling Likes

If a user 'likes' your bot, your bot will receive the message '/like'. You can create a flow to handle this as a word/phrase.

Persistent Menu

You can set up a persistent menu in the settings for your Messenger bot. This menu will be shown when the user first installs your bot, after a period of inactivity, or when the user accesses it through the menu button.

To add a menu item, edit your bot, and click Persistent Menu > Add. In the left box, type the name for the menu item (what the user sees). On the right, type the keyword that will be triggered when the user clicks that option.

You can click Add again to add more menu items. Of course, make sure you save your bot when you're finished.

Still need help? Contact Us Contact Us