custom.message (выходной)
Выходной топик аккаунта канала: запись пишет Shtab Connect, читает система организации. Повтор записи несёт тот же event_id.
Схема outbound.message.v1 собрана из src/backend/contracts/integrations/custom_channel/outbound.message.v1.json при сборке портала.
Поля
OutboundMessage
Фрагмент ответа клиенту. Сообщение из нескольких частей (текст, файл, кнопки) приходит несколькими фрагментами с одним message_id; повтор фрагмента несёт тот же event_id.
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
author | Author | да | |
conversation_id | string (uuid) или null | да | |
customer | Customer | да | |
event_id | string (uuid) | да | |
file | OutboundFile или null | нет | По умолчанию null. |
message_id | string (uuid) | да | |
part_index | integer | да | |
quick_replies | массив string | нет | По умолчанию []. |
schema_version | integer | нет | По умолчанию 1. |
sent_at | string (date-time) | да | |
split_index | integer | нет | По умолчанию 0. |
text | string | нет | По умолчанию "". |
thread_id | string | нет | По умолчанию "". |
type | "custom.message" | да | Вид варианта: всегда custom.message. |
Author
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
kind | AuthorKind | да | |
name | string | нет | По умолчанию "". |
AuthorKind
Значения: "bot", "operator", "system".
Customer
Клиент в системе организации: по external_id Helpdesk находит его карточку.
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
external_id | string | да | от 1 симв., до 100 симв.. |
name | string | нет | до 255 симв.. По умолчанию "". |
OutboundFile
Файл ответа: скачивается GET /api/integration/v1/attachments/{attachment_id}.
| Поле | Тип | Обязательное | Описание |
|---|---|---|---|
attachment_id | string (uuid) | да | |
mime_type | string | да | |
name | string | да | |
size | integer | да |
Пример
{
"type": "custom.message",
"schema_version": 1,
"event_id": "0b9a4d4e-6a3f-4f0e-8d2c-1a7b5c9e3f10",
"message_id": "a3e1c7d2-5b8f-4a69-b0c4-7d2e9f1a6b35",
"part_index": 0,
"split_index": 0,
"conversation_id": "6f1c2a8e-3b7d-4c55-9a10-2f4e8d1b7c01",
"customer": {
"external_id": "client-42",
"name": "Анна Петрова"
},
"thread_id": "order-77",
"author": {
"kind": "operator",
"name": "Мария"
},
"text": "Заказ передан в доставку.",
"file": {
"attachment_id": "c4d5e6f7-0812-4a3b-9c4d-5e6f70812a3b",
"name": "track.pdf",
"mime_type": "application/pdf",
"size": 1024
},
"quick_replies": [
"Спасибо",
"Где курьер?"
],
"sent_at": "2026-11-10T09:30:00Z"
}
JSON Schema
{
"$defs": {
"Author": {
"properties": {
"kind": {
"$ref": "#/$defs/AuthorKind"
},
"name": {
"default": "",
"type": "string"
}
},
"required": [
"kind"
],
"title": "Author",
"type": "object"
},
"AuthorKind": {
"enum": [
"bot",
"operator",
"system"
],
"title": "AuthorKind"
},
"Customer": {
"description": "Клиент в системе организации: по ``external_id`` Helpdesk находит его карточку.",
"properties": {
"external_id": {
"maxLength": 100,
"minLength": 1,
"type": "string"
},
"name": {
"default": "",
"maxLength": 255,
"type": "string"
}
},
"required": [
"external_id"
],
"title": "Customer",
"type": "object"
},
"OutboundFile": {
"description": "Файл ответа: скачивается ``GET /api/integration/v1/attachments/{attachment_id}``.",
"properties": {
"attachment_id": {
"format": "uuid",
"type": "string"
},
"mime_type": {
"type": "string"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
}
},
"required": [
"attachment_id",
"name",
"mime_type",
"size"
],
"title": "OutboundFile",
"type": "object"
},
"OutboundMessage": {
"description": "Фрагмент ответа клиенту. Сообщение из нескольких частей (текст, файл, кнопки) приходит\nнесколькими фрагментами с одним ``message_id``; повтор фрагмента несёт тот же ``event_id``.",
"properties": {
"author": {
"$ref": "#/$defs/Author"
},
"conversation_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
]
},
"customer": {
"$ref": "#/$defs/Customer"
},
"event_id": {
"format": "uuid",
"type": "string"
},
"file": {
"anyOf": [
{
"$ref": "#/$defs/OutboundFile"
},
{
"type": "null"
}
],
"default": null
},
"message_id": {
"format": "uuid",
"type": "string"
},
"part_index": {
"type": "integer"
},
"quick_replies": {
"default": [],
"items": {
"type": "string"
},
"type": "array"
},
"schema_version": {
"default": 1,
"type": "integer"
},
"sent_at": {
"format": "date-time",
"type": "string"
},
"split_index": {
"default": 0,
"type": "integer"
},
"text": {
"default": "",
"type": "string"
},
"thread_id": {
"default": "",
"type": "string"
},
"type": {
"description": "Вид варианта: всегда `custom.message`.",
"enum": [
"custom.message"
]
}
},
"required": [
"type",
"event_id",
"message_id",
"part_index",
"conversation_id",
"customer",
"author",
"sent_at"
],
"title": "OutboundMessage",
"type": "object"
}
},
"$ref": "#/$defs/OutboundMessage"
}