Skip to content

Instantly share code, notes, and snippets.

@sillygwailo
Created December 23, 2014 21:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sillygwailo/b738ccb6060a5182fbe1 to your computer and use it in GitHub Desktop.
Save sillygwailo/b738ccb6060a5182fbe1 to your computer and use it in GitHub Desktop.
Slack Node.js Minimal Example
/*
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