Simple bootstrap to allow integration between Node.js and Facebook Messenger's API
Simply define your VERIFY_TOKEN and PROFILE_TOKEN keys in conf.js
and run with npm install; npm start
Send your page a message and the bot should respond "Hey! Welcome!"
Messenger Platform documentation: https://developers.facebook.com/docs/messenger-platform
sendMessage
: Allow you to manually send a message to the end user. Expect receiver
(string) and msg
(string) as params.
var messages = require('./lib/messages');
messages.sendMessage(sender, 'Hey! Welcome!');
quickReply
: Send a custom message to the user with buttons containing possible replies. Expect receiver
(string), msg
(string) and options
(array) as params.
var messages = require('./lib/messages'),
options = [
{
content_type: "text",
title: "Red",
payload: "You chose Red!"
},
{
content_type: "text",
title: "Blue",
payload: "You chose Blue!"
}
];
messages.quickReply(sender, 'Favorite color?', options);
isTyping
: Send 'chat bubbles' to the end user, simulating typing. Expect receiver
as param
var messages = require('./lib/messages'),
messages.isTyping(sender);
- refactor API requests repetition