Skip to content

Instantly share code, notes, and snippets.

@DEGoodmanWilson
Last active August 22, 2016 02:34
Show Gist options
  • Save DEGoodmanWilson/81d8feeea27dea93d8c772cdcb0c3b1f to your computer and use it in GitHub Desktop.
Save DEGoodmanWilson/81d8feeea27dea93d8c772cdcb0c3b1f to your computer and use it in GitHub Desktop.
slackbot
https://github.com/slackhq/easy-peasy-bot
git clone git@github.com:slackuserdegoodmanwilson2/easy-peasy-bot.git
npm install --save botkit-middleware-apiai
var apiai = require('botkit-middleware-apiai')({
token: process.env.APIAI_TOKEN
});
controller.middleware.receive.use(apiai.receive);
//controller.hears(['hello'], 'direct_message,mention,direct_mention', apiai.hears, function (
controller.hears(['hello'], 'direct_message', apiai.hears, function (
bot, message) {
bot.reply(message, 'Hello!');
});
controller.hears(['booking'], 'direct_message', apiai.hears, function (bot, message) {
if(message.fulfillment.speech !== '') {
bot.reply(message, message.fulfillment.speech);
} else {
bot.reply(message, "You requested to fly to " + message.entities['geo-city'] + " on " + message.entities['date']+".");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment