Skip to content

Instantly share code, notes, and snippets.

@condef5
Last active July 4, 2022 16:23
Show Gist options
  • Save condef5/91305ff4b586f527128e8971c2fa99b4 to your computer and use it in GitHub Desktop.
Save condef5/91305ff4b586f527128e8971c2fa99b4 to your computer and use it in GitHub Desktop.
Import and export all your custom emojis from slack

Export your emojis

Steps:

  1. Run saveEmojisToExcel.js in your browser to dowload a CSV containing filename, url for each custom emoji.
  2. Create a download.sh script file and give permissions chmod +x download.sh
  3. Run the script: ./download.sh
  4. See the emojis folder

Import your emojis

  1. We need to install this extension
  2. Go to https://slack.com/customize/emoji and select your slack workspace
  3. We just drag the emojis folder in Bulk Emoji Uploader section

image

mkdir -p emojis;
for emoji_line in $(cat emojis.csv); do
name=$(echo "$emoji_line" | cut -d, -f1)
url=$(echo "$emoji_line" | cut -d, -f2)
curl -s -o "emojis/${name}" "${url}"
done
// grab slack custom emoji URLs and save as CSV
let emojis = {};
// get auth token for API request
let teams = JSON.parse(localStorage.localConfig_v2).teams
let slackId = window.location.pathname.split('/')[2] // or you can put directly your slack id
let authToken = teams[slackId].token;
// setup request
let formData = new FormData();
formData.append('token', authToken);
(async () => {
let rawResponse = await fetch('/api/emoji.list', {
method: 'POST',
body: formData
});
let emojisApi = await rawResponse.json();
emojis = emojisApi.emoji;
// generate CSV
var csvContent = 'data:text/csv;charset=utf-8,';
for (const [name, url] of Object.entries(emojis)) {
if (typeof url === 'string' && url.startsWith('http')) {
let filename = name.replace("'", "\\'") + '.' + url.split('.').pop();
csvContent += filename + ',' + url + '\n';
}
}
// download csv
let encodedUri = encodeURI(csvContent);
let csvDownloader = document.createElement('a');
csvDownloader.href = encodedUri;
csvDownloader.download = 'emojis.csv';
document.body.appendChild(csvDownloader);
csvDownloader.click();
document.body.removeChild(csvDownloader);
})();
@condef5
Copy link
Author

condef5 commented Jul 4, 2022

i=0; for f in *; do d=dir_$(printf %03d $((i/25+1))); mkdir -p $d; mv "$f" $d; let i++; done

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