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

Аналитика диалогов

Возможности работы с API "Аналитика диалогов":

  1. Узнать scenario_id (при необходимости start block id) из UI или метод API
  2. Получить список колонок доступных в аналитике диалогов: Получение доступных колонок для отчета
  3. Из ответа Получение доступных колонок для отчета выбрать нужные колонки добавить желаемые фильтры filter_* / sorting в теле запроса и получить отчет по диалогам: отчет или в виде excel
  4. Получение информации о конкретном диалоге

Детали Аналитики:

  • Колонки нельзя выдумывать: берите объект из Получение доступных колонок для отчета. Для variables / intents важен id.

  • В отчёт попадают только переданные columns.
  • call_id и outgoing_campaign_id - одно и то же (число = старый обзвон, UUID = v2).
  • Сортировка по умолчанию: date_start DESC. Своя - через sorting на колонке.
  • В API нет переключателей test/real диалогов - по умолчанию учитываются и те, и другие.
Пример: получение колонок
[
  {
    "id": null,
    "name": "uuid",
    "display_name": "UUID",
    "column_type": "default_dialogs",
    "data_type": "text",
    "table_type": "string",
    "filter_type": null,
    "filter_value": null,
    "sorting": null
  },
  {
    "id": null,
    "name": "duration",
    "display_name": "Длительность (сек.)",
    "column_type": "analytics_dialogs",
    "data_type": "number",
    "table_type": "string",
    "filter_type": "greater_than",
    "filter_value": 30,
    "sorting": "desc"
  },
  {
    "id": 101,
    "name": "client_name",
    "display_name": "client_name",
    "column_type": "variables",
    "data_type": "text",
    "table_type": "string",
    "filter_type": "not_empty",
    "filter_value": null,
    "sorting": null
  },
  {
    "id": 123,
    "name": "Согласие",
    "display_name": "Согласие",
    "column_type": "goals",
    "data_type": "goal",
    "table_type": "string",
    "filter_type": "is_true",
    "filter_value": null,
    "sorting": null
  }
]
Пример: запрос отчета
{
  "analytics_filter": {
    "scenario_id": 951,
    "call_id": "019cb965-869a-7fe0-8b53-bd7e6c5edf24",
    "date_start": "2026-09-01T00:00:00.000",
    "date_end": "2026-09-10T23:59:59.000",
    "offset": 0,
    "limit": 50
  },
  "columns": [
    {
      "id": null,
      "name": "uuid",
      "display_name": "UUID",
      "column_type": "default_dialogs",
      "data_type": "text",
      "table_type": "string",
      "filter_type": null,
      "filter_value": null,
      "sorting": null
    },
    {
      "id": null,
      "name": "duration",
      "display_name": "Длительность (сек.)",
      "column_type": "analytics_dialogs",
      "data_type": "number",
      "table_type": "string",
      "filter_type": "greater_than",
      "filter_value": 30,
      "sorting": "desc"
    },
    {
      "id": 101,
      "name": "client_name",
      "display_name": "client_name",
      "column_type": "variables",
      "data_type": "text",
      "table_type": "string",
      "filter_type": "not_empty",
      "filter_value": null,
      "sorting": null
    },
    {
      "id": 123,
      "name": "Согласие",
      "display_name": "Согласие",
      "column_type": "goals",
      "data_type": "goal",
      "table_type": "string",
      "filter_type": "is_true",
      "filter_value": null,
      "sorting": null
    }
  ]
}
Пример: ответ отчета
{
  "columns": [
    {
      "field": "default_dialogs__uuid",
      "display_name": "UUID",
      "type": "text"
    },
    {
      "field": "analytics_dialogs__duration",
      "display_name": "Длительность (сек.)",
      "type": "number"
    },
    {
      "field": "variables__101",
      "display_name": "client_name",
      "type": "text"
    },
    {
      "field": "goals__123",
      "display_name": "Согласие",
      "type": "goal"
    }
  ],
  "data": [
    {
      "id": 5001,
      "uuid": "01950454-d67f-7932-9076-deb40bfadecc",
      "default_dialogs__uuid": "01950454-d67f-7932-9076-deb40bfadecc",
      "analytics_dialogs__duration": 120,
      "variables__101": "Иванов Иван",
      "goals__123": true
    },
    {
      "id": 5002,
      "uuid": "01950454-d67f-7932-9076-deb40bfadedd",
      "default_dialogs__uuid": "01950454-d67f-7932-9076-deb40bfadedd",
      "analytics_dialogs__duration": 95,
      "variables__101": "Петров Пётр",
      "goals__123": true
    }
  ],
  "total_duration": 4,
  "avg_duration": 107,
  "count": 2
}
Пример: запрос с одной колонкой
{
  "analytics_filter": {
    "scenario_id": 951,
    "date_start": "2026-09-01T00:00:00.000",
    "date_end": "2026-09-10T23:59:59.000",
    "offset": 0,
    "limit": 10
  },
  "columns": [
    {
      "id": 101,
      "name": "client_name",
      "display_name": "client_name",
      "column_type": "variables",
      "data_type": "text",
      "table_type": "string",
      "filter_type": "not_empty",
      "filter_value": null,
      "sorting": null
    }
  ]
}
Пример: ответ с одной колонкой из запроса
{
  "columns": [
    {
      "field": "variables__101",
      "display_name": "client_name",
      "type": "text"
    }
  ],
  "data": [
    {
      "id": 5001,
      "uuid": "01950454-d67f-7932-9076-deb40bfadecc",
      "variables__101": "Иванов Иван"
    },
    {
      "id": 5002,
      "uuid": "01950454-d67f-7932-9076-deb40bfadedd",
      "variables__101": "Петров Пётр"
    }
  ],
  "total_duration": 4,
  "avg_duration": 107,
  "count": 2
}