Profile & Bootstrap Commands
Profile mutation, self-profile sync, chat bootstrap, and contact import commands.
Handler group source
- Handler module:
backend/tg_client/dialogs/commands/handlers/profile.py
- Registered commands:
11
- Registry integration:
backend/tg_client/dialogs/commands/registry.py
Command index
| Command |
Handler |
Service / callable |
Success event(s) |
Notes |
| `refresh_self_profile` |
handle_profile_commands |
sync_userbot_self_profile |
refresh_self_profile |
This command bypasses the usual TdlibFacade service list and calls sync_userbot_self_profile(...) directly through sync_to_async(...). |
| `get_user` |
handle_profile_commands |
profile_service.get_user_profile |
get_user |
single logical response |
| `set_name` |
handle_profile_commands |
profile_service.set_name |
set_name |
single logical response |
| `set_bio` |
handle_profile_commands |
profile_service.set_bio |
set_bio |
single logical response |
| `set_username` |
handle_profile_commands |
profile_service.set_username |
set_username |
single logical response |
| `set_birthdate` |
handle_profile_commands |
profile_service.set_birthdate |
set_birthdate |
single logical response |
| `get_chat_profile` |
handle_profile_commands |
profile_service.get_chat_profile |
get_chat_profile |
single logical response |
| `search_user` |
handle_profile_commands |
bootstrap_service.search_user |
search_user |
single logical response |
| `create_private_chat` |
handle_profile_commands |
bootstrap_service.create_private_chat |
create_private_chat |
single logical response |
| `create_supergroup_chat` |
handle_profile_commands |
bootstrap_service.create_supergroup_chat |
create_supergroup_chat |
single logical response |
| `import_contacts` |
handle_profile_commands |
bootstrap_service.import_contacts |
import_contacts |
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: refresh_self_profile
Summary
Refresh and persist the current userbot self profile by calling TDLib directly and syncing the result into the UserBot model.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 27).
- Direct callable:
backend/tg_client/dialogs/services/userbot_profile_sync.py::sync_userbot_self_profile.
- Supporting modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/services/file_service.py, backend/tg_client/dialogs/tdlib/normalizers/self_profile_normalizer.py.
- Direct callable:
backend/tg_client/dialogs/services/userbot_profile_sync.py::sync_userbot_self_profile.
- Persistence target:
backend/tg_client/models.py::UserBot.
Request
Structure
{
"action": "refresh_self_profile",
"userbot_id": 1
}
Parameters
| Field |
Type |
Required |
Default |
Description |
| — |
— |
— |
— |
This command does not require extra payload fields beyond action and userbot_id. |
Response variants
- Success event(s):
refresh_self_profile.
- Error event(s):
refresh_self_profile_error.
- Result shaping:
backend/tg_client/dialogs/services/userbot_profile_sync.py + backend/tg_client/dialogs/tdlib/normalizers/self_profile_normalizer.py.
- Notes: This command bypasses the usual TdlibFacade service list and calls
sync_userbot_self_profile(...) directly through sync_to_async(...).
Errors
| Error |
Type/Code |
When happens |
Notes |
Database connection is unavailable. Please retry self profile refresh. |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
Unexpected error during self profile refresh. |
string |
Caught exception in refresh_self_profile handler |
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_profile_commands processes refresh_self_profile.
- The handler calls
sync_userbot_self_profile(...) through sync_to_async(...) instead of the standard TdlibFacade service list.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Unexpected exceptions are caught in the handler and emitted as
refresh_self_profile_error with a fixed string message.
- The sync path may download/cache profile media through
FileService.
- Needs verification based on code.
- Sibling commands in this handler group:
get_user, set_name, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Notes
- Unexpected exceptions are caught in the handler and emitted as
refresh_self_profile_error with a fixed string message.
- The sync path may download/cache profile media through
FileService.
Command: get_user
Summary
Get user.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 49).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::get_user_profile.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "get_user",
"userbot_id": 1,
"user_id": 123456789
}
Parameters
| Field |
Type |
Required |
Default |
Description |
user_id |
integer |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
get_user.
- Error event(s):
get_user_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "get_user",
"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_profile_commands processes get_user.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::get_user_profile.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, set_name, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: set_name
Summary
Set name.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 54).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_name.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "set_name",
"userbot_id": 1,
"first_name": "Ihor",
"last_name": "Petrenko",
"full_name": "Ihor Petrenko"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
first_name |
string |
required |
— |
Derived from handler payload access in current code. |
last_name |
string |
optional |
— |
Derived from handler payload access in current code. |
full_name |
string |
optional |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
set_name.
- Error event(s):
set_name_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "set_name",
"result": "<typed payload or TDLib-like result>"
}
}
Errors
| Error |
Type/Code |
When happens |
Notes |
first_name 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_profile_commands processes set_name.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_name.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: set_bio
Summary
Set bio.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 64).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_bio.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "set_bio",
"userbot_id": 1,
"bio": "Backend engineer"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
bio |
string |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
set_bio.
- Error event(s):
set_bio_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "set_bio",
"result": "<typed payload or TDLib-like result>"
}
}
Errors
| Error |
Type/Code |
When happens |
Notes |
bio 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_profile_commands processes set_bio.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_bio.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: set_username
Summary
Set username.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 72).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_username.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "set_username",
"userbot_id": 1,
"username": "ihor"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
username |
string |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
set_username.
- Error event(s):
set_username_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "set_username",
"result": "<typed payload or TDLib-like result>"
}
}
Errors
| Error |
Type/Code |
When happens |
Notes |
username 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_profile_commands processes set_username.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_username.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: set_birthdate
Summary
Set birthdate.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 80).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_birthdate.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "set_birthdate",
"userbot_id": 1,
"day": 30,
"month": 3,
"year": 1994,
"birthdate": {
"day": 30,
"month": 3,
"year": 1994
}
}
Parameters
| Field |
Type |
Required |
Default |
Description |
day |
integer |
required |
— |
Derived from handler payload access in current code. |
month |
integer |
required |
— |
Derived from handler payload access in current code. |
year |
integer |
optional |
— |
Derived from handler payload access in current code. |
birthdate |
object |
optional |
— |
Raw TDLib-style birthdate object when day/month/year are not used separately. |
clear |
boolean |
optional |
false |
Derived from handler payload access in current code. |
birthdate_provided |
boolean |
optional |
false |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
set_birthdate.
- Error event(s):
set_birthdate_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "set_birthdate",
"result": "<typed payload or TDLib-like result>"
}
}
Errors
| Error |
Type/Code |
When happens |
Notes |
birthdate must be an object or null |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
day is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
month is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
day must be in range 1..31 |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
month must be in range 1..12 |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
year must be >= 0 |
string |
Validation of TDLib-style input payload |
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_profile_commands processes set_birthdate.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::set_birthdate.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, get_chat_profile, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: get_chat_profile
Summary
Get chat profile.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 93).
- Service:
backend/tg_client/dialogs/tdlib/services/profile_service.py::get_chat_profile.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
Request
Structure
{
"action": "get_chat_profile",
"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):
get_chat_profile.
- Error event(s):
get_chat_profile_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Common outbound envelope:
{
"type": "chat_update",
"userbot_id": 1,
"payload": {
"userbot_id": 1,
"type": "get_chat_profile",
"result": "<typed payload or TDLib-like result>"
}
}
Errors
| Error |
Type/Code |
When happens |
Notes |
chat_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_profile_commands processes get_chat_profile.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/profile_service.py::get_chat_profile.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py, backend/tg_client/dialogs/tdlib/api/topics.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/profile_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, set_birthdate, search_user, create_private_chat, create_supergroup_chat, import_contacts.
Command: search_user
Summary
Search a public chat by query through the bootstrap service.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 101).
- Service:
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::search_user.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Request
Structure
{
"action": "search_user",
"userbot_id": 1,
"query": "invoice"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
query |
string |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
search_user.
- Error event(s):
search_user_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
query 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_profile_commands processes search_user.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::search_user.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- The command name suggests user search, but the current implementation delegates to
search_public_chat() semantics. See the inconsistencies page.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, set_birthdate, get_chat_profile, create_private_chat, create_supergroup_chat, import_contacts.
Notes
- The command name suggests user search, but the current implementation delegates to
search_public_chat() semantics. See the inconsistencies page.
Command: create_private_chat
Summary
Create private chat.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 107).
- Service:
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::create_private_chat.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Request
Structure
{
"action": "create_private_chat",
"userbot_id": 1,
"user_id": 123456789
}
Parameters
| Field |
Type |
Required |
Default |
Description |
user_id |
integer |
required |
— |
Derived from handler payload access in current code. |
force |
boolean |
optional |
false |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
create_private_chat.
- Error event(s):
create_private_chat_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
user_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_profile_commands processes create_private_chat.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::create_private_chat.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_supergroup_chat, import_contacts.
Command: create_supergroup_chat
Summary
Create supergroup chat.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 116).
- Service:
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::create_supergroup_chat.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Request
Structure
{
"action": "create_supergroup_chat",
"userbot_id": 1,
"title": "Product Team",
"description": "Internal coordination chat"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
title |
string |
required |
— |
Derived from handler payload access in current code. |
is_channel |
boolean |
optional |
false |
Derived from handler payload access in current code. |
description |
unknown |
optional |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
create_supergroup_chat.
- Error event(s):
create_supergroup_chat_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
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_profile_commands processes create_supergroup_chat.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::create_supergroup_chat.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, import_contacts.
Summary
Import contacts.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/profile.py::handle_profile_commands (branch starts near line 126).
- Service:
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::import_contacts.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Request
Structure
{
"action": "import_contacts",
"userbot_id": 1,
"phone": "+15551234567",
"first_name": "Ihor",
"last_name": "Petrenko",
"vcard": "BEGIN:VCARD...",
"contact_user_id": 123456789
}
Parameters
| Field |
Type |
Required |
Default |
Description |
phone |
string |
required |
— |
Derived from handler payload access in current code. |
first_name |
string |
optional |
— |
Derived from handler payload access in current code. |
last_name |
string |
optional |
— |
Derived from handler payload access in current code. |
vcard |
unknown |
optional |
— |
Derived from handler payload access in current code. |
contact_user_id |
integer |
optional |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
import_contacts.
- Error event(s):
import_contacts_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
phone 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_profile_commands processes import_contacts.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/bootstrap_service.py::import_contacts.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/chats.py, backend/tg_client/dialogs/tdlib/api/profiles.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/bootstrap_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
refresh_self_profile, get_user, set_name, set_bio, set_username, set_birthdate, get_chat_profile, search_user, create_private_chat, create_supergroup_chat.