Skip to content

Instantly share code, notes, and snippets.

@anthonygore

anthonygore/slack.js

Last active Aug 12, 2017
Embed
What would you like to do?
Send users a welcome message (IM) from the slackbot when they join your Slack team. Uses https://github.com/smallwins/slack so look at that first. Load this somewhere in a running Node JS app.
var slack = require('slack');
var bot = slack.rtm.client();
var token = "your_slack_token";
bot.team_join(function(obj) {
console.log("Team join triggered");
slack.chat.postMessage(
{
token: token,
channel: obj.user.id,
text: "Hello new user and welcome to the team!"
},
function(err, data) {
// Handle errors here
})
;
});
bot.listen({token: token});
@thavoo

This comment has been minimized.

Copy link

@thavoo thavoo commented Mar 13, 2017

Which dependency do I use in package.json? thanks

@kbariotis

This comment has been minimized.

Copy link

@kbariotis kbariotis commented Aug 3, 2017

Check out https://janitr.net

@thavoo

This comment has been minimized.

Copy link

@thavoo thavoo commented Aug 12, 2017

thanks @kbariotis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment