Created
February 12, 2017 09:47
-
-
Save botic/aff54d729ebadc2601a0e1afa5f2e0d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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