Skip to content

Instantly share code, notes, and snippets.

@perfectmak
Last active May 14, 2016 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perfectmak/13b333ce35911a00465f1960ebc136be to your computer and use it in GitHub Desktop.
Save perfectmak/13b333ce35911a00465f1960ebc136be to your computer and use it in GitHub Desktop.
const Botkit = require('botkit');
//Botkit supports both Slack and Facebook Messenger Bots,
//so you need to initalize for a slackbot controller with Botkit.slackbot();
const controller = Botkit.slackbot();
//Start a new process with the Bot Token gotten from Slack
const process = controller.spawn({
token: process.env.SLACK_TOKEN //change this based on the token you get
});
//Start the real-time API connections
//I need this so that the bot can respond in realtime to requests
process.startRTM((err, bot, payload) => {
if (err) {
throw new Error('Could not connect to Slack');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment