Last active
February 28, 2017 22:02
-
-
Save stripethree/a9cdf59b677e167854f4612e4ffa6bb5 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
const debug = require('debug')('hello-world:app'); | |
const { Messenger, responses } = require('launch-vehicle-fbm'); | |
const messenger = new Messenger(); | |
messenger.start(); | |
// EVENT HANDLERS | |
///////////////// | |
messenger.on('text.greeting', ({senderId, session, firstName, surName, fullName}) => { | |
const greeting = new responses.Text(`🤖 beep bop boop. Hello ${fullName}, I am a bot.`); | |
return messenger.send(senderId, greeting); | |
}); | |
messenger.on('text.help', ({senderId}) => { | |
const help = new responses.Text(`🤖 I am here to offer my services to assist you.`) | |
return messenger.send(senderId, help); | |
}); | |
messenger.on('text', ({senderId, text, source}) => { | |
const echo = new responses.Text(`Echo echo: "${text}"`); | |
return messenger.send(senderId, echo); | |
}); | |
messenger.on('message.text', ({senderId, text, source}) => { | |
debug(`message.text event processed: ${text}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment