Facebook Messenger is one of the popular social media channels to interact with your customers and boost your market. A conversational interface coupled with artificial intelligence, crushes a business’s conversion obstacles and enables instant customer service. You can integrate your bots with Facebook Messenger and let the bot handle all the questions that customers raise through your Facebook page. This solution article will walk you through how you can integrate Facebook Messenger with your Freddy Self-service bot.


Facebook will place restrictions on using the Messenger API from December 16th, 2020, to comply with Europe’s privacy guidelines. These changes will also impact the way Facebook DMs are handled within Freddy AI. Click here to learn how.



TABLE OF CONTENTS


Prerequisites


Step 1: Create a new Facebook page with a button to enable customers to get in touch with you. You can skip this step if you already have set it up.

  • Log into your Facebook account > Click on the dropdown menu > Create Page > pick your category.
  • On your page, click on Learn More > Add a button to your page  > Get in touch > +Add a button > Send Message > Messenger > Finish.
  • Click Get in Touch > Send Message > Turn on Instant Replies.


Step 2: Follow the instructions from our solution articles to create and publish a bot with Freddy Self-service. Facebook does not support dropdowns.


Step 3: Go to the Facebook Developer Portal > Add a New App or select the app to which you want to integrate the bot > Products > Messenger. Once you've finished setting up Messenger for your app, it'll appear on the sidebar when you visit your app.


Setting up the Messenger App

  • You can customize the app by clicking on Settings > Basic. Make sure that you
    1. Add links to your Privacy Policy and Terms of Service,
    2. Upload your logo,
    3. Specify your category of business,
    4. Choose the Business Use


  • Click on the sidebar on your Facebook account > Messenger > Settings > Access Tokens > Add or Remove Pages, and follow the onscreen instructions to add your page. Once you've added the page, you will be able to see your page ID (1), and you can click on Generate Token > Copy to get the API token (2).


Integrating your bot with Facebook Messenger

  • Login to your Freddy Self-service account as an Owner / Admin > Bot Settings > Channels & Integrations > Messenger > and either create or edit an existing integration. On this page,
    1. Select the bot that you want to integrate with FB Messenger
    2. Fill in the FB messenger token

      To get the messenger token, open the respective bot > Generate Script from the sidebar > Generate Script button > you'll find the bot hash as part of the script where it is a string of characters that follows the "data-bot-hash".


    3. Fill in the API token from the previous step
    4. Fill in the page ID from the previous step
    5. Fill in your Messenger URL (usually, it is m.me/pageid)


  • Open your Facebook Developer account > Scroll down to the Webhooks section > Enter the callback URL based on the data center your Freddy Self-service account is in.

    India DC: https://api.in-freshbots.ai/api/facebook/chat

    Europe DC: https://api.euc-freshbots.ai/api/facebook/chat
    US DC: https://api.freshbots.ai/api/facebook/chat
    Australia DC: https://api.au-freshbots.ai/api/facebook/chat


  • Facebook will ask you for a verification token. The verification token is the same as the FB messenger token that you configured earlier.

  • Once this is done, click on the Add Subscription button and subscribe to messages, message_postbacks, and message_options.

  • Add all the necessary approvals, and submit the app for review. Facebook will verify this app after a verification process. Ensure not to make the bot public while creating and testing the bot because Facebook needs to approve the page, and that will take some time. Include the right details about the bot behavior so that the verification process is smooth. Once the app is verified, it will be available on the public page.

  • Once you've filled up all the fields, you can click the Save button to launch the bot. You can test it by opening Facebook Messenger and sending a message to the page. You can also visit your Facebook page > Edit Send Message > Test Button to have a preview of how your customers would see your page.


Note: You can refer to this page for more documentation of Facebook Developers: https://developers.facebook.com/docs/messenger-platform/introduction


Please write to freshbots-support@freshworks.com if you have any more questions, we'll be happy to help you.