Skip to content

Instantly share code, notes, and snippets.

@steve-jansen
Created February 14, 2017 21:24
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 steve-jansen/6e7a09dcf67d280bd382e59b99ee4298 to your computer and use it in GitHub Desktop.
Save steve-jansen/6e7a09dcf67d280bd382e59b99ee4298 to your computer and use it in GitHub Desktop.
Bulk invite Slack users to a channel
for u in $(jq --raw-output ". | .[]" < members.json); do
clear;
echo Inviting user ${u};
curl -i -X GET "https://slack.com/api/channels.invite?token=${API_TOKEN}&channel=${CHANNEL}&user=${u}" | head -n 20;
sleep 1;
done;
@streetdaddy
Copy link

Since legacy tokens are no longer endorsed by Slack themselves, does anyone have a better / more recent solution for this?

A developer on your team might want this type of token for testing an app or integration, but you should be cautious about who you grant these to. Instead of using legacy tokens, we encourage creating internal integrations which have more controlled access to data.

I don't want build an app just to do one-off bulk invitation 😢

@tbc
Copy link

tbc commented Apr 30, 2020

Deprecated!

The best practice is now described in the Web Applications StackExchange: How do I invite all team members to a new Slack channel?

@jaipandya
Copy link

Since legacy tokens are no longer endorsed by Slack themselves, does anyone have a better / more recent solution for this?

If you are looking for a no-code solution, you can use Channel Tools app to invite all users to a Slack channel (and more).

Disclaimer: I'm the maker of the app.

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