General
Simple Facebook Messenger Chatbot for my bands FB page. Shows several information for fans or organizers.
Globals
The PAGE ACCESS TOKEN and VERIFY TOKEN, which are both important for the configuration, are stored in globals/globals.js. The file looks like this:
var globalConfig = {
PAGE_ACCESS_TOKEN: "",
VERIFY_TOKEN: "",
MAIL: "",
MAIL_PASS: "",
MAIL_TO: "",
PORT: 465,
SECURE: true,
HOST: "smtp.example.com"
};
Main Functionality
The method handleMessage() handles the entire conversation. If there is a postback, which means that the bot will answer a button click or a message, the user wrote, the method handlePostback() will do the rest.
I use a switch statement to handle the answer for the users texts. Because of a lot of possible answers, the switch statement is huge.
Links
I implemented the chatbot with the Facebook Messenger Plattform. There you can find First Steps to build your own one.
Have fun!