Skip to content

fossasia/susi_fbbot

Repository files navigation

AskSusi Facebook Messenger Bot

Development Build Status Master Build Status CircleCI Code Climate Join the chat at https://gitter.im/fossasia/susi_server

This is the Facebook messenger bot for AskSusi.

Technology Stack

node.js and Express.

Getting Started

It's easy for you to create your own facebook messenger bot and integrate susi's API into it. You can read the documentation as prepared by the Messenger team.

Messenger bots uses a web server to process messages it receives or to figure out what messages to send. You also need to have the bot be authenticated to speak with the web server and the bot approved by Facebook to speak with the public.

Setup your own Messenger Bot

  1. Fork this repository.

  2. Create a facebook page here.

Creating a FB Page

New FB Page

  1. Create a new Google Cloud or Heroku App.

New Heroku App

  1. Connect the heroku app to the forked repository.

Connect to Github

  1. Deploy on development branch. If you intend to contribute, it is recommended to Enable Automatic Deploys.

Branch Deployment

Successful Deployment

  1. Create or configure a Facebook App or Page here

New FB App

  1. Get started with Messenger tab in the created app.

Messenger Selection

  1. In the Page Access Token select the fb page that you created and generate the token and save it somewhere for future use.

Token Generation

  1. Now, go to the heroku app, select the settings tab and add the environment variable as shown, where key is FB_PAGE_ACCESS_TOKEN and value is the token generated in the previous step.

Environment Variable

  1. Create a webhook on the facebook app dashboard. The Callback url should be https://<your_app_name>.herokuapp.com/webhook/ and rest should be as shown in the image below.

Webhook Creation

App Complete

  1. Go to Terminal and type in this command to trigger the Facebook app to send messages. Remember to use the token you requested earlier.
curl -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?access_token=<PAGE_ACCESS_TOKEN>"
  1. Go to the facebook page created and locate 'Message Now' or go to https://m.me/PAGE_USERNAME

Message on Page

  1. Enjoy chatting with Susi.

Message on Page

Branch Policy

The default branch is development, so make sure you contribute only on this branch.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE, Version 3. Please find more info in our license document.