This workflow has been proven to work at the end of March 2024, it may break in the future!
At work we recently bypassed over 60k custom slack emoji in our workspace, and I'd been meaning to download them locally so I could reference them in other discussions outside of slack with past and present coworkers.
I did some scavenging on Google (actually Perplexity) and found a fairly active Gist that seems to have captured a few different routes to accomplish the use case, but some of the API has changed since then.
So I figured I'd document what I did to accomplish this in case others are looking for a similar solution!
Steps:
Download emoji metadata:
- Visit your
/customize/emoji
page in a browser of your choosing a. This should look roughly like:https://<organization>.slack.com/customize/emoji
- Open the network panel and look for a request to the
emoji.adminList
endpoint - Copy that request as
fetch
(right click the request, copy as ->fetch
in Chrome/Arc) - Copy the below snippet and paste it into the console a. This snippet only defines a few helper functions, it won't do anything malicious, but validate it for yourself if you'd like!
- Replace the
TODO
withinfetchPage
with the copiedfetch
request from the network panel - Important! Look in the request body of the
fetch
you copied for apage: 1
entry, and replace the1
with${pageNum}
- you'll also need to change the body to a template string! - Run
downloadAllEmoji
with a start value >= 1 and a stop value <= the max number of pages (you can look at theemoji.adminList
request for page 1 to see the maximum number of pages)
Download images:
To download the actual images, you'll want to:
- Move the downloaded metadata files into a shared directory
- Initialize a new Bun project within that directory by running
bun init
- Paste in the following snippet into
index.ts
:
- Install
fast-glob
viabun add fast-glob
- Run the above script via
bun ./index.ts
Note! If you have a lot of emoji, this will take a while! It downloads the images synchronously to avoid being rate limited.
Recommendations:
I recommend not trying to run through all pages at once when fetching the emoji metadata, as sometimes Slack may not be able to handle the requests.
In my case, since we had ~600 pages to go through, I started with chunks of 25 then went up to 100 pages at a time.