Created
July 19, 2022 23:18
-
-
Save aabed/a8b601f67c44453cb6ad525343966ac3 to your computer and use it in GitHub Desktop.
Export Slack Members Into Iphone Contacts
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
export ORG_NAME="Some Company" #change that to your company's name | |
export SLACK_TOKEN="xoxb-**************************" #Your slack token | |
curl -L -v -H "Authorization: Bearer $SLACK_TOKEN" "https://slack.com/api/users.list" > contacts.json | |
cat contacts.json | jq '.members[]?.profile|select(.phone != "")| .real_name+"-"+.phone'| sed 's/\"//g'| while IFS= read -r item; do echo "BEGIN:VCARD\nVERSION:3.0\nFN:${item%-*}\nTEL;TYPE=CELL:${item#*-}\nN:`echo ${item%-*}| awk '{if ($3){ print $3";"$1";"$2} else {print $2";"$1}}'`;;;\nitem1.ORG:${ORG_NAME}\nitem1.X-ABLabel:unknown\nCATEGORIES:myContacts\nEND:VCARD" ; done> contacts.vcf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment