What is Botkit?

Botkit eases the process of designing and running bots! It provides a semantic interface to sending and receiving messages so that developers can focus on creating novel applications and experiences.


npm install --save botkit

Get your Bot Online

Here's is a quick example to get started talking with a bot inside Slack.

var Botkit = require('botkit');
var controller = Botkit.slackbot();
var bot = controller.spawn({
  token: my_slack_bot_token
bot.startRTM(function(err,bot,payload) {
  if (err) {
    throw new Error('Could not connect to Slack');

Basic Bot Commands

Try out basic commands, bot.hears() will allow your bot to listen for a key word and reply.

controller.hears(["keyword","^pattern$"],["direct_message","direct_mention","mention","ambient"],function(bot,message) {
  // do something to respond to message
  // all of the fields available in a normal Slack message object are available
  // https://api.slack.com/events/message
  bot.reply(message,'You used a keyword!');

Deep dive: get started building your own bot.