Skip to content

Instantly share code, notes, and snippets.

Forked from lmarkus/README.MD
Created June 1, 2022 10:41
Show Gist options
  • Save sgerrand/53d59dfd3924cbb9a7deeff00aeecbd9 to your computer and use it in GitHub Desktop.
Save sgerrand/53d59dfd3924cbb9a7deeff00aeecbd9 to your computer and use it in GitHub Desktop.
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...

Step 1

Open your Slack team on your browser (I used FireFox in this example)

Next, Open your developer tools, and go to the network tab. Look for a POST request on /emoji.list step1

Step 2

Right Click on the request, and choose to open it in a new tab. step2

This will cause the browser to replay the request, yielding a JSON file with all your emoji information. step3

Save this file somewhere as emoji.json

Step 3

Run on the file. (Make sure you chmod +x it to make it executable. Details on the file.

./ emoji.json

Sit back and wait. This will create a folder called output and will save all your emoji to it.

Optional Step 4

To bulk upload your emoji into a new team, use this chrome extension:


1- This downloads files sequentially, one at a time. I didn't want to incurr Slack's rage by hammering their edge server with concurrent downloads. 2- This will duplicate aliased emoji

#!/usr/bin/env bash
## UPDATE for 2019: I completely changed my approach on how to obtain the emoji dump.
## The new approach results in a JSON file, so the processing is a bit diferent than
## with the previous version. This version will also take care of aliased emoji.
# Use:
# Make this file executable, and feed it the results from the Slack emoji URL dump. Files will be downloaded to `output`
# chmod +x
# ./ emoji.json
# Input File
# Create output directory where downloaded emoji will be stored
mkdir -p output;
# Clean Up Source File:
# Break up the file into individual lines for processing (Comma and { to NewLine)
# Slack's emoji JSON brings an unwanted escape character "\". We need to remove it.
# We'll also remove unwanted quote marks `"` and curly braces "{" "}"
RAW_LIST=$(cat "${INPUT}" | tr ",{" "\\n" | sed -E 's/[\\"{}]//g')
# Separate into Custom Emoji (Ignoring slack's default ones) and Aliases
# Filter for custom emoji (ie: Anything on, and remove the ":" separator
EMOJI_LIST=$( echo "${RAW_LIST}" | grep "" | sed 's/:https/ https/')
# Filter for the aliases, and remove the separator
ALIAS_LIST=$( echo "${RAW_LIST}" | grep ":alias:" | sed 's/:alias:/ /' )
# First download all the emoji
echo "${EMOJI_LIST}" |
while read -r line || [[ -n "$line" ]]; do
echo "Downloading ${name}.${extension}"
curl -s -o "output/${name}.${extension}" "${url}"
# Now duplicate all the aliases
echo "${ALIAS_LIST}" |
while read -r line || [[ -n "$line" ]]; do
target=$(echo "${EMOJI_LIST}" | grep "${source} ")
echo "Looking for source of ${alias} in ${source} -> ${target}"
echo "copying output/${source}.${extension} to output/${alias}.${extension}"
cp "output/${source}.${extension}" "output/${alias}.${extension}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment