Emoji, stickers & attachments
Custom emoji and stickers are small images that belong to one server. Attachments are files that members upload and add to messages. This page explains how each is stored and how messages refer to them.
Custom emoji and stickers
Section titled “Custom emoji and stickers”{ "id": "4", "name": "party_parrot", "fileName": "4.gif"}Each emoji or sticker has a numeric id, a name, and a fileName. Stickers also have a description. Load the image over HTTP from /emojis/<fileName> or /stickers/<fileName>.
| Task | Emoji | Stickers |
|---|---|---|
| List | emoji_list |
sticker_list |
| Add | emoji_add |
sticker_add |
| Rename | emoji_update |
sticker_update |
| Delete | emoji_delete |
sticker_delete |
Adding, changing, or deleting emoji and stickers needs manage_emojis. Images are sent as base64 data URIs. The handshake lists the allowed image types in uploads.
Referring to emoji and stickers
Section titled “Referring to emoji and stickers”Messages and reactions refer to a custom emoji or sticker with a typed link. server_url is the server’s host, such as chat.example.com, without https://:
| Item | Reference |
|---|---|
| Custom emoji | originChats:<emoji>//<server_url>/<emoji_id> |
| Sticker | originChats:<sticker>//<server_url>/<sticker_id> |
A reaction can be a Unicode emoji such as 👍 or a custom emoji reference. The server still accepts the older reaction form originChats://<server_url>/emojis/<emoji_id>, but new clients should send the typed form.
Push notification text shows these references as :name: and [Sticker: name] when they point at this server.
Attachments
Section titled “Attachments”An attachment is a file uploaded over HTTP and then added to a message by ID:
- Upload the file to
/attachments/upload. The response includes the attachment’sid. See upload attachments. - Send
message_newwith that ID inattachments:
{ "cmd": "message_new", "channel": "general", "content": "Screenshot of the bug", "attachments": [{ "id": "c3f0a9e2-7b14-4d6e-9a85-1f2e3d4c5b6a" }]}The server replaces each known ID with the stored attachment details, such as its name, type, size, and URL. A message that refers to an expired attachment is rejected with Attachment <id> not found or expired.
The handshake’s attachments object tells clients whether uploads are on, the size limit, the allowed file types, and how many attachments each account may keep.
Removing attachments
Section titled “Removing attachments”- The uploader, or anyone with
manage_server, can delete an attachment withattachment_delete. - Deleting a message deletes the attachments it refers to.
- Attachments can expire. An expired attachment can’t be downloaded or added to a message.
Operators choose local or S3 storage and image processing in the server configuration.
See also
Section titled “See also”- Server assets for the server icon and banner
- Attachment schema
