Skip to content

sayeed958/Indian-rail-fb-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indian-Rail-Facebook-chatbot using WIT ai

Wit.ai and Facebook Messenger Integration using IRCTC APIs

Initial Installation

Fork this repository and clone.

git clone https://github.com/{forked}/Indian-rail-fb-chatbot.git
cd Indian-rail-fb-chatbot
npm install

Configuration

Wit Setting

Go to https://wit.ai/home and create a wit app for you. Read https://wit.ai/docs/quickstart Then, go to the setting in your wit app and get the token id.

Test the bot.js with your WIT_TOKEN, and make sure the bot is working.

 $WIT_TOKEN=insert_token_here node bot

Facebook Page Creation

First you need to make a Facebook Page at https://www.facebook.com/pages/create/?ref_type=pages_browser, since the messenger bot will be connected to your facebook page.

Facebook App Creation

image

  • Add email, select category, an add web site. (Any URL is OK):

image

Facebook Messenger Setting

image

  • Select Messenger and get started:

image

  • Select the page you have created and get the Page Access Token:

image

Launch Server in Heroku

  • Run heroku create and push to heroku:
cd Indian-rail-fb-chatbot
heroku create
git push heroku master

Facebook Webhooks Setting

image

  • Select "Setup Webhooks", and you will see callback URL and verify token. For the callback URL put your Hherokuapp URL + "/webhook". For example, my callback URL is https://irctcfbweb.herokuapp.com/webhook.

  • Type the Verify Token that you set in the Heruku app setting. If you haven't set, the default value is "just_do_it".

  • Click all items in the Subscription Fields.

image

  • Then, you will see the green complete!

image

  • You may need to select the Facebook Page one more time and get the access token.

image

  • You need to fire this command to activate your messanger.
curl -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?access_token=<PAGE_ACCESS_TOKEN>"
  • You may see:
{"success":true}
  • Finally, go to the Facebook page you created/selected, and talk to your bot. Enjoy!

Testing

Jest

npm test

Contribution

We welcome your comments.

Releases

No releases published

Packages

No packages published