telephony.call.attachTranscription
Добавить расшифровку записи к звонку
Описание
Метод telephony.call.attachTranscription добавляет расшифровку разговора к завершенному звонку.
Параметры
CALL_ID
string
обязательный
Идентификатор звонка из метода telephony.externalCall.register
MESSAGES
array
обязательный
Массив реплик расшифровки
COST
double
необязательный
Стоимость расшифровки.
По умолчанию — не задается
COST_CURRENCY
string
необязательный
Валюта стоимости расшифровки. Используется только вместе с COST.
По умолчанию — не задается
Параметр MESSAGES
SIDE
string
обязательный
Участник разговора.
Возможные значения:
- User — пользователь портала
- Client — клиент
START_TIME
integer
обязательный
Время начала реплики в секундах от начала звонка.
Минимальное значение — 0
STOP_TIME
integer
обязательный
Время окончания реплики в секундах от начала звонка.
Минимальное значение — 1
MESSAGE
string
обязательный
Текст реплики
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"CALL_ID":"externalCall.716f1cb73def9700a23842adf9c4c568.1773130779","MESSAGES":[{"SIDE":"User","START_TIME":1,"STOP_TIME":3,"MESSAGE":"Добрый день"},{"SIDE":"Client","START_TIME":4,"STOP_TIME":7,"MESSAGE":"Здравствуйте"}]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/telephony.call.attachTranscription
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"CALL_ID":"externalCall.716f1cb73def9700a23842adf9c4c568.1773130779","MESSAGES":[{"SIDE":"User","START_TIME":1,"STOP_TIME":3,"MESSAGE":"Добрый день"},{"SIDE":"Client","START_TIME":4,"STOP_TIME":7,"MESSAGE":"Здравствуйте"}],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/telephony.call.attachTranscription
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
type AttachTranscriptionResult = {
TRANSCRIPT_ID: number
}
try {
const response = await $b24.actions.v2.call.make<AttachTranscriptionResult>({
method: 'telephony.call.attachTranscription',
params: {
CALL_ID: 'externalCall.716f1cb73def9700a23842adf9c4c568.1773130779',
MESSAGES: [
{ SIDE: 'User', START_TIME: 1, STOP_TIME: 3, MESSAGE: 'Hello' },
{ SIDE: 'Client', START_TIME: 4, STOP_TIME: 7, MESSAGE: 'Hi there' },
],
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('Transcript ID:', result.TRANSCRIPT_ID)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function attachTranscription() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'telephony.call.attachTranscription',
params: {
CALL_ID: 'externalCall.716f1cb73def9700a23842adf9c4c568.1773130779',
MESSAGES: [
{ SIDE: 'User', START_TIME: 1, STOP_TIME: 3, MESSAGE: 'Hello' },
{ SIDE: 'Client', START_TIME: 4, STOP_TIME: 7, MESSAGE: 'Hi there' },
],
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('Transcript ID:', result.TRANSCRIPT_ID)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', attachTranscription)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
messages = [
{
"SIDE": "User",
"START_TIME": 1,
"STOP_TIME": 3,
"MESSAGE": "Hello",
},
{
"SIDE": "Client",
"START_TIME": 4,
"STOP_TIME": 7,
"MESSAGE": "Hi there",
},
]
try:
bitrix_response = client.telephony.call.attach_transcription(
call_id="externalCall.716f1cb73def9700a23842adf9c4c568.1773130779",
messages=messages,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Ошибка Bitrix API",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
print(f"Непредвиденная ошибка: {error}")
try {
$response = $b24Service
->core
->call(
'telephony.call.attachTranscription',
[
'CALL_ID' => 'externalCall.716f1cb73def9700a23842adf9c4c568.1773130779',
'MESSAGES' => [
['SIDE' => 'User', 'START_TIME' => 1, 'STOP_TIME' => 3, 'MESSAGE' => 'Добрый день'],
['SIDE' => 'Client', 'START_TIME' => 4, 'STOP_TIME' => 7, 'MESSAGE' => 'Здравствуйте']
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error attaching transcription: ' . $e->getMessage();
}
BX24.callMethod(
"telephony.call.attachTranscription",
{
CALL_ID: 'externalCall.716f1cb73def9700a23842adf9c4c568.1773130779',
MESSAGES: [
{ SIDE: 'User', START_TIME: 1, STOP_TIME: 3, MESSAGE: 'Добрый день' },
{ SIDE: 'Client', START_TIME: 4, STOP_TIME: 7, MESSAGE: 'Здравствуйте' }
]
},
function(result)
{
if (result.error())
{
console.error(result.error(), result.error_description());
}
else
{
console.log(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'telephony.call.attachTranscription',
[
'CALL_ID' => 'externalCall.716f1cb73def9700a23842adf9c4c568.1773130779',
'MESSAGES' => [
['SIDE' => 'User', 'START_TIME' => 1, 'STOP_TIME' => 3, 'MESSAGE' => 'Добрый день'],
['SIDE' => 'Client', 'START_TIME' => 4, 'STOP_TIME' => 7, 'MESSAGE' => 'Здравствуйте']
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "telephony.call.attachTranscription", b24.Params{
"CALL_ID": "externalCall.716f1cb73def9700a23842adf9c4c568.1773130779",
"MESSAGES": []b24.Params{
{
"SIDE": "User",
"START_TIME": 1,
"STOP_TIME": 3,
"MESSAGE": "Добрый день",
},
{
"SIDE": "Client",
"START_TIME": 4,
"STOP_TIME": 7,
"MESSAGE": "Здравствуйте",
},
},
})
if err != nil {
return fmt.Errorf("telephony.call.attachTranscription: %w", err)
}
var item struct {
TranscriptID b24.ID `json:"TRANSCRIPT_ID"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.TranscriptID)
Ответ
HTTP-статус: 200
{
"result": {
"TRANSCRIPT_ID": 1
},
"time": {
"start": 1773136191,
"finish": 1773136191.49517,
"duration": 0.49517011642456055,
"processing": 0,
"date_start": "2026-03-10T12:49:51+03:00",
"date_finish": "2026-03-10T12:49:51+03:00",
"operating_reset_at": 1773136791,
"operating": 0.1380019187927246
}
}
Возвращаемые данные
result
object
Корневой элемент ответа
TRANSCRIPT_ID
integer
Идентификатор расшифровки
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error": "ERROR_CORE",
"error_description": "MESSAGES should be an array"
}
| Код | Описание | Значение |
|---|---|---|
ERROR_CORE |
CALL_ID should be set | Не передан CALL_ID |
ERROR_CORE |
MESSAGES should be an array | Параметр MESSAGES передан не как массив |
ERROR_CORE |
MESSAGES[{N}][SIDE] should be either Client or User | Недопустимое значение SIDE |
ERROR_CORE |
MESSAGES[{N}][START_TIME] should be greater or equal to zero | Некорректное START_TIME |
ERROR_CORE |
MESSAGES[{N}][STOP_TIME] should be greater than zero | Некорректное STOP_TIME |
ERROR_CORE |
MESSAGES[{N}][MESSAGE] is empty | Пустой текст реплики |
ERROR_CORE |
Call {CALL_ID} is not found. Is it finished? | Звонок не найден в статистике. Убедитесь, что звонок завершен |

