Skip to content

Instantly share code, notes, and snippets.

@coreh
Last active April 30, 2020 00:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreh/ff2c41c7921747cb407e to your computer and use it in GitHub Desktop.
Save coreh/ff2c41c7921747cb407e to your computer and use it in GitHub Desktop.
Invite users to a slack room / group as a batch
// Instructions: Open slack, switch to the channel you want to invite people to,
// Copy and paste the entire code snippet below to the "Console" tab of your web inspector, hit "Enter".
(function () {
var people = prompt('Paste the usernames you want to invite here and hit OK:').split(/,\s*|\s+/);
var textArea = $('#message-input');
var dismiss = function () {
$(".dialog_go").click();
}
var nextInvite = function () {
var person = people.pop();
textArea.val('/invite ' + person);
TS.view.submit();
setTimeout(dismiss, 500); // Dismiss the confirmation popup when inviting to a private group
if (people.length > 0) {
setTimeout(nextInvite, 1000); // Rate limit to avoid upsetting Slack
}
}
nextInvite();
})();
@alicejamaica
Copy link

Nice script. For people who want a point-and-click solution, you can use: http://slack-invite-all.com/

@KossikCZ
Copy link

KossikCZ commented Mar 7, 2019

The script looks great but can't get it working to indeed add multiple people into a user group created within Slack. Is that indeed suppose to do that?
I presume I should do that in the "group member invitation" page where I am normally allowed to enter names and submit. Is that correct?

@bauerp
Copy link

bauerp commented Mar 8, 2019

Should the usernames be comma separated?

@KossikCZ
Copy link

KossikCZ commented Mar 8, 2019

By looking at the script (but I am not expert) I don't think they should. Anyway I tried both and none of that worked when trying to have them added to a user group.

@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?

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