Skip to content

Sample server application and tutorial on creating a sample facebook chat bot

Notifications You must be signed in to change notification settings

gvilarino/hodor-bot-fb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hodor-bot-fb

Simple chat bot server for the Hodor Bot Facebook application. Based on Sample-FB-ChatBot.

Usage

$ npm i
$ npm start

Configuration

You'll need to set up the FB_TOKEN environment variable with the app access token provided by Facebook in your app settings dashboard.

Facebook setup

Step 1 - Setting up the chat bot server

  • Clone this repo
$ git clone https://github.com/gvilarino/hodor-bot-fb.git
  • Install NodeJs dependencies
$ cd Sample-FB-ChatBot
$ npm install
  • Run server
$ npm start

If you are seeing "Example app listening on port 3010!", your server has been started successfully.

  • Stop the server for now

Step 2 - Setting up the Facebook Application

  • Create Facebook App and Page (link)
  • Get Page access token (link (Save this the next step)

Step 3 - Setting up Token in the server and prepare webhook

  • Set this to your FB_TOKEN env variable
  • Start the server
  • Since Facebook only accept public https URLs as their webhooks, we need to expose our local server endpoints as public https. Quick way to do that is use https://localtunnel.me/
  • Create a https public endpoint using https://localtunnel.me/ (Please make sure you disable your firewalls)
$ npm install -g localtunnel
  • Tunnel our local server port
- lt --port 3010

Step 4 - Subscribe Facebook App and Page

  • Subscribe your application with your page (link

Step 5 - Done

  • Now goto your Facebook page and send it a chat message, it will echo back the text you send.

Notice

Keep in mind that only app admins, developers and testers will be able to see the bot's anwsers until the app is public and approved by Facebook.

About

Sample server application and tutorial on creating a sample facebook chat bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 85.2%
  • JavaScript 14.8%