Last active
April 30, 2020 00:48
-
-
Save coreh/ff2c41c7921747cb407e to your computer and use it in GitHub Desktop.
Invite users to a slack room / group as a batch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); | |
})(); |
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?
Should the usernames be comma separated?
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.
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
Nice script. For people who want a point-and-click solution, you can use: http://slack-invite-all.com/