Chat Lists & Folders

Chat list streaming plus folder and archive/list mutation commands.

Chat Lists & Folder Commands

Chat list streaming plus folder and archive/list mutation commands.

Handler group source

  • Handler module: backend/tg_client/dialogs/commands/handlers/chat_lists.py
  • Registered commands: 11
  • Registry integration: backend/tg_client/dialogs/commands/registry.py

Command index

Command Handler Service / callable Success event(s) Notes
`get_chats` handle_chat_list_commands chat_service.get_chat_items get_chats This is a streaming command. The handler emits one get_chats event per item from resp.result.items and does not send an aggregated list envelope.
`get_recently_opened_chats` handle_chat_list_commands chat_service.get_recent_private_chat_items get_recently_opened_chats This is a streaming command. The handler emits one get_recently_opened_chats event per normalized item and does not send an aggregated list envelope.
`create_chat_folder` handle_chat_list_commands chat_list_service.create_chat_folder create_chat_folder single logical response
`get_chats_for_chat_folder_invite_link` handle_chat_list_commands chat_list_service.get_chats_for_chat_folder_invite_link get_chats_for_chat_folder_invite_link single logical response
`get_chat_folder_invite_links` handle_chat_list_commands chat_list_service.get_chat_folder_invite_links get_chat_folder_invite_links single logical response
`create_chat_folder_invite_link` handle_chat_list_commands chat_list_service.create_chat_folder_invite_link create_chat_folder_invite_link single logical response
`delete_chat_folder` handle_chat_list_commands chat_list_service.delete_chat_folder delete_chat_folder single logical response
`chat_in_folder` handle_chat_list_commands chat_list_service.chat_in_folder chat_in_folder single logical response
`archive_chat` handle_chat_list_commands chat_list_service.archive_chat archive_chat single logical response
`unarchive_chat` handle_chat_list_commands chat_list_service.unarchive_chat unarchive_chat single logical response
`pin_chat` handle_chat_list_commands chat_list_service.pin_chat pin_chat single logical response

Group conventions

  • Incoming client requests use the WebSocket action field and are routed into the owner runtime via publish_command().
  • Outbound success/error payloads are wrapped into chat_update live events.
  • ctx.send_response() means one logical success event plus a conventional <command>_error event on failure.
  • Manual ctx.send() branches indicate streaming or custom event emission; these commands are documented explicitly below.
  • Request field types and required flags are inferred from handler/service code because there is no formal request schema object for every command.

Command: get_chats

Summary

Stream normalized chat-list items for the requested list and offset.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 26).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_service.py::get_chat_items.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/dialogs.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.

Request

Structure

{
  "action": "get_chats",
  "userbot_id": 1,
  "limit": 100,
  "chat_list": {
    "@type": "chatListMain"
  }
}

Request variants

  • Use chat_list as a raw TDLib list discriminator, for example {"@type": "chatListMain"} or the string chatListMain.

Parameters

Field Type Required Default Description
limit integer optional 1000 Derived from handler payload access in current code.
offset_order `integer string` optional Derived from handler payload access in current code.
offset_chat_id integer optional Derived from handler payload access in current code.
chat_list `string object` optional Accepts a TDLib-style object or a raw @type string such as chatListMain.

Response variants

  • Success event(s): get_chats.
  • Error event(s): get_chats_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.
  • Notes: This is a streaming command. The handler emits one get_chats event per item from resp.result.items and does not send an aggregated list envelope.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "get_chats",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
TDLib / service error string Raw API call fails or the service returns a transport-shaped error Forwarded from TdlibBaseClient.tg_call() or the service layer.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes get_chats.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_service.py::get_chat_items.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/dialogs.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Command: get_recently_opened_chats

Summary

Stream recently opened private-chat items after service-side filtering and normalization.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 41).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_service.py::get_recent_private_chat_items.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/dialogs.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.

Request

Structure

{
  "action": "get_recently_opened_chats",
  "userbot_id": 1,
  "limit": 20
}

Parameters

Field Type Required Default Description
limit integer optional 20 Derived from handler payload access in current code.

Response variants

  • Success event(s): get_recently_opened_chats.
  • Error event(s): get_recently_opened_chats_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.
  • Notes: This is a streaming command. The handler emits one get_recently_opened_chats event per normalized item and does not send an aggregated list envelope.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "get_recently_opened_chats",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
TDLib / service error string Raw API call fails or the service returns a transport-shaped error Forwarded from TdlibBaseClient.tg_call() or the service layer.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes get_recently_opened_chats.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_service.py::get_recent_private_chat_items.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/dialogs.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Command: create_chat_folder

Summary

Create chat folder.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 53).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::create_chat_folder.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "create_chat_folder",
  "userbot_id": 1,
  "title": "Product Team",
  "icon_name": "Book",
  "color_id": 7,
  "pinned_chat_ids": [
    1,
    2
  ],
  "included_chat_ids": [
    1,
    2
  ]
}

Parameters

Field Type Required Default Description
title string required Derived from handler payload access in current code.
icon_name string optional Derived from handler payload access in current code.
color_id integer optional Derived from handler payload access in current code.
is_shareable boolean optional false Derived from handler payload access in current code.
pinned_chat_ids array<integer> optional Derived from handler payload access in current code.
included_chat_ids array<integer> optional Derived from handler payload access in current code.
excluded_chat_ids array<integer> optional Derived from handler payload access in current code.
include_contacts boolean optional false Derived from handler payload access in current code.
include_non_contacts boolean optional false Derived from handler payload access in current code.
include_bots boolean optional false Derived from handler payload access in current code.
include_groups boolean optional false Derived from handler payload access in current code.
include_channels boolean optional false Derived from handler payload access in current code.
exclude_muted boolean optional false Derived from handler payload access in current code.
exclude_read boolean optional false Derived from handler payload access in current code.
exclude_archived boolean optional false Derived from handler payload access in current code.

Response variants

  • Success event(s): create_chat_folder.
  • Error event(s): create_chat_folder_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "create_chat_folder",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
title is required string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes create_chat_folder.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::create_chat_folder.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Summary

Get chats for chat folder invite link.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 74).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::get_chats_for_chat_folder_invite_link.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "get_chats_for_chat_folder_invite_link",
  "userbot_id": 1,
  "chat_folder_id": 2
}

Parameters

Field Type Required Default Description
chat_folder_id integer required Derived from handler payload access in current code.

Response variants

  • Success event(s): get_chats_for_chat_folder_invite_link.
  • Error event(s): get_chats_for_chat_folder_invite_link_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "get_chats_for_chat_folder_invite_link",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_folder_id is required string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes get_chats_for_chat_folder_invite_link.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::get_chats_for_chat_folder_invite_link.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Summary

Get chat folder invite links.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 81).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::get_chat_folder_invite_links.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "get_chat_folder_invite_links",
  "userbot_id": 1,
  "chat_folder_id": 2
}

Parameters

Field Type Required Default Description
chat_folder_id integer required Derived from handler payload access in current code.

Response variants

  • Success event(s): get_chat_folder_invite_links.
  • Error event(s): get_chat_folder_invite_links_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "get_chat_folder_invite_links",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_folder_id is required string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes get_chat_folder_invite_links.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::get_chat_folder_invite_links.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Summary

Create chat folder invite link.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 88).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::create_chat_folder_invite_link.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "create_chat_folder_invite_link",
  "userbot_id": 1,
  "chat_folder_id": 2,
  "name": "Invite link",
  "chat_ids": [
    1,
    2
  ]
}

Parameters

Field Type Required Default Description
chat_folder_id integer required Derived from handler payload access in current code.
name string optional Derived from handler payload access in current code.
chat_ids array<integer> optional Derived from handler payload access in current code.

Response variants

  • Success event(s): create_chat_folder_invite_link.
  • Error event(s): create_chat_folder_invite_link_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "create_chat_folder_invite_link",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_folder_id is required string Service-side validation or branch guard Returned as the error field of the error event.
chat_ids must contain at least one valid chat id string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes create_chat_folder_invite_link.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::create_chat_folder_invite_link.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Command: delete_chat_folder

Summary

Delete chat folder.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 97).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::delete_chat_folder.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "delete_chat_folder",
  "userbot_id": 1,
  "chat_folder_id": 2,
  "leave_chat_ids": [
    1,
    2
  ]
}

Parameters

Field Type Required Default Description
chat_folder_id integer required Derived from handler payload access in current code.
leave_chat_ids array<integer> optional Derived from handler payload access in current code.

Response variants

  • Success event(s): delete_chat_folder.
  • Error event(s): delete_chat_folder_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "delete_chat_folder",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_folder_id is required string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes delete_chat_folder.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::delete_chat_folder.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, chat_in_folder, archive_chat, unarchive_chat, pin_chat.

Command: chat_in_folder

Summary

Chat in folder.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 105).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::chat_in_folder.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "chat_in_folder",
  "userbot_id": 1,
  "chat_ids": [
    1,
    2
  ],
  "chat_folder_id": 2
}

Parameters

Field Type Required Default Description
chat_ids array<integer> optional Derived from handler payload access in current code.
chat_folder_id integer required Derived from handler payload access in current code.
added boolean optional true Derived from handler payload access in current code.
removed boolean optional false Derived from handler payload access in current code.
pin boolean optional false Derived from handler payload access in current code.
unpin boolean optional false Derived from handler payload access in current code.

Response variants

  • Success event(s): chat_in_folder.
  • Error event(s): chat_in_folder_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "chat_in_folder",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_ids must be a non-empty list string Validation of TDLib-style input payload Returned as the error field of the error event.
chat_folder_id is required string Service-side validation or branch guard Returned as the error field of the error event.
TDLib / transport error string Raw API call fails or TDLib raises in the transport wrapper Forwarded from TdlibBaseClient.tg_call() or returned by the service.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes chat_in_folder.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::chat_in_folder.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, archive_chat, unarchive_chat, pin_chat.

Command: archive_chat

Summary

Archive chat.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 117).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::archive_chat.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "archive_chat",
  "userbot_id": 1,
  "chat_id": -1001234567890
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.

Response variants

  • Success event(s): archive_chat.
  • Error event(s): archive_chat_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "archive_chat",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
TDLib / service error string Raw API call fails or the service returns a transport-shaped error Forwarded from TdlibBaseClient.tg_call() or the service layer.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes archive_chat.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::archive_chat.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, unarchive_chat, pin_chat.

Command: unarchive_chat

Summary

Unarchive chat.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 122).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::unarchive_chat.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "unarchive_chat",
  "userbot_id": 1,
  "chat_id": -1001234567890
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.

Response variants

  • Success event(s): unarchive_chat.
  • Error event(s): unarchive_chat_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "unarchive_chat",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
TDLib / service error string Raw API call fails or the service returns a transport-shaped error Forwarded from TdlibBaseClient.tg_call() or the service layer.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes unarchive_chat.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::unarchive_chat.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, pin_chat.

Command: pin_chat

Summary

Pin chat.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/chat_lists.py::handle_chat_list_commands (branch starts near line 127).
  • Service: backend/tg_client/dialogs/tdlib/services/chat_list_service.py::pin_chat.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Normalizer / typed builder: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.

Request

Structure

{
  "action": "pin_chat",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "chat_list": {
    "@type": "chatListMain"
  }
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
is_pinned boolean optional true Derived from handler payload access in current code.
chat_list `string object` optional Accepts a TDLib-style object or a raw @type string such as chatListMain.

Response variants

  • Success event(s): pin_chat.
  • Error event(s): pin_chat_error.
  • Result shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "pin_chat",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
TDLib / service error string Raw API call fails or the service returns a transport-shaped error Forwarded from TdlibBaseClient.tg_call() or the service layer.

Flow

  • TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
  • AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
  • Registry handler handle_chat_list_commands processes pin_chat.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/chat_list_service.py::pin_chat.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/chat_lists.py, backend/tg_client/dialogs/tdlib/api/chats.py.
  • Result normalization / shaping: backend/tg_client/dialogs/tdlib/normalizers/chat_list_normalizer.py, backend/tg_client/dialogs/tdlib/normalizers/chat_item_normalizer.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: get_chats, get_recently_opened_chats, create_chat_folder, get_chats_for_chat_folder_invite_link, get_chat_folder_invite_links, create_chat_folder_invite_link, delete_chat_folder, chat_in_folder, archive_chat, unarchive_chat.