Created
April 22, 2016 20:06
-
-
Save devStepsize/c8d1b8333b9a98445bd3409edb4b2654 to your computer and use it in GitHub Desktop.
Botkit conversation with multiple stages by chaining asks
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
// From https://github.com/howdyai/botkit#multi-stage-conversations | |
controller.hears(['pizzatime'], 'message_recieved', function(bot,message) { | |
askFlavor = function(response, convo) { | |
convo.ask('What flavor of pizza do you want?', function(response, convo) { | |
convo.say('Awesome.'); | |
askSize(response, convo); | |
convo.next(); | |
}); | |
} | |
askSize = function(response, convo) { | |
convo.ask('What size do you want?', function(response, convo) { | |
convo.say('Ok.') | |
askWhereDeliver(response, convo); | |
convo.next(); | |
}); | |
} | |
askWhereDeliver = function(response, convo) { | |
convo.ask('So where do you want it delivered?', function(response, convo) { | |
convo.say('Ok! Good bye.'); | |
convo.next(); | |
}); | |
} | |
bot.startConversation(message, askFlavor); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment