Emoji Packs (PowerUps)¶
GroupMe allows users to send special non-standard (non-Unicode) emoji. They're basically just small inline images. These emojis are also known as Powerups.
If any message contains special GroupMe emoji, there will be an attachment in the attachments list defining the emoji in the message.
Here's the JSON response for a sample message containing emoji:
The message text contains a placeholder Unicode character that defines where the user inserted emoji into their message. Note that these � characters alone don't convey any information about which emoji was sent--that information is provided in the attachment. The � characters are merely placeholders to be replaced later on with the emoji images.
The JSON format for the emoji attachment looks like this:
Object Structure | |
---|---|
The placeholder
attribute tells you the Unicode character you should replace with an image (this is the same character that shows up in the
message text
).
The charmap
attribute tells you which emojis were used in the message (see the next section for details).
Notice how there's only one � character given in the placeholder
even though there are several emojis I used in this message. That's because each � character
represents a different emoji in the charmap
. So, the first � character in the message text represents the first item in the charmap array [3, 13]
, the second � character
represents the second item [3, 12]
, and so on. So, if you're writing code to display these emojis, I would recommend looping through the charmap
and replace the first placeholder
character in the text with the emoji.
Each emoji in the charmap
is represented as an array of two integers (ex. [3, 13]
). The first integer in the array is the emoji pack number--it tells
you which emoji pack it came from. The second character is the emoji index--this tells you the specific emoji inside the pack. So, with the example [3, 13]
,
this is the 13th emoji in the 3rd emoji pack.
Finding which emoji is which¶
If you have the GroupMe app on your device, open a chat and click on the emoji button next to the text box. The emoji packs are the tabs across the top (GroupMe Emoji, Summer, Back to School, Halloween, etc), and you can click on one of the tabs to see the emojis inside the pack. Note: The packs in the GroupMe app are not necessarily in the same order as the pack number! More on that later.
There's also an API endpoint which will give you all the emoji packs in JSON format--just send a GET request to https://powerup.groupme.com/powerups
(you
don't need to use an API key). The returned data looks like this (note: To save space, I reduced the results to show only a few emoji from one pack. If you'd
like to see all the emoji packs, you can check out the full JSON at https://powerup.groupme.com/powerups):
HTTP Response | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
It looks like each powerup in the powerups
array corresponds to a category. Note that the index of a given powerup is NOT necessarily the ID you should
send in the attachment. Instead, look for powerup[index].meta.pack_id
for the Pack ID.
icon
is an array of the pack icons (shown in the tabs in the emoji picker), inline
and keyboard
(not sure of the difference between the two, other than the keyboard
emojis being a little larger) both contain the
full set of images for the pack (image_url
gives you a super long sprite sheet of all of them, whereas zip_url
gives you a zip file with 0.png, 1.png, 2.png etc.
Each entry contains a density
value, which gives you the intended screen DPI the emoji should be used on. Also, the transliterations
array contains short text
descriptions of each emoji--useful for search keywords or when you're displaying the message text somewhere you can't insert inline images (such as in a notification).
Note that some of the higher-DPI image_url
s are giving me Access Denied errors. I'm not sure why.
Sending emoji¶
There isn't really anything special to sending emojis--just craft a message whose text
contains a placeholder character and create an attachment
in the same format as above.
If you'd like some example code to work off of, here's a short proof-of-concept I made that lets me send custom emojis:
Note that in my experience it doesn't seem to matter what the placeholder is, as long as you keep it consistent with the message.