Skip to content

Instantly share code, notes, and snippets.

@botic
Created February 12, 2017 09:47
Show Gist options
  • Select an option

  • Save botic/aff54d729ebadc2601a0e1afa5f2e0d9 to your computer and use it in GitHub Desktop.

Select an option

Save botic/aff54d729ebadc2601a0e1afa5f2e0d9 to your computer and use it in GitHub Desktop.
/**
* Short setup script for a messenger bot
* written in RingoJS + the fbmessenger package.
*/
const {readln, writeln} = require("ringo/shell");
const {FBMessenger} = require("fbmessenger");
const main = function() {
writeln("Your page token?");
const token = readln("token >");
try {
const fbmbot = new FBMessenger(token);
fbmbot.setThreadGetStartedButton("GET_STARTED");
fbmbot.setThreadGreetingText("Hi, I am your personal apocalyptic advisor!");
fbmbot.setPersistentMenu([
{
"type": "postback",
"title": "Reset MADy & MILDy",
"payload": "RESET"
},
{
"type": "postback",
"title": "Help me!",
"payload": "HELP"
}
]);
} catch (e) {
console.log("Could not start up bot!", e);
}
}
if (require.main == module.id) {
main();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment