How can I get the FULL list of slack emoji through API?

Luca Stucchi picture Luca Stucchi · Sep 14, 2016 · Viewed 11.6k times · Source

I am using the slack API to get the full list of emoji, so that when I get a message, I will just replace :squirrel: with the icon.

The method https://slack.com/api/emoji.list works like a charm, but returns 30 icons only. I think this is correct since in the documentation page (https://api.slack.com/methods/emoji.list) they say:

This method lists the custom emoji for a team.

Fair enough, but how can I get the full list of the associations icon-name / icon URL ?

Answer

Luca Stucchi picture Luca Stucchi · Sep 23, 2016

I finally managed to get all the icons and to use them and I post here the solution for anyone that would like to use do similar:

  1. First of all, I got the Slack Custom Emoji through this slack URL

  2. Since at step 1 we get only Custom Emojis, it is useful to know that slack uses standard emoji defined in unicode characters, mapped through custom handles like :smiley: or :horse:. The good thing is that we can find, linked through slack page a link to a JSON object with all the emoji mappings. This file is HUGE, but has everything we need.

  3. In the file you'll find an array of javascript object like the one below:

{
 "name":"SMILING FACE WITH OPEN MOUTH",
 "unified":"1F603",
 "variations":[],
 "docomo":"E6F0", 
 "au":"E471",
 "softbank":"E057",
 "google":"FE330",
 "image":"1f603.png",
 "sheet_x":26,
 "sheet_y":18,"
 short_name":"smiley",
 "short_names":["smiley"],
 "text":":)",
 "texts":["=)","=-)"],
 "category":"People",
 "sort_order":5,
 "has_img_apple":true,
 "has_img_google":true,
 "has_img_twitter":true,
 "has_img_emojione":true
}

I used the following information:

  • shortnames are the names that are used in slack (you'll need to turn smiley into :smiley: )
  • unified is the unicode character to use (to use it directly in an HTML page you'll need to add &#x so in this case you'll have to use 😃 which is rendered 😃

Using this information you will be able to create a slack-to-html function to decode emojis and display them wherever you want