Last active
January 10, 2019 10:20
-
-
Save alexellis/e8298fb5c625e209496b6bbf624a4c47 to your computer and use it in GitHub Desktop.
Bulk invite email addresses to Slack
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
#!/bin/bash | |
# Copyright Alex Ellis 2019 | |
# Generate legacy token, then populate here | |
export TOKEN="" | |
# You will need to put each email address on a new line in a file named users.txt | |
cat users.txt | while read line | |
do | |
export EMAIL=$line | |
echo Inviting $EMAIL | |
curl -X POST 'https://openfaas.slack.com/api/users.admin.invite' \ | |
--data "email=""$EMAIL""&token=""$TOKEN""&set_active=true" \ | |
--compressed | |
echo | |
sleep 0.1 | |
done |
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
#!/bin/bash | |
export TOKEN="" | |
cat users.txt | while read line | |
do | |
export EMAIL=$(echo $line | cut -f1 -d" ") | |
export FIRST=$(echo $line | cut -f2 -d" ") | |
export LAST=$(echo $line | cut -f3 -d" ") | |
#export EMAIL=$line | |
echo Inviting $EMAIL $FIRST $LAST | |
curl -X POST 'https://openfaas.slack.com/api/users.admin.invite' \ | |
--data "email=""$EMAIL""&token=""$TOKEN""&set_active=true&first_name=""$FIRST""&last_name=""$LAST""" \ | |
--compressed | |
echo | |
sleep 0.1 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment