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 chatbot builder with the Facebook messenger and let the bot handle all the questions that customers raise through your Facebook page. 

It is important to address your customer queries round the clock and this integration will help you to deploy constant availability. With the efficiency in response and availability of resources, the interaction in your Facebook page might increase resulting in happy customers. It also helps in interacting with a bigger and diverse audience.

Here is how you can integrate your chatbot builder with Facebook messenger
:

 Step 1: Create a New Facebook Page

        You will build your Chatbot on a Facebook Page. Hence, create a Facebook Page first!

  • Log into your Facebook account.

  • Click on the dropdown menu on the top right-hand corner.

  • Click Create Page to create a new page and choose Company, Organisation or Institution.



  • In the dropdown menu, choose the category as Education /Business or any option you prefer.

  • Fill in the Company Name with “<YOUR BOT NAME>" example like TestBot. Then click Get Started and the page is created. 

  • From the URL in the Facebook Page, you can get the page ID "509788676170557" and store it as "fb.page.id" for later usage.

         

  • Create a message button by ‘Learn More’ and then you will get a window option “Add a button to your Page”.

           

  

               

 

          

  • Click the "+" button and choose "send message" which will be displayed in the button.

       

  • Then select the "Messenger" button and choose 'Finish'.

 

     

 

  • Click the option ‘Get in Touch’ and select ‘Send Message’. Then select ‘Turn on Instant Replies’.

  • Hover on the ‘Send Message’ button, and then select ‘Test Button’.

                   

 

Now you will see the Page’s Inbox on the bottom bar. This link contains more information on how the Messenger platform works.

Step 2: Creating a bot in the bot builder

Use the information in this link and create a bot and publish it.

Set the bot hash as "fb.token" for later usage.

Step 3: Create a Facebook Developer Account

We use Facebook Developer as a channel to direct the message from Facebook to our chatbot. Therefore, we need to connect our Facebook Page with Facebook for Developer.

  • Open your web browser and link it to Facebook for a developer. Website: https://developers.facebook.com/

  • Get Started with your Facebook account.

  • Click Create App ID

  • Give your app name which will link our bot with the Facebook page.

 



  • After you create the App ID, fill the necessary details as shown in the page below:

 

  • Then upload the app icon, app name, and necessary details

  • Then select Setting->Basic from the left side of the homepage on the Facebook developer website and enter the privacy policy URL.




  • Save the changes.

  • Log in to your account, select ‘+’ from ‘Products’ button.



  • Choose the ‘Messenger’ set up.



  • Find the ‘Token Generation’ section, select Your Page, and connect to Facebook account again.



  • Get your Page Access Token’ and Keep it as ‘fb.api.key’ for later usage.

 
Step 4: Configure the Facebook page in chatbot builder

  • Log into chatbot builder and click on the ‘Bot Settings’ icon.

  • Under ‘Channels & Integration, choose Messenger.

  • Fill the necessary information.

 

 

  • On the website: https://developers.facebook.com/, from the top right corner, click ‘My Apps’ and choose your app name.

  • On the app page, choose ‘Products’ and select ‘Webhooks’ from the left side.

  • Click ‘subscribe to this object’. 

  • On the page below in the Callback URL fill your URL.

  • Callback URL(<Your_url/api/facebook/chat>) is the production URL like ‘https://api.stagfreshbots.com/api/facebook/chat

  • Then give the verify token which should be a unique string for each client and fill the fb.token value which is your bot_hash.

 

  • Then from the app page choose Messenger→Settings

  • Scroll down, fill in the details and subscribe to your page.



  • Add all these approvals.

  • 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.



  • The Facebook Bot is set and ready.

  • Return to your ‘TestBot’ Facebook page, open the page’s Inbox.

  • Click the button ‘test button.




 

 Note: Here is some information regarding Facebook Developers Document: https://developers.facebook.com/docs/messenger-platform/introduction