This project is a Facebook Messenger Bot which can be used to fetch Wikipedia articles and Featured contents(Article of the day, Image of the day, news, On this day) from Wikipedia.
You can see the bot in action in this video.
This Bot provides the following features,
Note: This chatbot is currently in development phase, So before start using this chatbot, you need to be in the testers list of this bot. Just send an E-mail to balaji030698@gmail.com with your Facebook profile URL, I will add you to the testers list. You will get an invite notification through Facebook. After accepting the invitation, You can start using this bot.
Once the chatbot is published, Every Facebook user can access it without requesting for the test user access.
The chatbot is currently deployed in the page https://www.facebook.com/wikipediatestbot.
Sample phrases that the user can use,
This bot has the capability to support multiple languages. Currently, It is trained in English and Tamil. We can train the bot in other languages as well in the future.
The bot will fetch the user's language preference from their phone and Facebook account's language settings option. If the user has un-supported language, then English will be used.
Wit.ai is used as an NLP agent to handle user's messages. To train our bot in more languages, we need to train the Wit.ai models and add the access tokens in .env file.
First, you'll need to fork and clone this repo
Open Terminal. Change the current working directory to the location where you want the cloned directory to be created.
git clone https://github.com/Balaji-Ramasubramanian/Wikipedia_Facebook_Chatbot
Let's get all our dependencies setup:
bundle install
You need to change the .env file with your appropriate access tokens, usernames, and passwords. You need to add the following details,
First, you'll need to migrate the database tables
rake db:migrate
Download ngrok in your local system.
Open terminal and navigate to the project folder
run rackup -p <port_number>
.
Open another window in terminal
run <path_of_ngrok_file> http <port_number>
copy the URL with 'https://' prefix. This is your webhook URL that serves your program.
You need to have Heroku CLI installed to deploy the bot in Heroku. To find more details about Heroku CLI, click here.
You can follow this link to setup the Heroku environment for the project.
For this project, you need the following resources in your Heroku project,
I will update the instructions for deploying the app in AWS, Google Cloud and Microsoft Azure shortly.
In developers.facebook.com, Navigate to your app's dashboard and click 'webhook' under products section. Click 'Edit subscription' button and Paste the Webhook URL over there.
Note Don't forget to append '/webhook' after the URL (since config.ru file mapped to the path '/webhook').
https://<YOUR_URL>>/webhook
Or you can modify your config.ru file in your project to map whatever URL path you want.
During the development phase, only the admins of the bot and the test users who are added by the admins are able to use the bot. Admins of the chatbot can add more Facebook users and also add test users through their app's dashboard.
To add new roles, Navigate to the app's dashboard on Facebook developer's page. Click on Roles -> Roles. In this page, we can add Facebook users to any one of the roles of admin/developer/tester/analytic user.
Test Users are temporary Facebook accounts that you can create to test various features of your app. To add test users for your app, Navigate to Roles -> Test Users and click on add/edit test user accounts.
To publish the chatbot, we need to submit our app for Facebook review. To do that, click on App Review -> start a submission.
After publishing the app, any Facebook users can access it by directly sending messages to the corresponding Facebook page that hosts the chatbot.
If you need any help in customizing and deploying this project, email me @ balaji030698@gmail.com