Перейти к основному содержимому

custom.message (выходной)

Выходной топик аккаунта канала: запись пишет Shtab Connect, читает система организации. Повтор записи несёт тот же event_id.

Схема outbound.message.v1 собрана из src/backend/contracts/integrations/custom_channel/outbound.message.v1.json при сборке портала.

Поля​

OutboundMessage​

Фрагмент ответа клиенту. Сообщение из нескольких частей (текст, файл, кнопки) приходит несколькими фрагментами с одним message_id; повтор фрагмента несёт тот же event_id.

ПолеТипОбязательноеОписание
authorAuthorда
conversation_idstring (uuid) или nullда
customerCustomerда
event_idstring (uuid)да
fileOutboundFile или nullнетПо умолчанию null.
message_idstring (uuid)да
part_indexintegerда
quick_repliesмассив stringнетПо умолчанию [].
schema_versionintegerнетПо умолчанию 1.
sent_atstring (date-time)да
split_indexintegerнетПо умолчанию 0.
textstringнетПо умолчанию "".
thread_idstringнетПо умолчанию "".
type"custom.message"даВид варианта: всегда custom.message.

Author​

ПолеТипОбязательноеОписание
kindAuthorKindда
namestringнетПо умолчанию "".

AuthorKind​

Значения: "bot", "operator", "system".

Customer​

Клиент в системе организации: по external_id Helpdesk находит его карточку.

ПолеТипОбязательноеОписание
external_idstringдаот 1 симв., до 100 симв..
namestringнетдо 255 симв.. По умолчанию "".

OutboundFile​

Файл ответа: скачивается GET /api/integration/v1/attachments/{attachment_id}.

ПолеТипОбязательноеОписание
attachment_idstring (uuid)да
mime_typestringда
namestringда
sizeintegerда

Пример​

{
"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"
}