Sticker Messages
This module allows users to send sticker messages in to rooms or direct messaging sessions.
Sticker messages are specialised image messages that are displayed without controls (e.g. no “download” link, or light-box view on click, as would be displayed for for m.image events).
Sticker messages are intended to provide simple “reaction” events in the message timeline. The matrix client should provide some mechanism to display the sticker “body” e.g. as a tooltip on hover, or in a modal when the sticker image is clicked.
Events
Sticker events are received as a single m.sticker event in the
timeline section of a room, in a /sync.
m.sticker
This message represents a single sticker image.
m.sticker
| Event type: | Message event |
|---|
Content
| Name | Type | Description |
|---|---|---|
body |
string |
Required: A textual representation or associated description of the sticker image. This could be the alt text of the original image, or a message to accompany and further describe the sticker. |
info |
ImageInfo |
Required: Metadata about the image referred to in url including a thumbnail
representation. |
url |
string |
Required: The URL to the sticker image. This must be a valid mxc:// URI. |
| Name | Type | Description |
|---|---|---|
h |
integer |
The intended display height of the image in pixels. This may differ from the intrinsic dimensions of the image file. |
mimetype |
string |
The mimetype of the image, e.g. image/jpeg. |
size |
integer |
Size of the image in bytes. |
thumbnail_file |
EncryptedFile |
Information on the encrypted thumbnail file, as specified in End-to-end encryption. Only present if the thumbnail is encrypted. |
thumbnail_info |
ThumbnailInfo |
Metadata about the image referred to in thumbnail_url. |
thumbnail_url |
string |
The URL (typically MXC URI) to a thumbnail of the image. Only present if the thumbnail is unencrypted. |
w |
integer |
The intended display width of the image in pixels. This may differ from the intrinsic dimensions of the image file. |
| Name | Type | Description |
|---|---|---|
h |
integer |
The intended display height of the image in pixels. This may differ from the intrinsic dimensions of the image file. |
mimetype |
string |
The mimetype of the image, e.g. image/jpeg. |
size |
integer |
Size of the image in bytes. |
w |
integer |
The intended display width of the image in pixels. This may differ from the intrinsic dimensions of the image file. |
Examples
{
"content": {
"body": "Landing",
"info": {
"h": 200,
"mimetype": "image/png",
"size": 73602,
"thumbnail_info": {
"h": 200,
"mimetype": "image/png",
"size": 73602,
"w": 140
},
"thumbnail_url": "mxc://matrix.org/sHhqkFCvSkFwtmvtETOtKnLP",
"w": 140
},
"url": "mxc://matrix.org/sHhqkFCvSkFwtmvtETOtKnLP"
},
"event_id": "$143273582443PhrSn:example.org",
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"type": "m.sticker",
"unsigned": {
"age": 1234
}
}
Client behaviour
Clients supporting this message type should display the image content from the event URL directly in the timeline.
A thumbnail image should be provided in the info object. This is
largely intended as a fallback for clients that do not fully support the
m.sticker event type. In most cases it is fine to set the thumbnail
URL to the same URL as the main event content.
It is recommended that sticker image content should be 512x512 pixels in
size or smaller. The dimensions of the image file should be twice the
intended display size specified in the info object in order to assist
rendering sharp images on higher DPI screens.