Slack – Can a Slackbot Create Emoji

botemojislack

The only emoji command I can find is https://api.slack.com/methods/emoji.list

Is there a way to programatically create custom emoji? Or is the only way via manual process – https://get.slack.help/hc/en-us/articles/206870177-Creating-custom-emoji

Best Answer

There's an undocumented API endpoint for this: emoji.add (and its little buddy emoji.remove).

emoji.add POST parameters

  • token (either in POST body or Authorization: Bearer header) (There's an open GitHub issue that claims you can't use xoxb tokens, only xoxs ones.)
  • mode (data)
  • name (what you want as the custom emoji's name, e.g. my-party-parrot)
  • image (the file)

emoji.remove POST parameters

  • token (either in POST body or Authorization: Bearer header)
  • name (which custom emoji you want to remove, e.g. my-party-parrot)

Here's what it looks like in Postman:

Postman - Slack API - emoji.add

In CURL, the call would look like this:

curl -X POST \
  https://slack.com/api/emoji.add \
  -H 'Authorization: Bearer [REDACTED] \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' \
  -F mode=data \
  -F name=my-party-parrot \
  -F image=@/home/curtis/Downloads/some-file.jpg

Everything that I know about this comes from from Jack Ellenberger's ":slack_on_fire:" article and his emojme library.