Last active
May 14, 2016 09:48
-
-
Save perfectmak/13b333ce35911a00465f1960ebc136be to your computer and use it in GitHub Desktop.
This file contains 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
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