How To Get The Most Out Of Your Facebook — Add A Chatbot
Keeping up with social media and keeping your online community engaged can be a time-consuming task. Through Bot Libre you can now automate your Facebook presence with your own Facebook Messenger bot. Any Bot Libre bot can be connected to a Facebook Messenger page account. The bot will reply to your users’ questions in real-time using the responses of the script you have trained your bot with.
Connecting a bot to Facebook is a bit of a process, as Facebook requires a lot of permissions and validation to be set up to allow a bot on their platform. This “how-to” gives you a step-by-step process to connect your bot to Facebook Messenger.
You can also watch this video on How to create a chatbot for Facebook Messenger over here.
Step 1: Create A Facebook Page For Your Bot
You must then select a category for your page. Choose a category that will make sense for your bot.
Fill out the details for your page to finish creating it.
Step 2: Create A Facebook App For Your Bot
Go to http://developers.facebook.com and click on ‘Get Started’.
Click the ‘Next’ button to continue.
Now click on the ‘Create First App’ button.
Next, enter a Display Name and then click the ‘Create App ID’ button.
On the following screen, click ‘Settings’ in the left toolbar then select ‘Basic’.
Enter “https://www.botlibre.com” into the ‘App Domains’ field. Note your App ID and App Secret, you will need these in following steps.
Scroll to the bottom of this screen and click the ‘+ Add Platform’ button.
Select ‘Website’ from the following popup window.
Just two more steps to go and you’ve added a bot to your website!
Enter “https://www.botlibre.com” into the ‘Site URL’ field.
Click the ‘Save Changes’ button.
Next, click on ‘Facebook Login’ in the left toolbar, then select ‘Settings.’
Enter “https://www.botlibre.com/facebook” into the ‘Valid OAuth Redirect URIs’ field then click the ‘Save Changes’ button.
Step 3 — Create a bot
Next, you will need to create a bot to connect with your Facebook Page and App. You can follow the instructions here to create your bot: How to create your own chat bot in 10 clicks
Step 4 — Connect bot with Facebook
From the Bot Libre website, browse to your bot. Go to the Admin Console by clicking on the gear icon at the bottom.
From the Admin Console, click on “Facebook” to take you to a screen to configure your Facebook settings.
Enter the ‘App ID” and “App Secret’ from your Facebook App into the corresponding fields on this form.
Next, click the ‘Authorize’ button to authorize your bot with Facebook. Click ‘Okay’ to accept any permissions needed by Facebook.
Select the checkbox for the page you created in step 1, then click the ‘Next’ button.
Select ‘Yes’ for the requested permissions in the following screen.
Click ‘Done’ when finished.
The “Facebook User”, “Access Token” and “Page” fields should now have been filled in automatically.
Click the “Connect” button to connect your bot to Facebook.
Now scroll down to “Facebook Messenger Properties” and click “Facebook Messenger app (realtime messages)” to toggle it on. Press save.
Copy the “Webhook URL” to your clipboard for use in the next step.
Step 5 — Set up Webhook URL with Facebook
Go to your Facebook App’s dashboard webpage. Click on ‘Products +’ in the left menu.
Next, click the ‘Set Up’ button in the ‘Messenger’ panel.
Now select ‘Settings’ under ‘Messenger’ in the left menu.
Click the ‘Add Callback URL’ button.
Enter the ‘Webhook URL’ you had copied in the previous step into the ‘Callback URL’ field. Enter “token” into the ‘Verify Token’ field.
Click the “Verify and Save” button to finish.
The following window will pop up, select the checkbox next to your page and press the ‘Next’ button.
In the following window, check the box for ‘Manage and access Page conversations on Messenger’.
Press the ‘Done’ button. On the dashboard below, click the ‘Add Subscriptions’ button next to your page.
Select the ‘messages’ checkbox in the following window.
Click the ‘Save’ button. Scroll to the ‘Access Tokens’ section of the Messenger Settings page.
Click the ‘Generate Token’ button next to your bot’s Facebook page.
Click the ‘I Understand’ checkbox, then copy the token to your clipboard by clicking the ‘Copy’ button. Click the ‘Done’ button to close the window.
Now return to your bot’s Admin Console on the Bot Libre website. Go to the ‘Facebook’ tab and paste the ‘Page Access Token’ you had previously copied into the “Facebook Messenger Page Access Token” field.
Click the ‘Save’ button.
Step 6 — Approval by Facebook
At this point, you should be able to send messages to your bot’s Facebook Page with the Facebook user who created the page, and your bot will respond.
For other Facebook users to be able to send and receive messages with your bot, you will need to have your Facebook App approved by Facebook.
Return to the Messenger Settings page on the Facebook Developer website and scroll to the ‘App Review for Messenger’ section.
Click the ‘Add to Submission’ buttons next to the four permissions.
You will also need to complete business or individual verification. This can be found on the ‘Messenger Settings’ page.
After receiving your verification information, Facebook should approve your App after some time.
Toggle the ‘Off’ switch to ‘On’ at the top of the Facebook Developer page to make your app available to the public and have other users be able to interact with your bot.
If you got this far, congratulations, you have created a bot for Facebook Messenger for FREE. Now you can train your bot’s responses and review its conversations from its “Training & Chat Logs” page in its Admin Console.
If you’re having any issues or would like our help setting up your bot, please email us at email@example.com or upgrade to our Platinum service at firstname.lastname@example.org and we can build your bot for you.
How To Get The Most Out Of Your Facebook — Add A Chatbot was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.