Created
December 23, 2014 21:17
-
-
Save sillygwailo/b738ccb6060a5182fbe1 to your computer and use it in GitHub Desktop.
Slack Node.js Minimal Example
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
/* | |
1. npm install slack-client | |
2. Add a bot to Slack. https://YOURDOMAIN.slack.com/services/new/bot | |
3. Replace the YOUR_TOKEN_HERE with the token from the bot. | |
4. Invite the bot to a channel to monitor. | |
*/ | |
var Slack = require('slack-client'); | |
var options = { | |
autoReconnect: true, | |
autoMark: true, | |
} | |
var slackClient = new Slack('TOKEN_HERE', options.autoReconnect, options.autoMark); | |
slackClient.login(); | |
slackClient.on('message', function(message) { | |
console.log(message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment