Botany-node
Elegant Facebook Messenger bots with Node.js
Example using express
;const express = ;const app = ;const bodyParser =const Botany = ;/* Configure our Facebook Bot */var config =facebook:accessToken: processenvFB_ACCESS_TOKENverifyToken: processenvFB_VERIFY_TOKEN;/* Create a new bot */var facebookBot = config;/* Listen for any incoming messages */facebookBot;/* Set up an express server */app;/* Insert our bot's interceptor as middleware */app;app;
Available events
// Called when the bot receives a messagefacebookBot; // Called when the bot has just sent a messagefacebookBot; // Called when a user has read a message sent by your botfacebookBot; // Called when the Linked Account or Unlink Account call-to-action have been tappedfacebookBot; // Called when the Send-to-Messenger plugin has been tappedfacebookBot; // Called when a postback button has been clickedfacebookBot;
Entities
Payload: For a detailed description of the payload object for each event see the Facebook webhook developer documentation
reply: reply is a function for responding to a user. It takes a facebook message as a body, formatted as per Facebook's documentation