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(); | |
})(); |
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
Should the usernames be comma separated?