Skip to content

Instantly share code, notes, and snippets.

@erunion
Last active November 15, 2025 00:13
Show Gist options
  • Select an option

  • Save erunion/7464da10e8b47d5064dcd0c16c2c38a5 to your computer and use it in GitHub Desktop.

Select an option

Save erunion/7464da10e8b47d5064dcd0c16c2c38a5 to your computer and use it in GitHub Desktop.
simple script to backup emojis in slack

How to use this

  1. In Slack, click on Tools -> Customize Workspace
  2. Open up your network tab and filter for emoji.admin
  3. Scroll the full list
  4. Open up the response from each emoji.admin JSON request that was made and copy it to a page-*.json file
  5. In a terminal, run slack-emoji-download.sh page-1.json to download every emoji listed in that page to an output directory.
  6. Continue until you have every emoji donwloaded.
#!/usr/bin/env bash
# Script to download emojis from a JSON file
# Usage: ./download.sh page-1.json
# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed. Please install jq first."
echo "On macOS: brew install jq"
echo "On Ubuntu/Debian: sudo apt-get install jq"
exit 1
fi
# Check if input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <json-file>"
exit 1
fi
INPUT="$1"
# Check if input file exists
if [ ! -f "$INPUT" ]; then
echo "Error: File '$INPUT' not found"
exit 1
fi
# Create output directory
mkdir -p output
# Counter for progress
total=$(jq '.emoji | length' "$INPUT")
current=0
echo "Found $total emojis to download"
echo ""
# Process each emoji in the JSON file
jq -r '.emoji[] | "\(.name)|\(.url)"' "$INPUT" | while IFS='|' read -r name url; do
current=$((current + 1))
# Skip if name or url is empty
if [ -z "$name" ] || [ -z "$url" ]; then
continue
fi
# Extract file extension from URL
extension="${url##*.}"
extension="${extension%%\?*}" # Remove query parameters if any
# Default to .png if no extension found
if [ -z "$extension" ] || [ "$extension" = "$url" ]; then
extension="png"
fi
# Create filename
filename="output/${name}.${extension}"
# Download the file
echo "[$current/$total] Downloading: $name"
if curl -s -f -o "$filename" "$url"; then
echo " ✓ Saved to: $filename"
else
echo " ✗ Failed to download: $name"
fi
done
echo ""
echo "Download complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment