Nowadays Bots are becoming an important part of our lifestyle. Let’s look into how to deploy LEX Bots into Facebook messengers.
Chatbots will be almost indistinguishable from their human counterparts, if anything, even better. According to Gartner, chatbots will power 85% of all customer service interactions by the year 2020. In fact, the average person will have more conversations with bots than with their spouse.
In the last post already shared how to create own chatbot. If you haven’t read it, please read it first. Then read this Post regarding Deploy chabot in your Facebook messenger. Let us follow the below steps.
Create a Facebook app on Developer Facebook Account
- First, we need to create a Facebook app. Go to the Facebook Developer page and create a new app, fills some require details of the App.
- After creating of the app, Now go to “Add a product” and add Facebook messenger and it will be taken to the settings page of a messenger.
- We need two important things are Secret key and Page Access Token from facebook app for publishing your Lex Chabot in messenger. Now you have to generate the Page Access Token.
- Once you selected your page, then access token will be generated.
- Now have to take App Secret key, go to “Dashboard” and get the App Secret.
That solves we need from the Facebook developer.
After creating the Facebook app, now we have to go AWS Console account and select your Bots which was created on LEX.
Creating a channel in Amazon Lex console:
- Go to Amazon Lex console and go to settings tab and create an alias.
- Go to the Channel tab and choose the Facebook channel.
- Provide the name, description and the Alias you created in the settings.
- Give some random text as Verify Token. This will be used as authentication for the calls from Facebook. You need to provide the same Verify Token in Facebook.
- Get the Page Access Token and App Secret key from the Facebook app and filled it, then click on Activate it.
- and a callback URL should be generated for you.
Configure the callback in Facebook
Now that we got the callback URL from AWS LEX channel tabs, we need to configure it in the Facebook app we created.
Go to the Facebook app we created.
Copy the callback URL from Lex and paste it in Webhook settings in messenger.
We have to give the same Verify Token as you gave in Lex channel settings.
Now can choose the events messages, messaging_postbacks, messaging_optins and verify and save.
Select the page and click on subscribe in the Webhook window to listen to chat from the page.
Make the page to send events to our bot
- Go to Settings on your Facebook page.
- Select Messenger Platform from the left tab.
- You will see your Facebook app being listed there.
- Set the role as Primary Receiver.
That’s solved it, we have set all step to messenger with LEX bots. Now you can go to the Facebook page and click on Send Message to start chatting with your bots.
All things are well, the Facebook messenger will be able to communicate with our Lex Bot like get a response as below screen.
Thanks for reading and visiting blog. Soon will post in another Chatbots integration to others services.
Alternative link: Tecoquest