API Reference Guide
API Reference Guide
Envelope
Each message received as an event (notification sendMessage), loaded by message ID (getMessageById), or obtained from the chat message history (getChatHistory), corresponds to an Envelope object.
The payload field of the sendMessage notification is an Envelope object — the examples below show it without the request wrapper.
interface Envelope {
chat: Chat;
chatId?: string;
messageId: string;
timestamp: number;
replyMessage?: Envelope;
replyMessageId?: string;
isEdited: boolean;
type: EnvelopeContentType;
author: EnvelopeAuthor;
box: EnvelopeBox;
content: AbstractEnvelopeContent;
}Envelope Fields
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| chat | Chat | Yes | Information about the chat where the message is located. For more details, see Chat. |
| chatId | string | No | Deprecated in 5.5.6 Unique chat identifier where the message is located. Use the chat.chatId field. |
| messageId | string | Yes | Unique message identifier |
| timestamp | uint64 | Yes | Timestamp of message sent in UNIX timestamp format with millisecond precision |
| replyMessage | Envelope | No | The original message if the current message is a reply. It is structured similarly to a regular message. For examples, see the section “Envelope Examples”. |
| replyMessageId | string | No | The identifier of the original message, if the current message is a reply. |
| isEdited | boolean | Yes | Has the message ever been edited |
| type | uint32 | Yes | Message type. See more at EnvelopeContentType |
| author.id | string | Yes | Unique message author's identifier: the user's TrueConf ID or the name of the server from which the message was received. The identifier format is determined by the author.type field. |
| author.type | uint32 | Yes | Message author type. For more details, see EnvelopeAuthorTypeEnum. |
| box.id | number | Yes | The serial number of the "box" containing the message. For more details, see the relevant section. |
| box.position | string | Yes | Message sequence number in the "box". For more details, see the relevant section. |
| content | AbstractEnvelopeContent | Yes | Message content. The set of fields depends on the type value. See AbstractEnvelopeContent and examples for more details. |
Chat
The object contains information about the chat where the message is located:
interface Chat {
chatId: string;
chatTitle: string | null;
chatType: ChatTypeEnum;
}| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| chatId | string | Yes | Unique chat ID |
| chatTitle | *строка | null* | Yes |
| chatType | ChatTypeEnum | Yes | Chat type. See ChatTypeEnum for more details. |
EnvelopeAuthor
The object contains information about the message author:
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| id | string | Yes | Unique identifier of the message author. This can be either the TrueConf ID of the user who sent the message or the name of the server from which it was sent. The type of identifier depends on the value of the type field. |
| type | uint32 | Yes | Message author type. For more details, see EnvelopeAuthorTypeEnum. |
EnvelopeBox
This object is used for sorting messages.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| id | number | Yes | The serial number of the "box" containing the message |
| position | string | Yes | Sequential message number in the "box" |
You can learn how to work with this object in the corresponding section.
AbstractEnvelopeContent
Basic interface for message content:
interface AbstractEnvelopeContent {}The interface does not contain any proprietary fields. The actual composition of the content object is determined by the value of the Envelope.type field from the EnvelopeContentType enumeration. A separate interface is used for each message type:
The value of Envelope.type | Content Interface |
|---|---|
| System messages | |
ADD_PARTICIPANT | AddParticipantContent |
REMOVE_PARTICIPANT | RemoveParticipantContent |
EDIT_CHAT_TITLE | EditChatTitleContent |
EDIT_CHAT_AVATAR | EditChatAvatarContent |
CLEAR_CHAT_HISTORY | ClearChatHistoryContent |
PARTICIPANT_ROLE | ParticipantRoleContent |
| Custom messages | |
PLAIN_MESSAGE | PlainMessageContent |
FORWARDED_MESSAGE | ForwardMessageContent |
ATTACHMENT | AttachmentContent |
GEOLOCATION | GeolocationContent |
| ОПРОС | SurveyContent |
VOICE | VoiceContent |
AddParticipantContent
Content of the system message about adding a participant to the chat (ADD_PARTICIPANT):
interface AddParticipantContent extends AbstractEnvelopeContent {
userId: string;
role: ChatParticipantRoleEnum;
}Example content:
{
"userId": "user@video.example.net",
"role": "user"
}RemoveParticipantContent
Content of the system message about removing a participant from the chat (REMOVE_PARTICIPANT):
interface RemoveParticipantContent extends AbstractEnvelopeContent {
userId: string;
}Example content:
{
"userId": "user@video.example.net"
}EditChatTitleContent
Content of the system message about changing the chat title (EDIT_CHAT_TITLE):
interface EditChatTitleContent extends AbstractEnvelopeContent {
title: string;
}Example content:
{
"title": "New chat name"
}EditChatAvatarContent
Content of the system message about changing the chat image (EDIT_CHAT_AVATAR):
interface EditChatAvatarContent extends AbstractEnvelopeContent {
avatarUrl: string | null;
}The null value indicates that the chat image has been deleted.
Example content:
{
"avatarUrl": "https://video.example.net/bridge/api/client/v1/message/123/preview"
}ClearChatHistoryContent
Content of the system message about clearing chat history (CLEAR_CHAT_HISTORY):
interface ClearChatHistoryContent extends AbstractEnvelopeContent {
forAll: boolean;
}The forAll field indicates whether the history has been cleared for all chat participants.
Example content:
{
"forAll": true
}ParticipantRoleContent
Content of the system message about participant role change (PARTICIPANT_ROLE):
interface ParticipantRoleContent extends AbstractEnvelopeContent {
userId: string;
role: ChatParticipantRoleEnum;
}Example content:
{
"userId": "user@video.example.net",
"role": "admin"
}PlainMessageContent
Text message content (PLAIN_MESSAGE):
interface PlainMessageContent extends AbstractEnvelopeContent {
text: string;
parseMode: TextParseModeEnum;
buttons?: object[][];
}The buttons field contains rows of inline buttons and is present only in messages with buttons.
Example content:
{
"text": "New message",
"parseMode": "html"
}ForwardMessageContent
Content of the forwarded message (FORWARDED_MESSAGE):
interface ForwardMessageContent
extends Omit<Envelope, "box">, AbstractEnvelopeContent {}The interface complies with the Envelope object, excluding the box field.
Example content:
{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"messageId": "2969b905-30ac-4db3-958e-e437f23493eb",
"timestamp": 1790085027947,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"type": 200,
"content": {
"text": "Forwarded message",
"parseMode": "html"
},
"isEdited": false
}AttachmentContent
Message content with an attached file (ATTACHMENT):
interface AttachmentContent extends AbstractEnvelopeContent {
name: string;
mimeType: string;
fileId: string;
size: number;
}Example content:
{
"name": "image.webp",
"mimeType": "image/webp",
"fileId": "8e756a04793267fe75695006d891ec487fe4c685",
"size": 37856
}GeolocationContent
Message content with geolocation (GEOLOCATION):
interface GeolocationContent extends AbstractEnvelopeContent {
latitude: number;
longitude: number;
title: string;
}Example content:
{
"latitude": 47.227208,
"longitude": 39.70418,
"title": "Rostov-on-Don"
}SurveyContent
Content of the survey message (SURVEY):
interface SurveyContent extends AbstractEnvelopeContent {
url: string;
title: string;
path?: string;
description?: string;
buttonText?: string;
appVersion?: number;
secret?: string;
alt?: string;
}Example content:
{
"url": "https://video.example.net/webtools/survey?id=FVxLn7LxrVsDh2zCoLkfq7",
"appVersion": 1,
"path": "FVxLn7LxrVsDh2zCoLkfq7",
"title": "📊 Survey",
"description": "{{Survey}}",
"buttonText": "{{Go to survey}}",
"secret": "xPlNHP1Okj",
"alt": "📊 Survey"
}VoiceContent
Voice message content (VOICE):
interface VoiceContent extends AbstractEnvelopeContent {
mimeType: string;
fileId: string;
size: number;
duration: number;
}The duration field contains the length of the voice message in milliseconds.
Example content:
{
"mimeType": "voice/m4a",
"fileId": "afc3cd19a480f22243afda3efe15ca4db0775f52",
"size": 20277,
"duration": 5043
}Examples of Envelope
Below are examples of the payload object (Envelope) for different message types. The examples are shown without the sendMessage request wrapper.
{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "222598d7-9ef9-4663-87e0-8e30804bdb22",
"timestamp": 1790779432327,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 114,
"position": "0"
},
"type": 200,
"content": {
"text": "New message",
"parseMode": "html"
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "4c35b267-7a92-4afe-ad4d-cbc8c40b4480",
"timestamp": 1790779557450,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"replyMessage": {
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "222598d7-9ef9-4663-87e0-8e30804bdb22",
"timestamp": 1790779549593,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 120,
"position": "0"
},
"type": 200,
"content": {
"text": "New message",
"parseMode": "html"
},
"isEdited": true
},
"replyMessageId": "222598d7-9ef9-4663-87e0-8e30804bdb22",
"box": {
"id": 121,
"position": "0"
},
"type": 200,
"content": {
"text": "reply to the message",
"parseMode": "html"
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "ebfc1f38-7196-418c-9332-0b0841d6f26b",
"timestamp": 1790780970049,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 123,
"position": "0"
},
"type": 200,
"content": {
"text": "message text",
"parseMode": "html",
"buttons": [
[
{
"type": "command",
"label": "Send command to bot 1!",
"command": "my_awesome_command",
"waitReply": false
},
{
"type": "command",
"id": "button_98",
"label": "Add product to cart",
"command": "add_to_cart",
"customData": "eyBwcm9kdWN0SWQgOiAiMHIyZmozamY5ajM5MyIgfQ==",
"waitReply": true
},
{
"type": "url",
"label": "Open site",
"style": "primary",
"url": "https://trueconf.com"
}
],
[
{
"type": "copy",
"label": "Copy promo code",
"style": "danger",
"data": "PROMOCODE-12345"
},
{
"type": "message",
"label": "Send greeting",
"message": "Hello, colleagues!",
"draft": false
}
]
]
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "03a9a955-d563-4b90-a3ef-1c7c43869ddd",
"timestamp": 1790781149722,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 124,
"position": "0"
},
"type": 201,
"content": {
"chat": {
"chatType": 2,
"chatTitle": "12",
"chatId": "cc1f6a2fe9cc9c0c47de18877676e59dd672e800"
},
"chatId": "cc1f6a2fe9cc9c0c47de18877676e59dd672e800",
"messageId": "2969b905-30ac-4db3-958e-e437f23493eb",
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"type": 201,
"timestamp": 1790085027947,
"content": {
"text": "<a href=\"trueconf:john_doe@video.example.net\">John Doe</a> how are you?",
"parseMode": "html"
},
"isEdited": false
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "dee7d14a-8fe0-408d-a79a-d80bbf144409",
"timestamp": 1790779456960,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 115,
"position": "0"
},
"type": 202,
"content": {
"name": "image_2026-09-30_17-44-18-229.webp",
"mimeType": "image/webp",
"fileId": "8e756a04793267fe75695006d891ec487fe4c685",
"size": 37856
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "8be3ba5b-e109-44f8-82ab-6153dc2f9d34",
"timestamp": 1790781235755,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 125,
"position": "0"
},
"type": 203,
"content": {
"latitude": 37.4220,
"longitude": -122.0841,
"title": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA"
},
"isEdited": false
}{
"chat": {
"chatId": "05de1dea14c737876e88c9156a08c3a934df502e",
"chatTitle": "12",
"chatType": 2
},
"chatId": "05de1dea14c737876e88c9156a08c3a934df502e",
"messageId": "a340ef6f-8220-49a0-9552-c0fe10ddda00",
"timestamp": 1790781276869,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 9,
"position": "0"
},
"type": 204,
"content": {
"url": "https://10.140.1.255/webtools/survey?id=FVxLn7LxrVsDh2zCoLkfq7&mode=popup&call_id=danilov%40video.example.net%2F4fd7f634&lang=en&version=unknown&app=BRIDGE_CHAT_BOT&dn=%D0%92%D0%B8%D0%BA%D1%82%D0%BE%D1%80+%D0%94%D0%B0%D0%BD%D0%B8%D0%BB%D0%BE%D0%B2&msg_id=a340ef6f-8220-49a0-9552-c0fe10ddda00&s=dccb0e511f4054b7c4e91218d1270211",
"appVersion": 1,
"path": "FVxLn7LxrVsDh2zCoLkfq7",
"title": "📊 Survey",
"description": "{{Survey}}",
"buttonText": "{{Go to survey}}",
"secret": "xPlNHP1Okj",
"alt": "📊 <a href=\"https://10.140.1.255/webtools/survey?id=FVxLn7LxrVsDh2zCoLkfq7&error=autologin_not_supported\">Survey</a>"
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "db070005-82ec-4e5c-a3d7-cd1128b8784b",
"timestamp": 1790779507571,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 117,
"position": "0"
},
"type": 205,
"content": {
"mimeType": "voice/m4a",
"fileId": "afc3cd19a480f22243afda3efe15ca4db0775f52",
"size": 20277,
"duration": 5043
},
"isEdited": false
}{
"chat": {
"chatId": "05de1dea14c737876e88c9156a08c3a934df502e",
"chatTitle": "12",
"chatType": 2
},
"chatId": "05de1dea14c737876e88c9156a08c3a934df502e",
"messageId": "7fd1edbf-01e9-4e6f-8932-89e478e62804",
"timestamp": 1790781014314,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 3,
"position": "0"
},
"type": 1,
"content": {
"userId": "john_doe@video.example.net",
"role": "user"
},
"isEdited": false
}{
"chat": {
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"chatTitle": "elisa@video.example.net",
"chatType": 1
},
"chatId": "55f940ecdc66e2c983f8fbd1f954ba72db7d3e9d",
"messageId": "222598d7-9ef9-4663-87e0-8e30804bdb22",
"timestamp": 1790779432327,
"author": {
"id": "elisa@video.example.net",
"type": 1
},
"box": {
"id": 114,
"position": "0"
},
"type": 200,
"content": {
"text": "New message (edited)",
"parseMode": "html"
},
"isEdited": true
}Enums
ChatTypeEnum
The enumeration contains possible chat types.
enum ChatTypeEnum {
UNDEF = 0,
P2P = 1,
GROUP = 2,
SYSTEM = 3,
FAVORITES = 5,
CHANNEL = 6
}where:
UNDEF- unknown chat typeP2P- personal messages (chat with another user)GROUP- group chatSYSTEM- system chatFAVORITES- "Favorites" chat (saved messages)CHANNEL- channel
EnvelopeContentType
Using this enumeration, you can determine the type of content in the message.
enum EnvelopeContentType {
ADD_PARTICIPANT = 1,
REMOVE_PARTICIPANT = 2,
EDIT_CHAT_TITLE = 21,
EDIT_CHAT_AVATAR = 22,
CLEAR_CHAT_HISTORY = 23,
PARTICIPANT_ROLE = 110,
PLAIN_MESSAGE = 200,
FORWARDED_MESSAGE = 201,
ATTACHMENT = 202,
GEOLOCATION = 203,
SURVEY = 204,
VOICE = 205
}System Messages (Events)
System messages are used for logging and visually accompanying events in the chat history. They are defined by a type < 200 value. You can read more in the relevant section of the documentation.
| Message Type | Value | Description |
|---|---|---|
| ADD_PARTICIPANT | 1 | User added to chat |
| REMOVE_PARTICIPANT | 2 | User removed from chat |
| EDIT_CHAT_TITLE | 21 | 5.5.3+ Chat name changed |
| EDIT_CHAT_AVATAR | 22 | 5.5.3+ Chat image changed |
| CLEAR_CHAT_HISTORY | 23 | 5.5.3+ Chat history deleted |
User messages
User messages are generated by clients and transmitted in the general chat message stream. They are identified by a type ≥ 200 value.
| Message Type | Value | Description |
|---|---|---|
| PLAIN_MESSAGE | 200 | Text message |
| FORWARDED_MESSAGE | 201 | Forwarded message |
| ATTACHMENT | 202 | Message with information about the attached file |
| GEOLOCATION | 203 | 5.5.3+ A message containing the user's geolocation (can be sent from the mobile client application) |
| SURVEY | 204 | Poll message |
| ГОЛОС | 205 | 5.5.6+ Voice message |
EnvelopeAuthorTypeEnum
enum EnvelopeAuthorTypeEnum {
SYSTEM,
USER,
}SYSTEM- the message is authored by the server. In most cases, this indicates that the message is a system message. The server identifier (TrueConf Server Name) will be used as the author's identifier.USER– the author of the message is a server user. The TrueConf ID of this user will be used as the author's identifier.
ChatParticipantRoleEnum
The enumeration contains a list of possible participant roles in a chat:
enum ChatParticipantRoleEnum {
OWNER = "owner",
ADMIN = "admin",
USER = "user",
CONF_OWNER = "conf_owner",
CONF_MODERATOR = "conf_moderator",
FAVORITES_OWNER = "favorites_owner",
WRITER = "writer"
}where:
OWNER- chat owner;ADMIN- designated chat administrator;USER- regular chat participant;CONF_OWNER- this role is only present in conference chats and indicates that the user is the conference owner;CONF_MODERATOR- this role is present only in conference chats and indicates that the user is a conference moderator;FAVORITES_OWNER- this role is only available in the "Favorites" chat (Saved messages).WRITER- this role is only present in the channel and indicates that the user can write messages in the channel.
You can find a description of the permissions for each role in a separate section.
TextParseModeEnum
This enumeration is used to specify the mode for processing the text content of messages.
enum TextParseModeEnum {
TEXT = "text",
MARKDOWN = "markdown",
HTML = "html",
}where:
TEXT– the message content will be processed as text. All HTML tags will be escaped (converted to HTML entities).MARKDOWN- the content will be processed as markdown. The list of supported markdown rules is provided below.HTML– the content will be processed as HTML. The list of supported HTML tags is provided below.
ChatActivity
This enumeration is used to convey chatbot activity actions.
The provided text is already in English, and no localization is required.where:
TYPING– "Typing";CHOOSING_STICKER– "Choosing a sticker";RECORDING_AUDIO– "Recording audio message";RECORDING_VIDEO– "Recording a video message";UPLOADING_FILE– "Uploads a file".
FileReadyStateEnum
This enumeration is used to indicate the status of a file on the server.
enum FileReadyStateEnum {
NOT_AVAILABLE = 0,
UPLOADING = 1,
READY = 2
}where:
NOT_AVAILABLE– the file has been removed due to quota restrictions, storage time, etc.;UPLOADING– the file is being uploaded;READY– file uploaded.
MESSAGE_TYPE
There are three types of messages:
enum MESSAGE_TYPE {
RESERVED = 0,
REQUEST = 1,
RESPONSE = 2
}Only REQUEST and RESPONSE are applicable.
OAUTH_ERROR
Error codes, according to the OAuth 2.0 specification, are presented as ASCII strings from the list specified in the specification. The following error codes are supported:
enum OAUTH_ERROR {
INVALID_REQUEST = "invalid_request",
INVALID_CLIENT = "invalid_client",
INVALID_GRANT = "invalid_grant",
UNSUPORTED_GRANT_TYPE = "unsupported_grant_type"
}| Error code | Value | Description |
|---|---|---|
invalid_request | Bad Request | The request headers or body are incorrectly formatted. For instance, required fields might be missing or the Content-Type header might be incorrect. |
invalid_client | Invalid client | The value of the client_id field differs from the acceptable one (for example, it is not equal to chat_bot). |
invalid_grant | Invalid authentication data | The user with the specified login was not found, or the password is incorrect. |
unsupported_grant_type | Incorrect authentication type | The value of the grant_type field differs from the allowed one (e.g., it is not equal to password). |