This is a simple NodeJS based Facebook bot that replies with the text message you send it.
In using this repository, it is assumed that you know how to create, and work with the Facebook interface to be able to leverage their messaging API to create bots.
To use this application, you need to have the following things:
-
An Active Facebook Account
Create a profile here: https://www.facebook.com/
-
An Active Facebook Bot Account
Create one here: https://developers.facebook.com/
-
The Ngrok application to allow tunneling for local development
Download the application here: https://ngrok.com/download
- Clone the repository
git clone https://github.com/devaku/nodejs-facebook-bot
cd nodejs-facebook-bot
- Then after that, install the node_modules using the provided script
npm run install-server
-
Once the installation is done, make sure to create a .env file, from the given sample
-
Fill it in with the needed details required to run the application
-
To run the application locally, ngrok must be running in the background. Make sure the PORT you provide (from the .env file), is the same PORT you use when running ngrok.
ngrok http 80
- Once everything is set up just run the following script to get the application started
npm run debug
- The application is setup to verify the Webhook through the following endpoint
GET /webhook
- Bot messages will then be received through the following endpoint
POST /webhook
- Go to Facebook Messenger and talk to your bot, and start a conversation to see it work :D
- This Node.js application was created by Alejo Kim Uy.
- If you're interested in working with me, you can find my details on my LinkedIn.
- If you want to see my other coding projects, you can find them on my Github.