Message

Primary builder:

Types: Message

Message item

Primary builder:

  • backend/tg_client/dialogs/domain/message.py
  • backend/tg_client/dialogs/domain/message_components.py
  • backend/tg_client/dialogs/domain/message_sender_components.py

Used by:

  • open_dialog
  • search results
  • live updates
  • last-message blocks in chat items
  • message references in reply/forward payloads

Example shape:

{
  "chat": {
    "id": -1001234567890,
    "title": "Product Team"
  },
  "sender": {
    "id": 777000,
    "kind": "messageSenderUser",
    "profile": {
      "first_name": "Ihor",
      "last_name": "Petrenko",
      "full_name": "Ihor Petrenko",
      "username": "ihor"
    },
    "presence": {
      "status": "online",
      "last_seen": "online"
    },
    "avatar_file_id": 123456,
    "avatar_remote_file_id": "asdj48usdj",
    "avatar": {
      "kind": "messagePhoto",
      "file_id": 123456,
      "remote_file_id": "asdj48usdj"
    }
  },
  "message": {
    "id": 99112233,
    "chat_id": -1001234567890,
    "thread_id": 555001,
    "album_id": null,
    "text": "invoice.pdf",
    "kind": "messageDocument",
    "date_display": "30.03.2026 14:22",
    "is_outgoing": false,
    "is_read": true,
    "status": "read",
    "content": [],
    "entities": [],
    "edit": null,
    "reply": null,
    "forward": null,
    "reactions": {
      "can_see_list": true,
      "items": [],
      "unread": []
    },
    "interaction": null
  }
}

Reply payload

message.reply is built from reply_to metadata and may include:

  • kind
  • chat_id
  • message_id
  • story_id
  • origin_chat_id
  • is_quote
  • quote
  • message (typed message reference)
  • from
  • media

Forward payload

message.forward includes:

  • kind
  • origin_type
  • date_unix
  • has_caption
  • settings
  • source
  • shortcut fields such as source_user_id, source_chat_id, source_message_id, source_title

forward.source carries avatar refs for user/chat/channel origins when the underlying source has a resolvable photo.

Message search result

Search normalizer:

  • backend/tg_client/dialogs/tdlib/normalizers/message_result_normalizer.py

Search result shape contains paging metadata plus messages: [Message Item].

Message command result

Mutation commands like send_message, edit_message, pin_message, set_reaction usually return either:

  • raw TDLib-like {"@type":"ok"} payloads, or
  • service-assembled result arrays (forward_message, multi-reaction path)

These commands do not currently share one dedicated schema class.