Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download all of your Team's custom Slack emojis.
#!/bin/bash -eo pipefail
# Log in to Slack in a web browser and open the network tools to inspect the traffic.
# Filter the requests with "/api/" and pick one to inspect. Click on the Headers tab and scroll down to see the request details.
# You need the xoxc token from the request body, and a copy of the cookies. It is the "d" cookie that is important, but you can copy all of them.
# Paste the values below.
# You need to have curl and jq installed.
SLACK_TOKEN="xoxc-...."
COOKIES="d=...."
data=$(curl -q -sS -b "$COOKIES" "https://slack.com/api/emoji.list?token=$SLACK_TOKEN")
if echo "$data" | jq -e '.error?' > /dev/null; then
echo "$data"
exit 1
fi
echo "$data" > data.json
echo "$data" | jq -Mr '.emoji | to_entries | .[] | select(.value | startswith("http")) | "\(.key) \(.value)"' | sort | while read name url; do
fn="$name.${url##*.}"
[[ -f "$fn" ]] && continue
echo "$fn"
curl -q -sS -o "$fn" "$url"
done
@stefansundin

This comment has been minimized.

Copy link
Owner Author

@stefansundin stefansundin commented Sep 12, 2019

This does not appear to work anymore (at least not with xoxc tokens).. I tried but wasn't able to figure out what I need to change.

Edit: The script has been updated.

@ltworf

This comment has been minimized.

Copy link

@ltworf ltworf commented Feb 27, 2020

Hi. I was having the same issue for my slack irc gateway: https://github.com/ltworf/localslackirc

I solved it by sniffing the network traffic from the browser development tools and getting both token and cookies.

@OutsourcedGuru

This comment has been minimized.

Copy link

@OutsourcedGuru OutsourcedGuru commented Apr 3, 2020

Couldn't get this to work even with a valid token. Had to pull the list from a browser (using that token), creating a local emojilist.json from the earlier output. I then replaced curl -q -s "URL" with cat emojilist.json and it worked as expected.

@stefansundin

This comment has been minimized.

Copy link
Owner Author

@stefansundin stefansundin commented Sep 1, 2020

I updated the script and added better instructions. Let me know if anything isn't working.

@hjonessimple

This comment has been minimized.

Copy link

@hjonessimple hjonessimple commented Jan 11, 2021

Worked perfectly for me. Thank you!

@jakobhans

This comment has been minimized.

Copy link

@jakobhans jakobhans commented Jun 9, 2021

This worked great for me, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment