Skip to content

Instantly share code, notes, and snippets.

@bkrodgers
Last active August 16, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkrodgers/e47add4103975deb9ec737f2e17ae293 to your computer and use it in GitHub Desktop.
Save bkrodgers/e47add4103975deb9ec737f2e17ae293 to your computer and use it in GitHub Desktop.
Prompts for a slack API token and exports all emoji from the associated instance to ./output. Get your token here: https://api.slack.com/docs/oauth-test-tokens. Use https://chrome.google.com/webstore/detail/slack-emoji-tools/anchoacphlfbdomdlomnbbfhcmcdmjej to import
#!/bin/bash
token=""
while [[ -z "$token" ]]; do
read -s -p "Please enter your Slack token: " token
done
echo ""
mkdir -p output
list=$(curl https://slack.com/api/emoji.list?token=$token)
for key in $(echo $list | jq --raw-output '.emoji | keys | .[]'); do
url=$(echo $list | jq --raw-output ".emoji[\"$key\"]")
if [[ $url != alias* ]] ; then
filename=$(basename "$url")
ext="${filename##*.}"
echo "$url -> output/$key.$ext"
curl $url > output/$key.$ext
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment