Facebook Bot Node API
Getting Started
Use this library to communicate with the Facebook Messenger API to develop a bot for Facebook Messenger. Go to developers.facebook.com to learn more and start building a bot.
License
The Facebook Messenger bot library is released under the terms of the MIT license. See License for more information or see https://opensource.org/licenses/MIT.
Process
Sample config:
var config = WEBSERVER: PORT: 8080 PROXY_CONFIG: 'loopback' URL_PREFIX: '/facebook' FB_MESSAGE_URL: 'https://graph.facebook.com/v2.6' VERIFY_TOKEN: '...' APP_ID: '...' PAGE_ID: '...' PROFILE_TOKEN: '...' MESSAGE_DELIVERY_TRACKING_TIMEOUT: 30000 // Optional settings which enables tracking a delivery of sent messages;
Make bot instance:
var FacebookBot = Facebook; var instance = config;instance;instance;instance;instance;instance;instance; // If MESSAGE_DELIVERY_TRACKING_TIMEOUT is setinstance; instance; // Welcome messageinstancebot;instancebot; // Normal messages with and without linksinstancebot;instancebot; // Image messagesinstancebot;instancebot; // Structured messages with horizontal scrollinginstancebot;
By default the system initialise Express 4 web-server instance to listen for FB Messenger webhook messages, if thats an overkill for you can pass custom web-server engine as the second param of FacebookBot constructor, like new FacebookBot(config, express())
.
Diclaimer
This library is still early in it's development, lacks tests and features, so use on your own risk.