search

Adding a chatbot to Messenger


Introducing Facebook Messenger integration

You can deploy the same chatbot, with the same knowledge base, on your website and on Facebook Messenger.

This means you can automate the answering of frequently asked questions, wherever your customers are asking them. All your chat forms and escalations will work on Messenger too.

To set up your bot in Messenger, you'll first need to create a Facebook app, and thenconnect it to your chatbot.

This article describes the steps you need to take, and the information you'll need to provide to the Helpfruit team. It also details some chatbot elements that will appear differently on Messenger.

Prerequisites

Before you get started, you will need:

  • A Meta for Developers account. If you don't have an account, you can create one at developers.facebook.com.
  • A Facebook page from which users will access your bot. If you don't have one yet, Create a new Page.
  • A Premium Helpfruit subscription. Messenger bots are not available on Starter or Standard plans. See pricing.

Create a Facebook app

Users will access your bot from a Facebook Page. To connect the bot, you'll enable Facebook Messenger on the Facebook Page and then connect the bot to the Page.

Create your app

  1. Sign in to your Meta for Developers account.
  2. Go to Create a new Facebook App.
  3. On the Select an app type page, select Business and then Next.
  4. On the Provide basic information page, enter a name for your app and select Create app.
    • If prompted, enter your password and select Submit to create your app.
    • After your app is created, the site goes to a page for your app.
  5. Expand Settings and select  Basic.
    1. Copy and save the App ID and App Secret.
  6. Now under Settings, select Advanced.
    1. In the resulting pane, scroll down to the Security settings, and enable Allow API Access to app settings.
    2. Select Save Changes.

Enable Messenger

  1. Select Dashboard.
  2. In the resulting pane, scroll down to the Messenger tile and select Set Up.
  3. The site adds Messenger settings to your app and displays the settings page.

Add pages and generate tokens

  1. Under Messenger, select Settings.

  2. Scroll down to Access Tokens and select Add or Remove Pages.

    1. When prompted for the identity to associate with Messenger, either continue with your current account or sign in to another. 
    2. When prompted for the Pages you want to use with your app, select the pages and then select Next.
    3. If prompted to submit the request for Login Review, review the information and select Done.
    4. On success, the site displays a success page. Select OK to continue.
  3. The Page you added now appears in the Pages list.

    Copy and save the Page ID for later.

  4. Select Generate token for the Page.

    1. The site displays security information and gives you a chance to copy the token.
    2. Read and acknowledge the warning.
    3. Copy the token and select Done.

You now have your app information and a token for the next step. Leave the Facebook setting steps pending. You'll update them later.

Provide info to Helpfruit team to connect your bot

To configure your Helpfruit chatbot for Messenger, you'll need to provide the following information to the Helpfruit team: 

  1. Your Facebook App ID and Facebook App Secret (from Create your app - step 5, above)
  2. Your Page ID and Access Token

Once we have completed setup for Messenger on your bot, we'll let you know that you can proceed with the next step.

Complete configuration in Facebook

Go back to the Facebook settings to finish up the configuration process.

  1. On the Meta for Developers site, go back to the Messenger settings page for your app.
  2. In the resulting pane, scroll down to the Webhooks section and select Add Callback URL.
  3. On the Edit Callback URL page:
    1. Enter the callback URL and verify token values provided by the Helpfruit team.
    2. Select Verify and save.
  4. The Page you added now appears in the Pages list under Webhooks.
  5. Select Add subscriptions for the Page.
    1. On the Edit page subscriptions page, select the following subscription fields:
      • messages
      • messaging_postbacks
      • messaging_options
      • message_deliveries
    2. Select Save.
  6. The site displays the added subscription fields next to the Page for your bot.

 

Make your app public

Until an app is published, it's in Development Mode. Plugin and API functionality will only work for admins, developers, and testers.

Testing your bot

Only the creator (the Facebook Dev account that created the page and bot) can get a bot response. Normal Facebook users can't see the page or the bot. Give dev or test roles to target users, so they can also chat with the bot.

Users to be added to tester roles must first register on the Meta for Developers site. The tester role is not available to Facebook users that don't have a Meta for Developers account. For more information about app roles and test users, see the Meta for Developers developer documentation.

Submit for review

Facebook requires a Privacy Policy URL and Terms of Service URL on its basic app settings page. The Code of Conduct page contains third party resource links to help create a privacy policy. The Terms of Use page contains sample terms to help create an appropriate Terms of Service document.

After the bot is finished, Facebook has its own review process for apps that are published to Messenger. The bot will be tested to ensure it's compliant with Facebook's Platform Policies.

Make the app public and publish the Page

After the review is successful, in the App Dashboard under App Review, set the app to Public. Ensure that the Facebook Page associated with this bot is published. Status appears in Pages settings.

Set the API version

If you receive a notification from Facebook about deprecation of a certain version of the Graph API:

  1. Go to Meta for Developers.
  2. Go to the app you created for your bot.
  3. Under Settings, select Advanced.
  4. Select Upgrade API version, then switch Upgrade All Calls to version 4.0.

Test the connection by following the steps described below.

Test your bot in Facebook

You can now test whether your bot is connected to Facebook correctly by sending a message via the Facebook Page you associated with your new Facebook app.

  1. Go Facebook and switch to the profile for your page.
  2. Select more actions (), then Add Action Button.
    1. In the Customize your action button dialog, select Try it and follow the instructions.
    2. On the Action Button page under Get people to contact you, select Send Message.
    3. Select Next, complete the dialog and save your changes.
  3. Switch back to your personal profile.
  4. Go to your page, and select Message to test the connection to your bot.

Messenger documentation

For Facebook Messenger documentation for developers, see:

Helpfruit considerations

Some things work a little differently on Messenger. Here are some things to keep in mind.

Length of button text in Messenger

Long button text will be truncated by Messenger. Try to keep your button text (eg buttons in engagements) under 20 characters, incl spaces.

You can create separate engagements for the Messenger channel to accommodate this, using the "Where" setting:

Follow up questions

Follow up questions are displayed differently in Messenger as "Related questions" in carousel format, with the button "Ask"

Video

If you wish to display video in your Messenger bot answers, you need to add a Facebook video link as well as a YouTube link. YouTube videos will not display in Messenger.

Callouts and styling

Callouts and custom styling (colours/CSS) don't display on Messenger.

How to disable your Messenger bot in the Helpfruit portal

You can enable/disable your bot on Messenger, to temporarily prevent your bot sending messages on this channel.

To do this, navigate to the Channel settings tab on Configuration > Main and toggle off the "bot enabled" switch for Facebook. Note this can take up to 15 minutes to take effect.

Segmenting analytics

Helpfruit analytics are segmented by bot source, allowing you to review and analyse conversations on Messenger vs the web channel.

 

 

 

 

 


Helpful?