1
0
Fork 0
Go to file
Arun Babu Neelicattu 60aa4c8653 Support emoji name prefix/suffix
- add support for prefixes via --prefix/$EMOJI_NAME_PREFIX
- add support for suffixes via --suffix/$EMOJI_NAME_SUFFIX
2017-07-25 01:34:51 +12:00
.env.example Support emoji name prefix/suffix 2017-07-25 01:34:51 +12:00
.gitignore Adding a script to export emoji to a given dir from an existing slack team. 2017-01-30 11:51:25 -06:00
LICENSE Initial commit 2015-02-22 09:07:37 -05:00
README.md Adding a script to export emoji to a given dir from an existing slack team. 2017-01-30 11:51:25 -06:00
export.py Adding a script to export emoji to a given dir from an existing slack team. 2017-01-30 11:51:25 -06:00
requirements.txt Adding a script to export emoji to a given dir from an existing slack team. 2017-01-30 11:51:25 -06:00
upload.py Support emoji name prefix/suffix 2017-07-25 01:34:51 +12:00

README.md

Slack Emojinator

Bulk upload emoji into Slack

Want to create a custom Slack emoji for every pokemon? Slack doesn't currently expose an API endpoint for creating emoji, probably to prevent users from doing exactly what I'm doing, but here's a way to do it anyway.

Creating Emoji

You'll need Python and pip to get started. I recommend using virtualenv and possibly virtualenvwrapper as well. Standard best-practice Python stuff.

Prepare a directory that contains an image for each emoji you want to create. Remember to respect Slack's specifications for valid emoji images: no greater than 128px in width or height, no greater than 64K in image size. The base filename of each image file should be the name of the emoji (the bit you'll type inside : to display it).

Clone the project, create a new virtualenv, and install the prereqs:

git clone https://github.com/smashwilson/slack-emojinator.git
cd slack-emojinator
mkvirtualenv slack-emojinator
pip install -r requirements.txt

You'll need to provide your team name (the bit before ".slack.com" in your admin URL) and your session cookie (grab it from your browser). Copy .env.example, fill them in, and source it.

To grab your Slack session cookie:

  • Open your browser's dev tools and copy the value of document.cookie
  • Go to the Network tab
  • Re-load page like https://{teamname}.slack.com/customize/emoji
  • Find call to emoji (it is most likely the very top request)
  • Scroll to Request-Headers and copy the value of Cookie and add to .env
cp .env.example .env
${EDITOR} .env
source .env

Now you're ready to go. Use a shell glob to invoke upload.py with the emoji files as ARGV:

python upload.py ${EMOJI_DIR}/*.png

Exporting Emoji

A Slack API token and an export director are needed for the export. They can be added to the .env file and sourced.

source .env
python export.py ${EMOJI_DIR}/