Threema Message API
Threema stellt kein grafisches User-Interface für den Threema Gateway zur Verfügung. Das Message API ist eine Schnittstelle, die aus kundenspezifischer Software heraus angesprochen werden kann, um Nachrichten via Threema Gateway zu versenden und zu empfangen.
🔗Container
🔗 fields
Fields
# | Field | Type | Description |
---|---|---|---|
0 | type | u8 | Type of the message.
|
1 | padded-data | b* | Inner message struct. Needs to be parsed according to the Additionally, for security reasons, the total size of Example padding (hex representation):
To add padding without information leaks, run the following steps:
To remove padding:
|
🔗Types
🔗 text
Fields
# | Field | Type | Description |
---|---|---|---|
0 | text | b* | UTF-8 encoded text. |
🔗 file
Fields
# | Field | Type | Description |
---|---|---|---|
0 | file | b* | UTF-8, JSON-encoded object with the following fields:
Metadata object fields depend on the media type of the file. All fields are optional but recommended to set in order to determine the layout logic while the file is being downloaded. Once the file has been parsed, the parsed data supersedes this object. For images:
For audio:
For video:
Note that the rendering logic depends on three key fields which should be set accordingly:
|
🔗 location
Fields
# | Field | Type | Description |
---|---|---|---|
0 | location | b* | Location coordinates and meta information encoded in comma- and line-separated UTF-8:
or
or
Values:
Latitude and longitude must always be present while accuracy is optional and should only be provided when the current location of the device is being sent. These values are comma-separated. Following values are optional and separated by line feeds (
|
🔗 delivery-receipt
Fields
# | Field | Type | Description |
---|---|---|---|
0 | status | u8 | Message status:
The following replacement logic is to be applied on a message's status when displayed:
|
1 | message-ids | u64-le[] | One or more |
🔗 poll-setup
Fields
# | Field | Type | Description |
---|---|---|---|
0 | id | u64-le | Random unique (per creator within this conversation) ID of the poll. |
1 | poll | b* | UTF-8, JSON-encoded object with the following fields:
Choice object fields:
|
🔗 poll-vote
Fields
# | Field | Type | Description |
---|---|---|---|
0 | poll-id | u64-le | ID of the associated poll. |
1 | creator-identity | b8 | The Threema ID of the creator of the poll. |
2 | choices | b* | UTF-8, JSON-encoded list containing one or more choice tuples. Each choice tuple contains the following two integer values:
Note: For protocol simplicity, a vote must always include all possible choices, whether or not they have been selected. |