








var Botkit = require('botkit');
var controller = Botkit.slackbot({
clientId: process.env.clientId,
clientSecret: process.env.clientSecret,
studio_token: process.env.studio_token,
});
Include Botkit into your Node application and boot up a controller that will define your bot's behaviors. In this case, we're setting up a bot for Slack.
controller.setupWebserver(process.env.port,function(err,webserver) {
controller.createWebhookEndpoints(controller.webserver);
controller.createOauthEndpoints(controller.webserver);
});
Set up a simple webserver so that Botkit can receive incoming messages via webhook.
controller.hears('hello','direct_mention,direct_message', function(bot, message) {
bot.reply(message,'Howdy!');
});
Tell the bot to listen for users saying "hello," and use `bot.reply` to send an immediate response.
controller.hears('tacos','direct_mention,direct_message', function(bot, message) {
bot.startConversation(message, function(err, convo) {
convo.say('Oh boy, taco time!');
convo.ask('What type of taco do you want?', function(answer, convo) {
var taco_type = answer.text;
// do something with this answer!
// storeTacoType(convo.context.user, taco_type);
convo.say('YUMMMM!!!'); // add another reply
convo.next(); // continue with conversation
});
});
});
Start a conversation, then queue up multiple messages to send, including a prompt sent using `convo.ask()` which allows your bot to capture user input and use it.
You can join nearly 5,000 developers building bots and messaging apps in our friendly, open Slack community. Sign up today and be sure to introduce yourself in the #botkit channel. Also, expect a DM from our friendly Welcomebot when you join!
You can contribute to the best botmaking toolkit around! If you need it, you can get help from the thousands of developers building with Botkit. Please browse the GitHub Issues to see known issues and submit any bugs you find, and we'll be sure to help sort them out!

Talkabot is where we explore the past, present and future of bots with other developers and bot enthusiasts. Check out Talkabot.ai for info on upcoming events, and RSVP for one of our local meetups on Meetup. See you there!