Skip to content

Instantly share code, notes, and snippets.

@anthonygore
Last active August 12, 2017 04:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonygore/5dd66f7ca1f76f3bfa54141e19818ec5 to your computer and use it in GitHub Desktop.
Save anthonygore/5dd66f7ca1f76f3bfa54141e19818ec5 to your computer and use it in GitHub Desktop.
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});
@arcanoix
Copy link

Which dependency do I use in package.json? thanks

@kbariotis
Copy link

Check out https://janitr.net

@arcanoix
Copy link

thanks @kbariotis

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