Skip to content

Instantly share code, notes, and snippets.

@aabed
Created July 19, 2022 23:18
Show Gist options
  • Save aabed/a8b601f67c44453cb6ad525343966ac3 to your computer and use it in GitHub Desktop.
Save aabed/a8b601f67c44453cb6ad525343966ac3 to your computer and use it in GitHub Desktop.
Export Slack Members Into Iphone Contacts
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