Skip to content

Latest commit

 

History

History
52 lines (45 loc) · 2.2 KB

README.md

File metadata and controls

52 lines (45 loc) · 2.2 KB

Sample-FB-ChatBot

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

Prerequisites

  • Basic knowledge in NodeJs
  • Development environment with NodeJs installed
  • Basic knowledge in Facebook Pages/Apps

Step 1 - Setting up the chat bot server

  • Clone this repo
$ git clone https://github.com/PahanPerera/Sample-FB-ChatBot.git
  • Install NodeJs dependencies
$ cd Sample-FB-ChatBot
$ npm install
  • Run server
$ node server.js

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

Step 2 - Setting up the Facebook Application

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

  • Goto server.js file and replace <YOUR_VERIFY_TOKEN> with the token you got from the step 2. (server.js line 10)
  • Restart 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

Step 5 - Done

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

Thank you for reading and your feedback is welcome.