express-facebook-messenger
v0.0.4
Published
Tiny Facebook Messenger Bot utilty
Downloads
19
Readme
Install
npm install express-facebook-messenger
Getting started
1. Setup a Facebook App and Page and note down the generated page token.
2. Build bot
var express = require('express');
var bodyParser = require('body-parser');
var bot = require('../lib/')('<token>');
// or
var bot = require('../lib/')({
validationToken: '<token>',
pageAccessToken: '<token>'
});
var app = express();
bot.on('message', function(senderId, msg){
this.send(senderId, {
text: 'Hello to you too!'
});
});
app.use(bodyParser.json());
app.use('/hook', bot.router());
app.listen(5000);
Example
To run the example app:
- Install ngrok
- Start ngrok tunnel
ngrok http 5000
- Note the generated url and use it to add a webhook to your FB app.
- Run
TOKEN='<your page token>' node test/simple.js
Contribute
Lmk ...