NAV Navbar
shell ruby python php javascript
  • 1. Введение
  • 2. Base information - базовая информация
  • 3. Methods - методы HTTP в Alloka API
  • 4. Versions - версии Alloka API
  • 5. Pagination - пагинация — разбиение списка ресурсов по страницам
  • 6. HTTP codes - коды статуса HTTP
  • 7. Errors - основные коды ошибок
  • 8. API requests - подробное описание всех запросов к Alloka API
  • 1. Введение

    Входная точка: https://api.alloka.ru/v2/

    Текущая актуальная версия: v2.

    Тип: JSON API. Используется 4 вида HTTP-запросов — GET, POST, PUT и DELETE.

    Механизм авторизации:

    Формат данных: JSON (application/json). Необходимо указывать заголовок Content-Type.

    2. Base information - базовая информация

    Примеры выполнения запросов к Alloka API при помощи различных технологий

    Здесь приведены примеры запросов к Alloka API при помощи утилиты cURL, а также языков PHP, Ruby и Python HTTP авторизация в утилите cURL происходит указанием следующего аргумента: curl -u username:password В примере запроса c curl — user - API-ключ, а password параметр должен быть пуст: curl -u <ВАШAPIКЛЮЧ>:

    Sample request

    require "uri"
    require "net/https"
    
    # Ваш API-ключ авторизации
    api_key = "gnLZYz0FexchC6RFPyP0PBb9n26cecQh"
    
    # URL запроса
    uri = URI.parse("https://api.alloka.ru/v2/")
    
    # Создаём объекты запроса
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER
    request = Net::HTTP::Get.new(uri.request_uri)
    
    # Авторизация
    request.basic_auth(api_key, "")
    
    # Заголовки запроса
    request.headers["Content-Type"] = "application/json"
    
    # Выполняем запрос
    response = http.request(request)
    
    # Ваша обработка ответа
    puts response.body
    
    import httplib2
    
    # Ваш API-ключ авторизации
    api_key = "gnLZYz0FexchC6RFPyP0PBb9n26cecQh"
    
    # URL запроса
    url = "https://api.alloka.ru/v2/"
    
    # Создаём объект запроса
    http = httplib2.Http()
    
    # Авторизация
    http.add_credentials(api_key, '')
    
    # Заголовки запроса
    headers = {'Content-type': 'application/json'}
    
    # Выполняем запрос
    response, content = http.request(url, 'GET', headers=headers)
    
    # Обработка ответа
    print(content)
    
    curl -X GET "https://api.alloka.ru/v2/" -u gnLZYz0FexchC6RFPyP0PBb9n26cecQh:  -v
    
    <?php
    // URL запроса
    $ch = curl_init("https://api.alloka.ru/v2/");
    
    // Ваш API-ключ авторизации
    $api_key = "gnLZYz0FexchC6RFPyP0PBb9n26cecQh";
    
    // Авторизация
    curl_setopt($ch, CURLOPT_USERPWD, $api_key . ":");
    
    // Заголовки запроса
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Content-Type: application/json"
    ));
    
    // Выполняем запрос
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    
    // Закрываем соедиениние
    curl_close($ch);
    
    /* Обработка ответа */
    echo $result;
    ?>
    
    let
        url = 'https://api.alloka.ru/v2/',
      apiKey = 'gnLZYz0FexchC6RFPyP0PBb9n26cecQh';
    
    
    fetch(url, {
        headers: {
        'Content-Type': 'application/json',
        'X-AUTH-TOKEN': apiKey
      },
    
      body: {}
    })
        .then(function(response) {
            return response.json();
        })
    
        .then(function(data) {
            console.log(data);
        })
    
        .catch(console.log);
    

    3. Methods - методы HTTP в Alloka API

    Alloka API использует 4 HTTP метода в различных случаях:

    В подробном описание каждого запроса указан необходимый метод HTTP.

    4. Versions - версии Alloka API

    Используемая версия API должна содержаться в URL каждого запроса сразу после домена: https://api.alloka.ru/v2/

    Текущая наиболее актуальная версия - v2. В будущем, при наличии серьёзных изменений в работе, будут создаваться новые версии. Тем не менее, текущая версия также будет функционировать. Поэтому вы можете не беспокоиться за то, что ваша интеграция с Alloka внезапно перестанет работать из-за изменений в API.

    5. Pagination - пагинация — разбиение списка ресурсов по страницам

    Некоторые из запросов Alloka API выводят массив ресурсов. В таком случае, ответ на запрос будет разбиваться на страницы исходя из значения следующих параметров, которые также можно передать входными параметрами запроса:

    Также каждый ответ на запрос списка ресурсов содержит два поля, помогающие узнать суммарное количество элементов по запросу, общее количество страниц, а также количество элементов в данном ответе:

    {
      "meta": {
        "pagination": {
          "current_page": 1,
          "next_page": null,
          "prev_page": null,
          "total_pages": 1,
          "total_objects": 8
        }
      }
    }
    

    6. HTTP codes - коды статуса HTTP

    Успешность выполнения запроса к Alloka API определяется HTTP-кодом ответа.

    Код статуса HTTP Описания значения в Alloka API
    200 OK Успешная операция
    401 Unauthorized Неавторизованный доступ
    403 Forbidden Доступ к запрашиваемому ресурсу запрещён
    404 Not Found Запрашиваемый ресурс не найден
    500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout Внутренняя ошибка

    В случае, если вы уверены, что ваш запрос корректен, но вам выдаётся ошибка, напишите нам на support@alloka.ru, указав в письме детали запроса к API (точное время, URL, параметры запроса).

    7. Errors - основные коды ошибок

    В случае неудачного запроса в ответе будет содержаться поле error, которое может быть строкой или ассоциативным массивом строк.

    Код ошибки Описание
    invalid_json Неправильный JSON, ошибка парсинга JSON, переданного в теле запроса
    invalid_request Неправильный URL запроса
    unauthorized Неавторизованный доступ
    access_denied Доступ к запрашиваемому ресурсу запрещён
    not_found Запрашиваемый ресурс не найден
    unknown_error Внутренняя ошибка

    В случае, если вы уверены, что ваш запрос корректен, но вам выдаётся ошибка, напишите нам на support@alloka.ru, указав в письме детали запроса к API (точное время, URL, параметры запроса). Кроме того, каждый запрос может обладать своими кодами ошибок, о чём указано в описании запросов к Alloka API.

    8. API requests - подробное описание всех запросов к Alloka API

    Ниже представлено подробное описание всех возможных запросов к Alloka API. Каждое описание содержит тип HTTP-запроса, URL, входные параметры(если они возможны), примеры ответов, ошибки(специфичные для данного запроса).

    Внимание! Документация в процессе написания. Возможно неполное описание некоторых запросов.

    Авторизация, получение API ключа и списка его объектов.

    Информация о пользователе.
    POST https://api.alloka.ru/v2/users/sign_in

    {
      "user": {
        "email": "user@alloka.ru",
        "password": "1111111111"
      }
    }
    

    Ответ:

    
    {
      "user": {
        "email": "user@alloka.ru",
        "contact_name": "Name",
        "phone_number": "+74951232323",
        "company_name": "test",
        "agency": "Red Ltd.",
        "api_key": "asdf111111DFdsfdTNkjc7yLu9eVmpn",
        "is_agency_manager": false,
        "business_categories": [],
        "roles": [
          {
            "id": 1,
            "name": "CLIENT",
            "translated_name": "Клиент"
          },
          {
            "id": 5,
            "name": "AGENCY_CLIENT",
            "translated_name": "Клиент агентства"
          }
        ],
        "objs": [
          {
            "oid": "44569f6d442ad111",
            "alias": "test",
            "title": "test",
            "site_url": "",
            "phone_number": "74958788877",
            "expiration_date": null,
            "sip_uri": null,
            "use_sip": false,
            "sessions_reset_date": null,
            "sessions_used": null,
            "sessions": 0,
            "numbers": 0,
            "is_tracking": false,
            "status": "active",
            "is_upgradable": true,
            "calls_count": 0,
            "country": {
              "id": 203,
              "name": "Russia",
              "translated_name": "Россия"
            },
            "current_city_only": false,
            "needs_renewing": false,
            "needs_increasing": false,
            "city": {
              "id": 1384,
              "name": "Москва",
              "name_int": "Moskva",
              "translated_name": "Москва"
            },
            "custom_statuses": [
              {
                "id": 2006,
                "name": "В бан!",
                "color": null
              },
              {
                "id": 1867,
                "name": "Ошиблись",
                "color": null
              }
            ],
            "tariff": null,
            "tariff_items": null,
            "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '44569f6d442ad111': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
            "script_config": [
              "last_source",
              "type_in",
              "referrer",
              "utm"
            ],
            "script_config_possible_values": {
              "last_source": 0,
              "type_in": 1,
              "referrer": 2,
              "utm": 3,
              "block_id": 4,
              "gtm": 5
            },
            "blocked_ip_list_enabled": false,
            "blocked_ip_addresses": {},
            "forward_caller_id": false,
            "email_notification_enabled": false,
            "email_notification": {
              "obj_email_notify_config": {
                "created_at": "2018-01-23T14:22:32+03:00",
                "id": 2429,
                "is_enabled": null,
                "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
                "missed_only": null,
                "monitor_enabled": false,
                "monitor_recipients": null,
                "obj_id": 11467,
                "recipients": "wer@sdf.com",
                "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
                "updated_at": "2018-01-23T14:22:32+03:00"
              }
            },
            "client_phone_numbers": [
              {
                "obj_id": 11467,
                "number": "74958788877",
                "phone_number": "74958788877",
                "sip": "",
                "priority": 0,
                "redirect_timeout": 180,
                "record_url": null,
                "answerphone": false,
                "call_with_main": false
              }
            ]
          },
          ...
        ]
      }
    }
    

    Agency — агентство.

    Информация об агентстве и клиентах.


    GET https://api.alloka.ru/v2/agency

    Ответ:

    
    [
      {
      "agency": {
        "name": "Agency",
        "domain": "agency.ru",
        "phone_number": null,
        "is_active": true,
        "clients": [
          {
            "email": "client@yandex.ru",
            "company_name": "client",
            "auth_token": "mReMD0VmMLDVf6RsXUDKex8WPae12123",
            "statistics_only": true,
            "hidden_fields": null,
            "objects_count": 1,
            "calls_count": 0
          },
         ...
        ]
      }
    }
    ]
    
    

    Обновление информации об агентстве.


    PUT https://api.alloka.ru/v2/agency

    {
      "agency": {
        "name": "Agency",
        "domain": "agency.ru",
        "phone_number": "+74951232323",
        "is_active": true
      }
    }
    

    Ответ:

      {
      "agency": {
        "name": "Agency",
        "domain": "agency.ru",
        "phone_number": "+74951232323",
        "is_active": true,
        "clients": [
          {
            "email": "client@yandex.ru",
            "company_name": "client",
            "auth_token": "mReMD0VmMLDVf6RsXUDKex8WPae12123",
            "statistics_only": true,
            "hidden_fields": null,
            "objects_count": 1,
            "calls_count": 0
          },
         ...
        ]
      }
    }
    
    

    Calls — статистика звонков по всем объектам.

    Статистика звонков


    GET https://api.alloka.ru/v2/calls

    Возможные данные в поле custom_data:


    • для сервисов jivosite, carrot_quest информация о звонящем находится в
    "visitor": {
      "name": "name",
      "email": "email",
      "country": "country",
      "region": "region",
      "city": "city"
    }
    
    • для сервиса widget_form информация о звонящем находится в
    {
      "name": "name",
      "email": "email"
    }
    
    • диалоги для сервиса jivosite находятся в messages

    • диалоги для сервиса carrot_quest находятся в

    {
    "custom_data": {
      "conversation_id": "",
      "visitor": "",
      "source": "",
      "conversation": "{
          \"116282144\":\"\\u041f\\u043e\\u0441\\u0435\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c: \\u043d\\u0435 \\u043c\\u043e\\u0433\\u0443 \\u0434\\u043e\\u0437\\u0432\\u043e\\u043d\\u0438\\u0442\\u044c\\u0441\\u044f \\u0432 \\u0412\\u0430\\u0448 \\u043e\\u0444\\u0438\\u0441 \\u043f\\u0440\\u043e\\u0434\\u0430\\u0436\",
          \"116282149\":\"\\u041a\\u043b\\u0435\\u0432\\u0435\\u0440\\u0435\\u043d\\u0441: \\u041f\\u043e\\u043a\\u0430\\u0437\\u0430\\u043d \\u0430\\u0432\\u0442\\u043e\\u043e\\u0442\\u0432\\u0435\\u0442: \\u0421\\u0435\\u0439\\u0447\\u0430\\u0441 \\u043c\\u044b \\u043e\\u0442\\u0432\\u0435\\u0442\\u0438\\u043c \\u0432\\u0430\\u043c. \\u041e\\u0441\\u0442\\u0430\\u0432\\u044c\\u0442\\u0435 \\u0441\\u0432\\u043e\\u0439 e-mail, \\u0438 \\u043c\\u044b \\u0441\\u043c\\u043e\\u0436\\u0435\\u043c \\u043f\\u0440\\u043e\\u0434\\u043e\\u043b\\u0436\\u0438\\u0442\\u044c \\u043e\\u0431\\u0449\\u0435\\u043d\\u0438\\u0435 \\u0447\\u0435\\u0440\\u0435\\u0437 \\u043f\\u043e\\u0447\\u0442\\u0443.\"
        }"
      }
    }
    
    • для сервисов jivosite, carrot_quest информация о звонящем находится в

    Допустимые параметры фильтров:

    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    • source_filter источник (obj_source)

    • source_text_filter - источник (фильт по title obj_source)

    • target_filter = 1 (целевые звонки)

    • repeated_filter = 1 (новые звонки)

    • uri_filter - страница звонка

    • from_filter - От кого

    • duration_filter - Длительность

    • status_filter - Статус

    • order_field = [source, uri, from, duration, status, title, service], по умолчанию дата звонка

    • order_way = [ASC, DESC]

    Ответ:

    {
      "calls": [
        {
          "id": 2339126,
          "obj_oid": "d4a4827d51111111111",
          "date": "2017-10-07T11:18:55+03:00",
          "src": null,
          "referrer": "https://alloka.ru",
          "request_uri": "https://analytics.alloka.ru/sign_up",
          "phone_number_from": "88129037589",
          "search_request": null,
          "status": 8,
          "utm": null,
          "custom_data": "{\"inp_name\":\"\\u0414\\u043c\\u0438\\u0442\\u0440\\u0438\\u0439\"}",
          "call_type": {
            "id": 1,
            "name": "COMMON"
          },
          "record_url": null,
          "custom_status": null,
          "customer_status": {
            "id": 10706,
            "status": "Регистрация/запрос",
            "customer_id": 9940,
            "name": "Звонок от +74957771111",
            "date_create": "2017-10-11T16:39:21+03:00",
            "price": null,
            "responsible_user": "Сергей Иванов",
            "company": "{\"Name\":\"test",\"Web\":\"http://test.com\"}",
            "date_close": null,
            "tags": "[\"alloka\"]",
            "source": "amocrm",
            "lead_id": null,
            "responsible_user_id": null
          },
          "region": null,
          "dialstatus": "Регистрация/запрос",
          "duration": null,
          "source": null,
          "service_name": "Форма на сайте",
          "service_logo_url": "https://alloka.ru/phone_logo_20x20.png",
          "comments": [],
          "messages": "Посетитель: +\nСергей: Доброго дня\nПосетитель: Добрый день!\nПосетитель: Могу я с вами поговорить?",
          "sms_message": null,
          "email_text": null,
          "widget_text": null,
          "target": null,
          "managers": "Сергей"
        },
        {
          "id": 2344859,
          "obj_oid": "d4a4827d51111111111",
          "date": "2017-10-09T14:48:41+03:00",
          "src": null,
          "referrer": "https://alloka.ru",
          "request_uri": "https://analytics.alloka.ru/sign_up",
          "phone_number_from": "89232812323",
          "search_request": null,
          "status": 8,
          "utm": null,
          "custom_data": "{\"inp_name\":\"\\u0423\\u043b\\u044c\\u044f\\u043d\\u0430\"}",
          "call_type": {
            "id": 1,
            "name": "COMMON"
          },
          "record_url": null,
          "custom_status": null,
          "customer_status": {
            "id": 10706,
            "status": "Регистрация/запрос",
            "customer_id": 9940,
            "name": "Звонок от +74957771111",
            "date_create": "2017-10-11T16:39:21+03:00",
            "price": null,
            "responsible_user": "Сергей Иванов",
            "company": "{\"Name\":\"test",\"Web\":\"http://test.com\"}",
            "date_close": null,
            "tags": "[\"alloka\"]",
            "source": "amocrm",
            "lead_id": null,
            "responsible_user_id": null
          },
          "region": null,
          "dialstatus": "Тестовый период",
          "duration": null,
          "source": null,
          "service_name": "Форма на сайте",
          "service_logo_url": "https://alloka.ru/phone_logo_20x20.png",
          "comments": [],
          "messages": "Посетитель: +\nСергей: Доброго дня\nПосетитель: Добрый день!\nПосетитель: Могу я с вами поговорить?",
          "sms_message": null,
          "email_text": null,
          "widget_text": null,
          "target": null,
          "managers": "Сергей"
        },
        ...
        ],
      "meta": {
        "obj": [
          {
            "oid": "111115697654c788",
            "alias": "alias",
            "title": "Obj test",
            "site_url": "http://alloka.ru",
            "phone_number": "19107911111",
            "expiration_date": null,
            "sip_uri": "19107911111",
            "use_sip": true,
            "sessions_reset_date": null,
            "sessions_used": null,
            "sessions": 0,
            "numbers": 0,
            "is_tracking": false,
            "status": "active",
            "is_upgradable": false,
            "calls_count": 0,
            "country": {
              "id": 254,
              "name": "United States",
              "translated_name": "США"
            },
            "current_city_only": false,
            "needs_renewing": false,
            "needs_increasing": false,
            "city": {
              "id": 7351,
              "name": "Palo Alto",
              "name_int": "Palo Alto",
              "translated_name": "Palo Alto"
            },
            "custom_statuses": [
              {
                "id": 2006,
                "name": "В бан!",
                "color": null
              },
              {
                "id": 1867,
                "name": "Ошиблись",
                "color": null
              }
            ],
            "tariff": null,
            "tariff_items": null,
            "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '111115697654c788': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
            "script_config": [
              "last_source",
              "type_in",
              "referrer",
              "utm"
            ],
            "script_config_possible_values": {
              "last_source": 0,
              "type_in": 1,
              "referrer": 2,
              "utm": 3,
              "block_id": 4,
              "gtm": 5
            },
            "blocked_ip_list_enabled": false,
            "blocked_ip_addresses": {},
            "forward_caller_id": true,
            "email_notification_enabled": false,
            "email_notification": {
              "obj_email_notify_config": {
                "created_at": "2017-03-29T16:51:44+03:00",
                "id": 1676,
                "is_enabled": null,
                "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
                "missed_only": null,
                "monitor_enabled": false,
                "monitor_recipients": null,
                "obj_id": 1,
                "recipients": "user@alloka.ru",
                "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
                "updated_at": "2017-03-29T16:51:44+03:00"
              }
            },
            "client_phone_numbers": [
              {
                "obj_id": 1,
                "number": "883140771111111@login.mtt.ru",
                "phone_number": "19107911111",
                "sip": "883140771111111@login.mtt.ru",
                "priority": 0,
                "redirect_timeout": 180,
                "record_url": null,
                "answerphone": false,
                "call_with_main": false
              }
            ]
          },
          ...
        ],
        "pagination": {
          "current_page": 1,
          "next_page": 2,
          "prev_page": null,
          "total_pages": 11,
          "total_objects": 208
        }
     }
    

    Статистика звонков по объекту


    GET https://api.alloka.ru/v2/objs/27d2610d26bdd123/calls

    Возможные данные в поле custom_data:


    • для сервисов jivosite, carrot_quest информация о звонящем находится в
    "visitor": {
      "name": "name",
      "email": "email",
      "country": "country",
      "region": "region",
      "city": "city"
    }
    
    • для сервиса widget_form информация о звонящем находится в
    {
      "name": "name",
      "email": "email"
    }
    
    • диалоги для сервиса jivosite находятся в messages

    • диалоги для сервиса carrot_quest находятся в

    {
    "custom_data": {
      "conversation_id": "",
      "visitor": "",
      "source": "",
      "conversation": "{
          \"116282144\":\"\\u041f\\u043e\\u0441\\u0435\\u0442\\u0438\\u0442\\u0435\\u043b\\u044c: \\u043d\\u0435 \\u043c\\u043e\\u0433\\u0443 \\u0434\\u043e\\u0437\\u0432\\u043e\\u043d\\u0438\\u0442\\u044c\\u0441\\u044f \\u0432 \\u0412\\u0430\\u0448 \\u043e\\u0444\\u0438\\u0441 \\u043f\\u0440\\u043e\\u0434\\u0430\\u0436\",
          \"116282149\":\"\\u041a\\u043b\\u0435\\u0432\\u0435\\u0440\\u0435\\u043d\\u0441: \\u041f\\u043e\\u043a\\u0430\\u0437\\u0430\\u043d \\u0430\\u0432\\u0442\\u043e\\u043e\\u0442\\u0432\\u0435\\u0442: \\u0421\\u0435\\u0439\\u0447\\u0430\\u0441 \\u043c\\u044b \\u043e\\u0442\\u0432\\u0435\\u0442\\u0438\\u043c \\u0432\\u0430\\u043c. \\u041e\\u0441\\u0442\\u0430\\u0432\\u044c\\u0442\\u0435 \\u0441\\u0432\\u043e\\u0439 e-mail, \\u0438 \\u043c\\u044b \\u0441\\u043c\\u043e\\u0436\\u0435\\u043c \\u043f\\u0440\\u043e\\u0434\\u043e\\u043b\\u0436\\u0438\\u0442\\u044c \\u043e\\u0431\\u0449\\u0435\\u043d\\u0438\\u0435 \\u0447\\u0435\\u0440\\u0435\\u0437 \\u043f\\u043e\\u0447\\u0442\\u0443.\"
        }"
      }
    }
    
    • для сервисов jivosite, carrot_quest информация о звонящем находится в

    Допустимые параметры фильтров:

    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    • source_filter источник (obj_source)

    • source_text_filter - источник (фильт по title obj_source)

    • target_filter = 1 (целевые звонки)

    • repeated_filter = 1 (новые звонки)

    • uri_filter - страница звонка

    • from_filter - От кого

    • duration_filter - Длительность

    • status_filter - Статус

    • order_field = [source, uri, from, duration, status, title, service], по умолчанию дата звонка

    • order_way = [ASC, DESC]

    Ответ:

    {
      "calls": [
        {
          "id": 2359007,
          "obj_oid": "27d2610d26bdd123",
          "date": "2017-10-13T15:00:46+03:00",
          "src": "74951111111",
          "referrer": "https://www.google.ru/",
          "request_uri": "https://alloka.ru/",
          "phone_number_from": "74957810035",
          "search_request": null,
          "status": 2,
          "utm": null,
          "custom_data": "{\"yandex_uid\":\"1505484729791411111\"}",
          "call_type": {
            "id": 2,
            "name": "REPEATED"
          },
          "record_url": null,
          "custom_status": null,
          "customer_status": {
            "id": 10706,
            "status": "Регистрация/запрос",
            "customer_id": 9940,
            "name": "Звонок от +74957771111",
            "date_create": "2017-10-11T16:39:21+03:00",
            "price": null,
            "responsible_user": "Сергей Иванов",
            "company": "{\"Name\":\"test",\"Web\":\"http://test.com\"}",
            "date_close": null,
            "tags": "[\"alloka\"]",
            "source": "amocrm",
            "lead_id": null,
            "responsible_user_id": null
          },
          "region": "Россия, Московская область, Красногорск, бульвар Строителей, 1",
          "dialstatus": "Отвечен",
          "duration": 193,
          "source": {
            "title": "Google Поиск",
            "url": "https://www.google.ru/"
          },
          "service_name": "Аллока",
          "service_logo_url": "https://alloka.ru/phone_logo_20x20.png",
          "comments": [],
          "messages": "Посетитель: +\nСергей: Доброго дня\nПосетитель: Добрый день!\nПосетитель: Могу я с вами поговорить?",
          "sms_message": null,
          "email_text": null,
          "widget_text": null,
          "target": true,
          "managers": "Сергей"
        },
        ...
      ],
     "meta": {
        "obj": {
          "oid": "27d2610d26bdd123",
          "alias": "alias test",
          "title": "Test jbject",
          "site_url": "",
          "phone_number": "74991111111",
          "expiration_date": null,
          "sip_uri": null,
          "use_sip": false,
          "sessions_reset_date": null,
          "sessions_used": null,
          "sessions": 0,
          "numbers": 0,
          "is_tracking": false,
          "status": "active",
          "is_upgradable": true,
          "calls_count": 99,
          "country": {
            "id": 203,
            "name": "Russia",
            "translated_name": "Россия"
          },
          "current_city_only": false,
          "needs_renewing": false,
          "needs_increasing": false,
          "city": {
            "id": 1384,
            "name": "Москва",
            "name_int": "Moskva",
            "translated_name": "Москва"
          },
          "custom_statuses": [
            {
              "id": 4895,
              "name": "Новый Клиент",
              "color": null
            },
            {
              "id": 4905,
              "name": "Нравится!",
              "color": null
            },
            {
              "id": 4924,
              "name": "Пока не знаю",
              "color": null
            },
            {
              "id": 4896,
              "name": "Текущий клиент",
              "color": null
            },
            {
              "id": 4903,
              "name": "Тестовый",
              "color": null
            },
            {
              "id": 2006,
              "name": "В бан!",
              "color": null
            },
            {
              "id": 1867,
              "name": "Ошиблись",
              "color": null
            }
          ],
          "tariff": null,
          "tariff_items": null,
          "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '27d2610d26bdd123': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        'calldron_alloka_oid': '27d2610d26bdd123',\n        options: {\n          timerDuration: 30,\n          verticalAlign: 'bottom',\n          horizontalAlign: 'right',\n          verticalMargin: 30,\n          horizontalMargin: 30\n        }\n        ,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/roistat.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/catch_form.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/calldron/widget.js' type='text/javascript'></script><script>\n        function metrika(goal){\n          <%='yaCounter' + 6376351 + '.reachGoal(goal);'\n          };\n          </script>",
          "script_config": [
            "last_source",
            "type_in",
            "referrer",
            "utm",
            "block_id"
          ],
          "script_config_possible_values": {
            "last_source": 0,
            "type_in": 1,
            "referrer": 2,
            "utm": 3,
            "block_id": 4,
            "gtm": 5
          },
          "blocked_ip_list_enabled": true,
          "blocked_ip_addresses": [],
          "forward_caller_id": true,
          "email_notification_enabled": true,
          "email_notification": {
            "obj_email_notify_config": {
              "created_at": "2014-09-05T12:55:54+04:00",
              "id": 68,
              "is_enabled": true,
              "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\r\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\r\n<b>От кого:</b> %ОТ_КОГО%\r\n<b>Кто принял: </b> %ПЕРЕАДРЕСОВАН_НА%\r\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\r\n<b>Страница звонка:</b> %СТРАНИЦА_ЗВОНКА%\r\n<b>Название источника:</b> %НАЗВАНИЕ_ИСТОЧНИКА%\r\n<b>Реферер:</b> %РЕФЕРЕР%\r\n<b>Поисковой запрос:</b> %ПОИСКОВЫЙ_ЗАПРОС%\r\n<b>Длина звонка:</b> %ДЛИТЕЛЬНОСТЬ%\r\n<b>Запись:</b> %ЗАПИСЬ%\r\n<b>ГЕОЛОКАЦИЯ:</b> %ГЕОЛОКАЦИЯ%\r\n<b>Текст СМС</b>:%СМС%",
              "missed_only": false,
              "monitor_enabled": true,
              "monitor_recipients": "skwee@alloka.ru\r\nvl@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
              "obj_id": 77632,
              "recipients": "ter@alloka.ru\r\nskwee@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
              "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
              "updated_at": "2017-09-20T15:06:51+03:00"
            }
          },
          "client_phone_numbers": [
            {
              "obj_id": 77632,
              "number": "74991111111",
              "phone_number": "74991111111",
              "sip": "",
              "priority": 0,
              "redirect_timeout": 30,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            },
            {
              "obj_id": 77632,
              "number": "74996481111",
              "phone_number": "74996481111",
              "sip": "",
              "priority": 1,
              "redirect_timeout": 30,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            },
            {
              "obj_id": 77632,
              "number": "79202991111",
              "phone_number": "79202991111",
              "sip": "",
              "priority": 3,
              "redirect_timeout": 180,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            }
          ]
        },
        "statuses": {
          "cancel": 1,
          "answer": 2,
          "noanswer": 3,
          "busy": 4,
          "congestion": 5,
          "chanunavail": 6,
          "tmp_unavailable": 7,
          "catch_form": 8,
          "jivosite": 9,
          "calldron": 10,
          "sms_incoming": 11,
          "sms_forward": 12,
          "feedback": 13,
          "widget_form": 14,
          "carrot_quest": 15,
          "email_incoming": 16,
          "user_call": 17
        },
        "services": [
          {
            "id": 1,
            "service_name": "Коллбэкхантер",
            "name": "kbh",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/001/original/kbh.png?1453745223"
          },
          {
            "id": 2,
            "service_name": "Форма на сайте",
            "name": "c_f",
            "service_logo_url": "https://alloka.ru/assets/phone_logo_20x20.png"
          },
          {
            "id": 3,
            "service_name": "JivoSite",
            "name": "JivoSite",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/003/original/favicon-16x16.png?1482153488"
          },
          {
            "id": 4,
            "service_name": "Обратный звонок",
            "name": "calldron",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/004/original/%D0%A1allback_icon_fon.png?1494436479"
          },
          {
            "id": 5,
            "service_name": "SMS",
            "name": "SMS",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/005/original/sms2.png?1494434992"
          },
          {
            "id": 6,
            "service_name": "SmartCallback",
            "name": "smartcallback",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/006/original/smartcallback.png?1491909947"
          },
          {
            "id": 7,
            "service_name": "Опрос после звонка",
            "name": "feedback",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/007/original/calldron_for_alloka.png?1494436097"
          },
          {
            "id": 8,
            "service_name": "Carrot Quest",
            "name": "CarrotQuest",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/008/original/carrot-quest_2.png?1498570674"
          },
          {
            "id": 9,
            "service_name": "Email",
            "name": "Email",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/009/original/email.png?1505311578"
          }
        ],
        "pagination": {
          "current_page": 1,
          "next_page": 2,
          "prev_page": null,
          "total_pages": 5,
          "total_objects": 99
        }
      }
    }    
    

    Просмотр данных звонка


    GET https://api.alloka.ru/v2/objs/d4a4827d51111111111/calls/2344859

    Ответ:

    
    {
      "call": {
        "id": 2344859,
        "obj_oid": "d4a4827d51111111111",
        "date": "2017-10-09T14:48:41+03:00",
        "src": null,
        "referrer": "https://alloka.ru",
        "request_uri": "https://analytics.alloka.ru/sign_up",
        "phone_number_from": "89232812323",
        "search_request": null,
        "status": 8,
        "utm": null,
        "custom_data": "{\"inp_name\":\"\\u0423\\u043b\\u044c\\u044f\\u043d\\u0430\"}",
        "call_type": {
          "id": 1,
          "name": "COMMON"
        },
        "record_url": null,
        "custom_status": null,
        "customer_status": {
          "id": 10706,
          "status": "Регистрация/запрос",
          "customer_id": 9940,
          "name": "Звонок от +74957771111",
          "date_create": "2017-10-11T16:39:21+03:00",
          "price": null,
          "responsible_user": "Сергей Иванов",
          "company": "{\"Name\":\"test",\"Web\":\"http://test.com\"}",
          "date_close": null,
          "tags": "[\"alloka\"]",
          "source": "amocrm",
          "lead_id": null,
          "responsible_user_id": null
        },
        "region": null,
        "dialstatus": "Тестовый период",
        "duration": null,
        "source": null,
        "service_name": "Форма на сайте",
        "service_logo_url": "https://alloka.ru/phone_logo_20x20.png",
        "comments":
        [
          {
            "id":9660,
            "comment": "test comment",
            "user_id":16,
            "name":"Test",
            "email":"test@alloka.ru",
            "created_at": "2018-02-05T13:59:14+03:00"
          },
        ...
        ],
        "target": null
      },
      "meta": {
        "obj": {
          "oid": "d4a4827d51111111111",
          "alias": "registratsiya",
          "title": "Регистрация",
          "site_url": "http://www.alloka.ru",
          "phone_number": "79107111111",
          "expiration_date": "12.10.2018 11:44:20",
          "sip_uri": null,
          "use_sip": false,
          "sessions_reset_date": null,
          "sessions_used": null,
          "sessions": 0,
          "numbers": 1,
          "is_tracking": true,
          "status": "active",
          "is_upgradable": true,
          "calls_count": 59,
          "country": {
            "id": 203,
            "name": "Russia",
            "translated_name": "Россия"
          },
          "current_city_only": false,
          "needs_renewing": false,
          "needs_increasing": false,
          "city": {
            "id": 44421,
            "name": "Нижний Новгород",
            "name_int": "Nizhny Novgorod",
            "translated_name": "Нижний Новгород"
          },
          "custom_statuses": [
            {
              "id": 1444,
              "name": "test",
              "color": null
            },
            {
              "id": 1445,
              "name": "test1",
              "color": null
            },
            {
              "id": 1478,
              "name": "test2",
              "color": null
            },
            {
              "id": 2006,
              "name": "В бан!",
              "color": null
            },
            {
              "id": 1867,
              "name": "Ошиблись",
              "color": null
            }
          ],
          "tariff": {
            "id": 29,
            "name": "Fixed_Mini",
            "sessions": null,
            "numbers": 1,
            "multiregion": false,
            "price": 560
          },
          "tariff_items": [],
          "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        'd4a4827d51111111111': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/catch_form.js' type='text/javascript'></script>",
          "script_config": [
            "last_source",
            "type_in",
            "referrer",
            "utm",
            "block_id"
          ],
          "script_config_possible_values": {
            "last_source": 0,
            "type_in": 1,
            "referrer": 2,
            "utm": 3,
            "block_id": 4,
            "gtm": 5
          },
          "blocked_ip_list_enabled": false,
          "blocked_ip_addresses": {},
          "forward_caller_id": false,
          "email_notification_enabled": false,
          "email_notification": {
            "obj_email_notify_config": {
              "created_at": "2016-07-27T10:35:07+03:00",
              "id": 1016,
              "is_enabled": false,
              "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\r\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\r\n<b>От кого:</b> %ОТ_КОГО%\r\n<b>На номер:</b> %НА_НОМЕР%\r\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\r\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\r\n",
              "missed_only": false,
              "monitor_enabled": false,
              "monitor_recipients": null,
              "obj_id": 466922,
              "recipients": "user@alloka.ru",
              "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
              "updated_at": "2017-02-08T11:51:41+03:00"
            }
          },
          "client_phone_numbers": [
            {
              "obj_id": 466922,
              "number": "79107111111",
              "phone_number": "79107111111",
              "sip": "",
              "priority": 0,
              "redirect_timeout": 180,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            }
          ]
        },
        "statuses": {
          "cancel": 1,
          "answer": 2,
          "noanswer": 3,
          "busy": 4,
          "congestion": 5,
          "chanunavail": 6,
          "tmp_unavailable": 7,
          "catch_form": 8,
          "jivosite": 9,
          "calldron": 10,
          "sms_incoming": 11,
          "sms_forward": 12,
          "feedback": 13,
          "widget_form": 14,
          "carrot_quest": 15,
          "email_incoming": 16,
          "user_call": 17
        },
        "services": [
          {
            "id": 1,
            "service_name": "Коллбэкхантер",
            "name": "kbh",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/001/original/kbh.png?1453745223"
          },
          {
            "id": 2,
            "service_name": "Форма на сайте",
            "name": "c_f",
            "service_logo_url": "https://alloka.ru/assets/phone_logo_20x20.png"
          },
          {
            "id": 3,
            "service_name": "JivoSite",
            "name": "JivoSite",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/003/original/favicon-16x16.png?1482153488"
          },
          {
            "id": 4,
            "service_name": "Обратный звонок",
            "name": "calldron",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/004/original/%D0%A1allback_icon_fon.png?1494436479"
          },
          {
            "id": 5,
            "service_name": "SMS",
            "name": "SMS",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/005/original/sms2.png?1494434992"
          },
          {
            "id": 6,
            "service_name": "SmartCallback",
            "name": "smartcallback",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/006/original/smartcallback.png?1491909947"
          },
          {
            "id": 7,
            "service_name": "Опрос после звонка",
            "name": "feedback",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/007/original/calldron_for_alloka.png?1494436097"
          },
          {
            "id": 8,
            "service_name": "Carrot Quest",
            "name": "CarrotQuest",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/008/original/carrot-quest_2.png?1498570674"
          },
          {
            "id": 9,
            "service_name": "Email",
            "name": "Email",
            "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/009/original/email.png?1505311578"
          }
        ]
      }
    }
    
    

    Objects - объекты

    Список объектов

    Допустимые параметры фильтров:

    • status = [1,2,3,4,5]


    
    statuses: {
        pending:  1,
        check:    2,
        active:   3,
        disabled: 4,
        deleted:  5
      }
    

    GET https://api.alloka.ru/v2/objs/

    Ответ:

    
    {
      "objs": [
        {
          "oid": "111115697654c788",
          "alias": "alias",
          "title": "Obj test",
          "site_url": "http://alloka.ru",
          "phone_number": "19107911111",
          "expiration_date": null,
          "sip_uri": "19107911111",
          "use_sip": true,
          "sessions_reset_date": null,
          "sessions_used": null,
          "sessions": 0,
          "numbers": 0,
          "is_tracking": false,
          "status": "active",
          "is_upgradable": false,
          "calls_count": 0,
          "country": {
            "id": 254,
            "name": "United States",
            "translated_name": "США"
          },
          "current_city_only": false,
          "needs_renewing": false,
          "needs_increasing": false,
          "city": {
            "id": 7351,
            "name": "Palo Alto",
            "name_int": "Palo Alto",
            "translated_name": "Palo Alto"
          },
          "custom_statuses": [
            {
              "id": 2006,
              "name": "В бан!",
              "color": null
            },
            {
              "id": 1867,
              "name": "Ошиблись",
              "color": null
            }
          ],
          "tariff": null,
          "tariff_items": null,
          "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '111115697654c788': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
          "script_config": [
            "last_source",
            "type_in",
            "referrer",
            "utm"
          ],
          "script_config_possible_values": {
            "last_source": 0,
            "type_in": 1,
            "referrer": 2,
            "utm": 3,
            "block_id": 4,
            "gtm": 5
          },
          "blocked_ip_list_enabled": false,
          "blocked_ip_addresses": {},
          "forward_caller_id": true,
          "email_notification_enabled": false,
          "email_notification": {
            "obj_email_notify_config": {
              "created_at": "2017-03-29T16:51:44+03:00",
              "id": 1676,
              "is_enabled": null,
              "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
              "missed_only": null,
              "monitor_enabled": false,
              "monitor_recipients": null,
              "obj_id": 1,
              "recipients": "user@alloka.ru",
              "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
              "updated_at": "2017-03-29T16:51:44+03:00"
            }
          },
          "client_phone_numbers": [
            {
              "obj_id": 1,
              "number": "883140771111111@login.mtt.ru",
              "phone_number": "19107911111",
              "sip": "883140771111111@login.mtt.ru",
              "priority": 0,
              "redirect_timeout": 180,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            }
          ]
        },
        ...
      ],
       "meta": {
        "pagination": {
          "current_page": 1,
          "next_page": 2,
          "prev_page": null,
          "total_pages": 4,
          "total_objects": 67
        }
      }
    }
    

    Просмотр данных объекта


    GET https://api.alloka.ru/v2/objs/111115697654c788 или https://api.alloka.ru/v2/objs/alias

    Ответ:

    
    {
      "obj": {
        "oid": "111115697654c788",
        "alias": "alias",
        "title": "Obj test",
        "site_url": "http://alloka.ru",
        "phone_number": "19107911111",
        "expiration_date": null,
        "sip_uri": "19107911111",
        "use_sip": true,
        "sessions_reset_date": null,
        "sessions_used": null,
        "sessions": 0,
        "numbers": 0,
        "is_tracking": false,
        "status": "active",
        "is_upgradable": false,
        "calls_count": 0,
        "country": {
          "id": 254,
          "name": "United States",
          "translated_name": "США"
        },
        "current_city_only": false,
        "needs_renewing": false,
        "needs_increasing": false,
        "city": {
          "id": 7351,
          "name": "Palo Alto",
          "name_int": "Palo Alto",
          "translated_name": "Palo Alto"
        },
        "custom_statuses": [
          {
            "id": 2006,
            "name": "В бан!",
            "color": null
          },
          {
            "id": 1867,
            "name": "Ошиблись",
            "color": null
          }
        ],
        "tariff": null,
        "tariff_items": null,
        "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '111115697654c788': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
        "script_config": [
          "last_source",
          "type_in",
          "referrer",
          "utm"
        ],
        "script_config_possible_values": {
          "last_source": 0,
          "type_in": 1,
          "referrer": 2,
          "utm": 3,
          "block_id": 4,
          "gtm": 5
        },
        "blocked_ip_list_enabled": false,
        "blocked_ip_addresses": {},
        "forward_caller_id": true,
        "email_notification_enabled": false,
        "email_notification": {
          "obj_email_notify_config": {
            "created_at": "2017-03-29T16:51:44+03:00",
            "id": 1676,
            "is_enabled": null,
            "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
            "missed_only": null,
            "monitor_enabled": false,
            "monitor_recipients": null,
            "obj_id": 1,
            "recipients": "user@alloka.ru",
            "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
            "updated_at": "2017-03-29T16:51:44+03:00"
          }
        },
        "client_phone_numbers": [
          {
            "obj_id": 1,
            "number": "883140771111111@login.mtt.ru",
            "phone_number": "19107911111",
            "sip": "883140771111111@login.mtt.ru",
            "priority": 0,
            "redirect_timeout": 180,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          }
        ]
      }
    }
    

    Список источников и статусов для объекта


    GET https://api.alloka.ru/v2/objs/111115697654c788/filters

    Ответ:

    {
      "sources": [
        [
          "—",
          null
        ],
        [
          "Прямой заход",
          "TYPEIN"
        ],
        [
          "UTM",
          "UTM"
        ],
        [
          "Реферрер",
          "REFERRER"
        ],
        [
          "Avito",
          "AVITO"
        ],
        [
          "Avito Контекст",
          "AVITO Контекст"
        ],
        [
          "Avito Промо",
          "AVITO Промо"
        ],
        [
          "Bing",
          "BING"
        ],
        [
          "Directadvert.ru",
          "DIRECTADVERT.RU"
        ],
        [
          "Exebid",
          "EXEBID"
        ],
        [
          "Facebook",
          "FACEBOOK"
        ],
        [
          "Friendfeed",
          "FRIENDFEED"
        ],
        [
          "Google (КМС)",
          "GOOGLE (КМС)"
        ],
        [
          "Google Adwords",
          "GOOGLE_ADWORDS"
        ],
        [
          "Google Поиск",
          "GOOGLE_SEARCH"
        ],
        [
          "Google.com",
          "GOOGLE_SEARCH_COM"
        ],
        [
          "mail.ru",
          "MAILRU"
        ],
        [
          "myTarget",
          "MYTARGET"
        ],
        [
          "Rambler Поиск",
          "RAMBLER"
        ],
        [
          "Twitter",
          "TWITTER"
        ],
        [
          "VK.com",
          "VKCOM"
        ],
        [
          "Yahoo Search",
          "YAHOO"
        ],
        [
          "Бегун",
          "BEGUN"
        ],
        [
          "Каванга",
          "Каванга"
        ],
        [
          "Медийка",
          "Медийка"
        ],
        [
          "РСЯ (utm)",
          "РСЯ"
        ],
        [
          "РСЯ (yabs)",
          "YANDEX_DIRECT"
        ],
        [
          "СМИ2",
          "СМИ2"
        ],
        [
          "Таргет Mail.ru",
          "TARGET_MAILRU"
        ],
        [
          "Яндекс Баннер",
          "YANDEX_BANNER"
        ],
        [
          "Яндекс Маркет",
          "YANDEX_MARKET"
        ],
        [
          "Яндекс Поиск",
          "YANDEX_SEARCH"
        ],
        [
          "Яндекс.БаЯн",
          "YANDEX_BAYAN"
        ],
        [
          "Яндекс.Директ",
          "YANDEX_DIRECT"
        ],
        [
          "Яндекс.Маркет",
          "Яндекс.Маркет"
        ]
      ],
      "durations": [
        [
          "—",
          null
        ],
        [
          "Очень короткие (< 30 сек)",
          "lt30s"
        ],
        [
          "Короткие (30-60 сек)",
          "f30t60s"
        ],
        [
          "Средние (1-5 мин)",
          "f1t5m"
        ],
        [
          "Длинные (5-10 мин)",
          "f5t10m"
        ],
        [
          "Очень длинные (> 10 мин)",
          "gt10m"
        ],
        [
          "Более 1 минуты (> 1 мин)",
          "gt1m"
        ],
        [
          "Более 30 секунд (> 30 сек)",
          "gt30s"
        ]
      ],
      "call_statuses": [
        [
          "—",
          null
        ],
        [
          "Отмена",
          "CANCEL"
        ],
        [
          "Отвечен",
          "ANSWER"
        ],
        [
          "Нет ответа",
          "NOANSWER"
        ],
        [
          "Занято",
          "BUSY"
        ],
        [
          "Сбой",
          "CONGESTION"
        ],
        [
          "Канал недоступ.",
          "CHANUNAVAIL"
        ],
        [
          "Абонент недоступ.",
          "TMP_UNAVAILABLE"
        ],
        [
          "Перехват формы",
          "CATCH_FORM"
        ],
        [
          "Jivosite",
          "JIVOSITE"
        ],
        [
          "Обратный звонок",
          "CALLDRON"
        ],
        [
          "SMS",
          "SMS_INCOMING"
        ],
        [
          "SMS форвардинг",
          "SMS_FORWARD"
        ],
        [
          "Опрос",
          "FEEDBACK"
        ],
        [
          "Обратная связь",
          "WIDGET_FORM"
        ],
        [
          "Carrot Quest",
          "CARROT_QUEST"
        ],
        [
          "Email",
          "EMAIL_INCOMING"
        ],
        [
          "В бан!",
          2006
        ],
        [
          "Ошиблись",
          1867
        ]
      ]
    }
    

    Изменение настроек скрипта объекта


    POST https://api.alloka.ru/v2/objs/111115697654c788/script_config

    {
      "script_config": {
              "last_source": "0",
              "type_in": "1",
              "referrer": "2"
      }
    }
    

    Ответ:

    {
      "obj": {
        "oid": "111115697654c788",
        "alias": "alias",
        "title": "Obj test",
        "site_url": "http://alloka.ru",
        "phone_number": "19107911111",
        "expiration_date": null,
        "sip_uri": "19107911111",
        "use_sip": true,
        "sessions_reset_date": null,
        "sessions_used": null,
        "sessions": 0,
        "numbers": 0,
        "is_tracking": false,
        "status": "active",
        "is_upgradable": false,
        "calls_count": 0,
        "country": {
          "id": 254,
          "name": "United States",
          "translated_name": "США"
        },
        "current_city_only": false,
        "needs_renewing": false,
        "needs_increasing": false,
        "city": {
          "id": 7351,
          "name": "Palo Alto",
          "name_int": "Palo Alto",
          "translated_name": "Palo Alto"
        },
        "custom_statuses": [
          {
            "id": 2006,
            "name": "В бан!",
            "color": null
          },
          {
            "id": 1867,
            "name": "Ошиблись",
            "color": null
          }
        ],
        "tariff": null,
        "tariff_items": null,
        "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '111115697654c788': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
        "script_config": [
          "last_source",
          "type_in",
          "referrer"
        ],
        "script_config_possible_values": {
          "last_source": 0,
          "type_in": 1,
          "referrer": 2,
          "utm": 3,
          "block_id": 4,
          "gtm": 5
        },
        "blocked_ip_list_enabled": false,
        "blocked_ip_addresses": {},
        "forward_caller_id": true,
        "email_notification_enabled": false,
        "email_notification": {
          "obj_email_notify_config": {
            "created_at": "2017-03-29T16:51:44+03:00",
            "id": 1676,
            "is_enabled": null,
            "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
            "missed_only": null,
            "monitor_enabled": false,
            "monitor_recipients": null,
            "obj_id": 1,
            "recipients": "user@alloka.ru",
            "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
            "updated_at": "2017-03-29T16:51:44+03:00"
          }
        },
        "client_phone_numbers": [
          {
            "obj_id": 1,
            "number": "883140771111111@login.mtt.ru",
            "phone_number": "19107911111",
            "sip": "883140771111111@login.mtt.ru",
            "priority": 0,
            "redirect_timeout": 180,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          }
        ]
      }
    }
    

    Изменение позиции объекта в списке (сортировка)


    POST https://api.alloka.ru/v2/objs/111115697654c788/reorder

    {
      "position": "25"
    }
    

    Ответ:

    {
      "status": "ok"
    }
    

    Отправить скрипт объекта на email


    POST https://api.alloka.ru/v2/objs/111115697654c788/mail_jscode

    Ответ:

    {
      "status": "sent"
    }
    

    Изменение списка IP-адресов, с которых при посещении вашего сайта не будет происходить подмена номера.


    POST https://api.alloka.ru/v2/objs/111115697654c788/add_blocked_ipaddress

    {
      "obj_blocked_ip_list": {
        "ip_addresses": "127.0.0.1\n127.0.0.2\n127.0.0.3",
        "is_enabled": true
      }
    }
    

    Ответ:

    {
      "ip_list":
      {
        "ip_addresses": "127.0.0.1\n127.0.0.2\n127.0.0.3"
      },
      "is_enabled": "true"
    }
    

    Notifications - уведомления

    Настройка уведомлений.


    PUT https://api.alloka.ru/v2/objs/111115697654c788/email_notification

    {
      "email_notification": {
          "is_enabled": "false",
          "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
          "missed_only": "true",
          "recipients": "user@alloka.ru",
          "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%"
      }
    }
    

    Ответ:

    {
      "obj": {
        "oid": "111115697654c788",
        "alias": "alias",
        "title": "Obj test",
        "site_url": "http://alloka.ru",
        "phone_number": "19107911111",
        "expiration_date": null,
        "sip_uri": "19107911111",
        "use_sip": true,
        "sessions_reset_date": null,
        "sessions_used": null,
        "sessions": 0,
        "numbers": 0,
        "is_tracking": false,
        "status": "active",
        "is_upgradable": false,
        "calls_count": 0,
        "country": {
          "id": 254,
          "name": "United States",
          "translated_name": "США"
        },
        "current_city_only": false,
        "needs_renewing": false,
        "needs_increasing": false,
        "city": {
          "id": 7351,
          "name": "Palo Alto",
          "name_int": "Palo Alto",
          "translated_name": "Palo Alto"
        },
        "custom_statuses": [
          {
            "id": 2006,
            "name": "В бан!",
            "color": null
          },
          {
            "id": 1867,
            "name": "Ошиблись",
            "color": null
          }
        ],
        "tariff": null,
        "tariff_items": null,
        "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '111115697654c788': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
        "script_config": [
          "last_source",
          "type_in",
          "referrer"
        ],
        "script_config_possible_values": {
          "last_source": 0,
          "type_in": 1,
          "referrer": 2,
          "utm": 3,
          "block_id": 4,
          "gtm": 5
        },
        "blocked_ip_list_enabled": false,
        "blocked_ip_addresses": {},
        "forward_caller_id": true,
        "email_notification_enabled": false,
        "email_notification": {
          "obj_email_notify_config": {
            "created_at": "2017-03-29T16:51:44+03:00",
            "id": 1676,
            "is_enabled": false,
            "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
            "missed_only": true,
            "monitor_enabled": false,
            "monitor_recipients": null,
            "obj_id": 1,
            "recipients": "user@alloka.ru",
            "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
            "updated_at": "2018-01-09T13:07:01+03:00"
          }
        },
        "client_phone_numbers": [
          {
            "obj_id": 1,
            "number": "883140771111111@login.mtt.ru",
            "phone_number": "19107911111",
            "sip": "883140771111111@login.mtt.ru",
            "priority": 0,
            "redirect_timeout": 180,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          }
        ]
      }
    }
    

    Получение рейтинга по объекту.


    GET https://api.alloka.ru/v2/objs/27d2610d26bdd123/calls/rating/?per_page=20&page=1&period=custom&date_from=2017-01-01&date_to=2018-01-01

    Допустимые параметры:


    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    • order_field = [source, uri, from, duration, status, title, service], по умолчанию дата звонка

    • order_way = [ASC, DESC]

    Ответ:

    {
      "rating": [
        {
          "source": null,
          "name": null,
          "source_type": "typein",
          "avg_duration": 204.3333,
          "first_calls_count": 23,
          "repeated_calls_count": 0,
          "total_calls_count": 55
        },
        {
          "source": {
            "id": "yandex_search",
            "title": "Яндекс Поиск",
            "type": "referrer"
          },
          "name": "Яндекс Поиск",
          "source_type": "predefined",
          "avg_duration": 12.2222,
          "first_calls_count": 9,
          "repeated_calls_count": 0,
          "total_calls_count": 14
        },
        {
          "source": {
            "id": "google_search",
            "title": "Google Поиск",
            "type": "referrer"
          },
          "name": "Google Поиск",
          "source_type": "predefined",
          "avg_duration": 61,
          "first_calls_count": 3,
          "repeated_calls_count": 0,
          "total_calls_count": 13
        },
        {
          "source": null,
          "name": "undefined",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 9,
          "repeated_calls_count": 0,
          "total_calls_count": 9
        },
        {
          "source": null,
          "name": "analytics.alloka.ru",
          "source_type": "referrer",
          "avg_duration": 112.3333,
          "first_calls_count": 3,
          "repeated_calls_count": 0,
          "total_calls_count": 3
        },
        {
          "source": {
            "id": "yandex_direct",
            "title": "Яндекс.Директ",
            "type": "utm"
          },
          "name": "Яндекс.Директ (UTM)",
          "source_type": "predefined",
          "avg_duration": 709.5,
          "first_calls_count": 2,
          "repeated_calls_count": 1,
          "total_calls_count": 3
        },
        {
          "source": null,
          "name": null,
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        },
        {
          "source": null,
          "name": "help.alloka.ru",
          "source_type": "referrer",
          "avg_duration": 54,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        }
      ],
      "period": "custom",
      "obj": {
        "oid": "27d2610d26bdd123",
        "alias": "alias test",
        "title": "Test jbject",
        "site_url": "",
        "phone_number": "74991111111",
        "expiration_date": null,
        "sip_uri": null,
        "use_sip": false,
        "sessions_reset_date": null,
        "sessions_used": null,
        "sessions": 0,
        "numbers": 0,
        "is_tracking": false,
        "status": "active",
        "is_upgradable": true,
        "calls_count": 99,
        "country": {
          "id": 203,
          "name": "Russia",
          "translated_name": "Россия"
        },
        "current_city_only": false,
        "needs_renewing": false,
        "needs_increasing": false,
        "city": {
          "id": 1384,
          "name": "Москва",
          "name_int": "Moskva",
          "translated_name": "Москва"
        },
        "custom_statuses": [
          {
            "id": 4895,
            "name": "Новый Клиент",
            "color": null
          },
          {
            "id": 4905,
            "name": "Нравится!",
            "color": null
          },
          {
            "id": 4924,
            "name": "Пока не знаю",
            "color": null
          },
          {
            "id": 4896,
            "name": "Текущий клиент",
            "color": null
          },
          {
            "id": 4903,
            "name": "Тестовый",
            "color": null
          },
          {
            "id": 2006,
            "name": "В бан!",
            "color": null
          },
          {
            "id": 1867,
            "name": "Ошиблись",
            "color": null
          }
        ],
        "tariff": null,
        "tariff_items": null,
        "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '27d2610d26bdd123': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        'calldron_alloka_oid': '27d2610d26bdd123',\n        options: {\n          timerDuration: 30,\n          verticalAlign: 'bottom',\n          horizontalAlign: 'right',\n          verticalMargin: 30,\n          horizontalMargin: 30\n        }\n        ,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/roistat.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/catch_form.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/calldron/widget.js' type='text/javascript'></script><script>\n        function metrika(goal){\n          <%='yaCounter' + 6376351 + '.reachGoal(goal);'\n          };\n          </script>",
        "script_config": [
          "last_source",
          "type_in",
          "referrer",
          "utm",
          "block_id"
        ],
        "script_config_possible_values": {
          "last_source": 0,
          "type_in": 1,
          "referrer": 2,
          "utm": 3,
          "block_id": 4,
          "gtm": 5
        },
        "blocked_ip_list_enabled": true,
        "blocked_ip_addresses": [],
        "forward_caller_id": true,
        "email_notification_enabled": true,
        "email_notification": {
          "obj_email_notify_config": {
            "created_at": "2014-09-05T12:55:54+04:00",
            "id": 68,
            "is_enabled": true,
            "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\r\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\r\n<b>От кого:</b> %ОТ_КОГО%\r\n<b>Кто принял: </b> %ПЕРЕАДРЕСОВАН_НА%\r\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\r\n<b>Страница звонка:</b> %СТРАНИЦА_ЗВОНКА%\r\n<b>Название источника:</b> %НАЗВАНИЕ_ИСТОЧНИКА%\r\n<b>Реферер:</b> %РЕФЕРЕР%\r\n<b>Поисковой запрос:</b> %ПОИСКОВЫЙ_ЗАПРОС%\r\n<b>Длина звонка:</b> %ДЛИТЕЛЬНОСТЬ%\r\n<b>Запись:</b> %ЗАПИСЬ%\r\n<b>ГЕОЛОКАЦИЯ:</b> %ГЕОЛОКАЦИЯ%\r\n<b>Текст СМС</b>:%СМС%",
            "missed_only": false,
            "monitor_enabled": true,
            "monitor_recipients": "skwee@alloka.ru\r\nvl@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
            "obj_id": 77632,
            "recipients": "ter@alloka.ru\r\nskwee@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
            "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
            "updated_at": "2017-09-20T15:06:51+03:00"
          }
        },
        "client_phone_numbers": [
          {
            "obj_id": 77632,
            "number": "74991111111",
            "phone_number": "74991111111",
            "sip": "",
            "priority": 0,
            "redirect_timeout": 30,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          },
          {
            "obj_id": 77632,
            "number": "74996481111",
            "phone_number": "74996481111",
            "sip": "",
            "priority": 1,
            "redirect_timeout": 30,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          },
          {
            "obj_id": 77632,
            "number": "79202991111",
            "phone_number": "79202991111",
            "sip": "",
            "priority": 3,
            "redirect_timeout": 180,
            "record_url": null,
            "answerphone": false,
            "call_with_main": false
          }
        ]
      },
      "meta": {
        "pagination": {
          "current_page": 1,
          "next_page": null,
          "prev_page": null,
          "total_pages": 1,
          "total_objects": 8
        },
        "total_first_calls_count": 51,
        "total_repeated_calls_count": 1,
        "total_calls_count": 99,
        "avg_duration": 144
      }
    }
    

    Получение списка статусов.


    GET https://api.alloka.ru/v2/objs/27d2610d26bdd123/custom_statuses

    Ответ:

    {
      "custom_statuses": [
        {
          "id": 4895,
          "name": "Новый Клиент",
          "color": null
        },
        {
          "id": 4905,
          "name": "Нравится!",
          "color": null
        },
        {
          "id": 4924,
          "name": "Пока не знаю",
          "color": null
        },
        {
          "id": 4896,
          "name": "Текущий клиент",
          "color": null
        },
        {
          "id": 4903,
          "name": "Тестовый",
          "color": null
        },
        {
          "id": 2006,
          "name": "В бан!",
          "color": null
        },
        {
          "id": 1867,
          "name": "Ошиблись",
          "color": null
        }
      ]
    }
    

    Установка статуса звонку. Если у объекта статуса с таким именем еще нет, то он будет создан


    POST https://api.alloka.ru/v2/objs/27d2610d26bdd123/calls/2344802/set_custom_status

    {
      "custom_status": {
        "name": "Нравится!"
      }
    }
    

    Ответ:

    {
      "call": {
        "id": 2344802,
        "obj_oid": "27d2610d26bdd123",
        "date": "2017-10-09T14:25:24+03:00",
        "src": null,
        "referrer": "http://yandex.ru/clck/jsredir?text=alloka.ru&from=yandex.ru;suggest;web&state=dtype=stred/pid=1/cid=71613/part=alloka/suggestion=alloka.ru/region=10174/*&data=url=http%3A%2F%2Falloka.ru&ts=1507548292&uid=6717094561507548289&sign=268e0fd55d100f4bcff3226307613c43&ref=https://www.yandex.ru/&keyno=0&l10n=ru",
        "request_uri": "http://alloka.ru/",
        "phone_number_from": "+79219137788",
        "search_request": null,
        "status": 10,
        "utm": null,
        "custom_data": null,
        "call_type": {
          "id": 1,
          "name": "COMMON"
        },
        "record_url": null,
        "custom_status": {
          "id": 4905,
          "name": "Нравится!",
          "color": null
        },
        "customer_status": {
          "id": 10706,
          "status": "Регистрация/запрос",
          "customer_id": 9940,
          "name": "Звонок от +74957771111",
          "date_create": "2017-10-11T16:39:21+03:00",
          "price": null,
          "responsible_user": "Сергей Иванов",
          "company": "{\"Name\":\"test",\"Web\":\"http://test.com\"}",
          "date_close": null,
          "tags": "[\"alloka\"]",
          "source": "amocrm",
          "lead_id": null,
          "responsible_user_id": null
        },
        "region": null,
        "dialstatus": "Нравится!",
        "duration": 0,
        "source": {
          "title": "Яндекс Поиск",
          "url": "http://yandex.ru/clck/jsredir?text=alloka.ru&amp;from=yandex.ru;suggest;web&amp;state=dtype=stred/pid=1/cid=71613/part=alloka/suggestion=alloka.ru/region=10174/*&amp;data=url=http%3A%2F%2Falloka.ru&amp;ts=1507548292&amp;uid=6717094561507548289&amp;sign=268e0fd55d100f4bcff3226307613c43&amp;ref=https://www.yandex.ru/&amp;keyno=0&amp;l10n=ru"
        },
        "service_name": "Обратный звонок",
        "service_logo_url": "https://alloka.ru/system/third_party_services/logos/000/000/004/original/%D0%A1allback_icon_fon.png?1494436479",
        "comments": "",
        "target": null
      },
      "meta": {
        "obj": {
          "oid": "27d2610d26bdd123",
          "alias": "alias test",
          "title": "Test jbject",
          "site_url": "",
          "phone_number": "74991111111",
          "expiration_date": null,
          "sip_uri": null,
          "use_sip": false,
          "sessions_reset_date": null,
          "sessions_used": null,
          "sessions": 0,
          "numbers": 0,
          "is_tracking": false,
          "status": "active",
          "is_upgradable": true,
          "calls_count": 99,
          "country": {
            "id": 203,
            "name": "Russia",
            "translated_name": "Россия"
          },
          "current_city_only": false,
          "needs_renewing": false,
          "needs_increasing": false,
          "city": {
            "id": 1384,
            "name": "Москва",
            "name_int": "Moskva",
            "translated_name": "Москва"
          },
          "custom_statuses": [
            {
              "id": 4895,
              "name": "Новый Клиент",
              "color": null
            },
            {
              "id": 4905,
              "name": "Нравится!",
              "color": null
            },
            {
              "id": 4924,
              "name": "Пока не знаю",
              "color": null
            },
            {
              "id": 4896,
              "name": "Текущий клиент",
              "color": null
            },
            {
              "id": 4903,
              "name": "Тестовый",
              "color": null
            },
            {
              "id": 2006,
              "name": "В бан!",
              "color": null
            },
            {
              "id": 1867,
              "name": "Ошиблись",
              "color": null
            }
          ],
          "tariff": null,
          "tariff_items": null,
          "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '27d2610d26bdd123': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        'calldron_alloka_oid': '27d2610d26bdd123',\n        options: {\n          timerDuration: 30,\n          verticalAlign: 'bottom',\n          horizontalAlign: 'right',\n          verticalMargin: 30,\n          horizontalMargin: 30\n        }\n        ,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/roistat.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/catch_form.js' type='text/javascript'></script><script src='https://analytics.alloka.ru/integrations/calldron/widget.js' type='text/javascript'></script><script>\n        function metrika(goal){\n          <%='yaCounter' + 6376351 + '.reachGoal(goal);'\n          };\n          </script>",
          "script_config": [
            "last_source",
            "type_in",
            "referrer",
            "utm",
            "block_id"
          ],
          "script_config_possible_values": {
            "last_source": 0,
            "type_in": 1,
            "referrer": 2,
            "utm": 3,
            "block_id": 4,
            "gtm": 5
          },
          "blocked_ip_list_enabled": true,
          "blocked_ip_addresses": [],
          "forward_caller_id": true,
          "email_notification_enabled": true,
          "email_notification": {
            "obj_email_notify_config": {
              "created_at": "2014-09-05T12:55:54+04:00",
              "id": 68,
              "is_enabled": true,
              "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\r\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\r\n<b>От кого:</b> %ОТ_КОГО%\r\n<b>Кто принял: </b> %ПЕРЕАДРЕСОВАН_НА%\r\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\r\n<b>Страница звонка:</b> %СТРАНИЦА_ЗВОНКА%\r\n<b>Название источника:</b> %НАЗВАНИЕ_ИСТОЧНИКА%\r\n<b>Реферер:</b> %РЕФЕРЕР%\r\n<b>Поисковой запрос:</b> %ПОИСКОВЫЙ_ЗАПРОС%\r\n<b>Длина звонка:</b> %ДЛИТЕЛЬНОСТЬ%\r\n<b>Запись:</b> %ЗАПИСЬ%\r\n<b>ГЕОЛОКАЦИЯ:</b> %ГЕОЛОКАЦИЯ%\r\n<b>Текст СМС</b>:%СМС%",
              "missed_only": false,
              "monitor_enabled": true,
              "monitor_recipients": "skwee@alloka.ru\r\nvl@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
              "obj_id": 77632,
              "recipients": "ter@alloka.ru\r\nskwee@alloka.ru\r\nglov@alloka.ru\r\nnsdss@alloka.ru",
              "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
              "updated_at": "2017-09-20T15:06:51+03:00"
            }
          },
          "client_phone_numbers": [
            {
              "obj_id": 77632,
              "number": "74991111111",
              "phone_number": "74991111111",
              "sip": "",
              "priority": 0,
              "redirect_timeout": 30,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            },
            {
              "obj_id": 77632,
              "number": "74996481111",
              "phone_number": "74996481111",
              "sip": "",
              "priority": 1,
              "redirect_timeout": 30,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            },
            {
              "obj_id": 77632,
              "number": "79202991111",
              "phone_number": "79202991111",
              "sip": "",
              "priority": 3,
              "redirect_timeout": 180,
              "record_url": null,
              "answerphone": false,
              "call_with_main": false
            }
          ]
        }
      }
    }
    

    Получение рейтинга по всем объектам.


    GET https://api.alloka.ru/v2/calls/rating/?per_page=20&page=1&period=custom&date_from=2017-01-01&date_to=2018-01-01

    Допустимые параметры:


    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    • order_field = [source, uri, from, duration, status, title, service], по умолчанию дата звонка

    • order_way = [ASC, DESC]

    Ответ:

    {
      "rating": [
        {
          "source": null,
          "name": null,
          "source_type": "typein",
          "avg_duration": 240.1667,
          "first_calls_count": 32,
          "repeated_calls_count": 0,
          "total_calls_count": 101
        },
        {
          "source": null,
          "name": "alloka.ru",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 28,
          "repeated_calls_count": 0,
          "total_calls_count": 28
        },
        {
          "source": null,
          "name": "analytics.alloka.ru",
          "source_type": "referrer",
          "avg_duration": 282,
          "first_calls_count": 14,
          "repeated_calls_count": 3,
          "total_calls_count": 17
        },
        {
          "source": {
            "id": "google_search",
            "title": "Google Поиск",
            "type": "referrer"
          },
          "name": "Google Поиск",
          "source_type": "predefined",
          "avg_duration": 59.75,
          "first_calls_count": 4,
          "repeated_calls_count": 0,
          "total_calls_count": 15
        },
        {
          "source": {
            "id": "yandex_search",
            "title": "Яндекс Поиск",
            "type": "referrer"
          },
          "name": "Яндекс Поиск",
          "source_type": "predefined",
          "avg_duration": 12.2222,
          "first_calls_count": 9,
          "repeated_calls_count": 0,
          "total_calls_count": 15
        },
        {
          "source": null,
          "name": "Alloka",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 9,
          "repeated_calls_count": 0,
          "total_calls_count": 9
        },
        {
          "source": null,
          "name": "undefined",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 9,
          "repeated_calls_count": 0,
          "total_calls_count": 9
        },
        {
          "source": null,
          "name": null,
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 5,
          "repeated_calls_count": 0,
          "total_calls_count": 5
        },
        {
          "source": {
            "id": "yandex_direct",
            "title": "Яндекс.Директ",
            "type": "utm"
          },
          "name": "Яндекс.Директ (UTM)",
          "source_type": "predefined",
          "avg_duration": 709.5,
          "first_calls_count": 2,
          "repeated_calls_count": 1,
          "total_calls_count": 3
        },
        {
          "source": null,
          "name": "calldron.ru",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 2,
          "repeated_calls_count": 0,
          "total_calls_count": 2
        },
        {
          "source": null,
          "name": "allia.amocrm.ru",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        },
        {
          "source": null,
          "name": "dis.amocrm.ru",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        },
        {
          "source": null,
          "name": "help.alloka.ru",
          "source_type": "referrer",
          "avg_duration": 54,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        },
        {
          "source": null,
          "name": "new59da19a11111.amocrm.ru",
          "source_type": "referrer",
          "avg_duration": 0,
          "first_calls_count": 1,
          "repeated_calls_count": 0,
          "total_calls_count": 1
        }
      ],
      "period": "custom",
      "meta": {
        "pagination": {
          "current_page": 1,
          "next_page": null,
          "prev_page": null,
          "total_pages": 1,
          "total_objects": 14
        },
        "total_first_calls_count": 118,
        "total_repeated_calls_count": 4,
        "total_calls_count": 208,
        "avg_duration": 96
      }
    }
    

    Tariffs - тарифы

    Получение списока всех доступных тарифов.


    GET https://api.alloka.ru/v2/tariffs

    Ответ:

    {
      "tariffs": [
         {
          "id": 28,
          "name": "pro_mini",
          "sessions": 3000,
          "numbers": 4,
          "multiregion": false,
          "price": 1990,
          "tariff_items": [
            {
              "id": 30,
              "title": "+1",
              "amount": 1,
              "item_type": 2,
              "price": 200,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 31,
              "title": "+2",
              "amount": 2,
              "item_type": 2,
              "price": 400,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 32,
              "title": "+3",
              "amount": 3,
              "item_type": 2,
              "price": 600,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 96,
              "title": "+5000",
              "amount": 5000,
              "item_type": 1,
              "price": 1000,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 104,
              "title": "Обратный звонок",
              "amount": 1,
              "item_type": 4,
              "price": 1500,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 180,
              "title": "495",
              "amount": 1,
              "item_type": 11,
              "price": 40,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 186,
              "title": "красивые номера",
              "amount": 1,
              "item_type": 12,
              "price": 80,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            },
            {
              "id": 187,
              "title": "свои номера",
              "amount": 1,
              "item_type": 10,
              "price": -40,
              "active": true,
              "types": {
                "common": 0,
                "sessions": 1,
                "numbers": 2,
                "minutes": 3,
                "callbacs": 4,
                "sms_forward": 5,
                "super_region": 6,
                "unlimited_numbers": 7,
                "media_pool": 8,
                "enigma": 9,
                "foreign_numbers": 10,
                "number_495": 11,
                "beautiful_numbers": 12,
                "number_800": 13,
                "number_804": 14
              }
            }
          ]
        },
        ....
      ]
    }
    

    Информация о выбранном тарифе.


    GET https://api.alloka.ru/v2/tariffs/28

    Ответ:

    {
      "tariff": {
        "id": 28,
        "name": "pro_mini",
        "sessions": 3000,
        "numbers": 4,
        "multiregion": false,
        "price": 1990,
        "tariff_items": [
          {
            "id": 30,
            "title": "+1",
            "amount": 1,
            "item_type": 2,
            "price": 200,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 31,
            "title": "+2",
            "amount": 2,
            "item_type": 2,
            "price": 400,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 32,
            "title": "+3",
            "amount": 3,
            "item_type": 2,
            "price": 600,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 96,
            "title": "+5000",
            "amount": 5000,
            "item_type": 1,
            "price": 1000,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 104,
            "title": "Обратный звонок",
            "amount": 1,
            "item_type": 4,
            "price": 1500,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 180,
            "title": "495",
            "amount": 1,
            "item_type": 11,
            "price": 40,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 186,
            "title": "красивые номера",
            "amount": 1,
            "item_type": 12,
            "price": 80,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          },
          {
            "id": 187,
            "title": "свои номера",
            "amount": 1,
            "item_type": 10,
            "price": -40,
            "active": true,
            "types": {
              "common": 0,
              "sessions": 1,
              "numbers": 2,
              "minutes": 3,
              "callbacs": 4,
              "sms_forward": 5,
              "super_region": 6,
              "unlimited_numbers": 7,
              "media_pool": 8,
              "enigma": 9,
              "foreign_numbers": 10,
              "number_495": 11,
              "beautiful_numbers": 12,
              "number_800": 13,
              "number_804": 14
            }
          }
        ]
      }
    }
    

    Countries - страны и города.

    Информация о доступных странах и городах.


    GET https://api.alloka.ru/v2/countries

    Ответ:

    {
      "countries": [
        {
          "id": 43,
          "name": "Canada",
          "translated_name": "Canada",
          "cities": [
            {
              "id": 1182,
              "name": "Montreal",
              "name_int": "Montréal",
              "translated_name": "Montreal"
            },
            {
              "id": 1206,
              "name": "Toronto",
              "name_int": "Toronto",
              "translated_name": "Toronto"
            }
          ]
        },
        {
          "id": 203,
          "name": "Russia",
          "translated_name": "Россия",
          "cities": [
            {
              "id": 1189,
              "name": "Ижевск",
              "name_int": "Izhevsk",
              "translated_name": "Ижевск"
            },
            {
              "id": 1253,
              "name": "Kazan",
              "name_int": null,
              "translated_name": "Казань"
            },
            {
              "id": 1362,
              "name": "Челябинск",
              "name_int": "Chelyabinsk",
              "translated_name": "Челябинск"
            },
        ...
          ]
        },
        ...
      ]
    }
    

    Информация о стране и городах.


    GET https://api.alloka.ru/v2/countries/43

    Ответ:

    {
      "country": {
        "id": 43,
        "name": "Canada",
        "translated_name": "Canada",
        "cities": [
          {
            "id": 1182,
            "name": "Montreal",
            "name_int": "Montréal",
            "translated_name": "Montreal"
          },
          {
            "id": 1206,
            "name": "Toronto",
            "name_int": "Toronto",
            "translated_name": "Toronto"
          }
        ]
      }
    }
    

    Records - аудио-записи

    Получение zip архива с аудио-записями указанных звонков.


    GET https://api.alloka.ru/v2/countries/43

    Допустимые параметры:

    • call_ids = '1,2,3,4,5'

    Ответ:

    ZIP файл.

    API-key и пароль

    Получение своего API-ключа.


    GET https://api.alloka.ru/v2/users/102333443/get_api_key

    Ответ:

    {
      "api_key": "asdf111111DFdsfdTNkjc7yLu9eVmpn"
    }
    

    Сброс API-ключа.


    POST https://api.alloka.ru/v2/users/102333443/reset_api_key

    Допустимые параметры:


    • id клиента агенства
    {
      "client_id": "123"
    }
    

    Ответ:

    {
      "api_key": "asdf111111DFdsfdTNkjc7yLu9eVmpn"
    }
    

    Сброс пароля. Письмо с инструкцией будет отправлено на указанный email.


    GET https://api.alloka.ru/v2/users/102333443/?email=user@email.com

    Ответ:

    {
      "status": "mail sent"
    }
    

    Statistics - статистика

    Сводная статистика звонков по множеству объектов.


    GET https://api.alloka.ru/v2/dashboard

    Ответ:

    {
      "calls": {
        "12097acabd911111": {
          "07.01.2018": 0,
          "08.01.2018": 0,
          "09.01.2018": 0,
          "obj": {
            "oid": "12097acabd911111",
            "alias": "enigmaparent",
            "title": "enigma parent",
            "site_url": "",
            "phone_number": "74951111111",
            "expiration_date": null,
            "sip_uri": null,
            "use_sip": false,
            "sessions_reset_date": null,
            "sessions_used": null,
            "sessions": 0,
            "numbers": 0,
            "is_tracking": false,
            "status": "active",
            "is_upgradable": true,
            "calls_count": 0,
            "country": {
              "id": 203,
              "name": "Russia",
              "translated_name": "Россия"
            },
            "current_city_only": false,
            "needs_renewing": false,
            "needs_increasing": false,
            "city": {
              "id": 1384,
              "name": "Москва",
              "name_int": "Moskva",
              "translated_name": "Москва"
            },
            "custom_statuses": [
              {
                "id": 2006,
                "name": "В бан!",
                "color": null
              },
              {
                "id": 1867,
                "name": "Ошиблись",
                "color": null
              }
            ],
            "tariff": null,
            "tariff_items": null,
            "js_code": "<script type='text/javascript'>\n    var '_alloka = {\n      objects: {\n        '12097acabd911111': {\n          block_class: 'phone_alloka'\n        }\n      },\n      trackable_source_types:  [\"type_in\", \"referrer\", \"utm\"],\n      last_source: false,\n        use_geo: true};\n      </script>\n      <script src='https://analytics.alloka.ru/v4/alloka.js' type='text/javascript'></script>",
            "script_config": [
              "last_source",
              "type_in",
              "referrer",
              "utm"
            ],
            "script_config_possible_values": {
              "last_source": 0,
              "type_in": 1,
              "referrer": 2,
              "utm": 3,
              "block_id": 4,
              "gtm": 5
            },
            "blocked_ip_list_enabled": false,
            "blocked_ip_addresses": {},
            "forward_caller_id": false,
            "email_notification_enabled": false,
            "email_notification": {
              "obj_email_notify_config": {
                "created_at": "2018-01-05T16:41:18+03:00",
                "id": 2425,
                "is_enabled": null,
                "message_template": "<b>Название объекта:</b> %НАЗВАНИЕ_ОБЪЕКТА%\n<b>Дата звонка:</b> %ВРЕМЯ_ЗВОНКА%\n<b>От кого:</b> %ОТ_КОГО%\n<b>На номер:</b> %НА_НОМЕР%\n<b>Переадресован на:</b> %ПЕРЕАДРЕСОВАН_НА%\n<b>Статус звонка:</b> %СТАТУС_ЗВОНКА%\n",
                "missed_only": null,
                "monitor_enabled": false,
                "monitor_recipients": null,
                "obj_id": 11466,
                "recipients": "user@alloka.ru",
                "subject_template": "Новый звонок на %НАЗВАНИЕ_ОБЪЕКТА%",
                "updated_at": "2018-01-05T16:41:18+03:00"
              }
            },
            "client_phone_numbers": [
              {
                "obj_id": 11466,
                "number": "74951111111",
                "phone_number": "74951111111",
                "sip": "",
                "priority": 0,
                "redirect_timeout": 180,
                "record_url": null,
                "answerphone": false,
                "call_with_main": false
              }
            ]
          }
        },
        ...
      "dates": [
        "07.01.2018",
        "08.01.2018",
        "09.01.2018"
      ],
      "meta": {
        "pagination": {
          "current_page": 1,
          "next_page": 2,
          "prev_page": null,
          "total_pages": 2,
          "total_objects": 29
        }
      }
    }
    

    Сводная статистика звонков по множеству объектов для построения графика.


    GET https://api.alloka.ru/v2/charts/?period=custom&date_from=2017-10-05&date_to=2017-10-15

    Допустимые параметры:

    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    Ответ:

    {
      "calls_per_day": {
        "data": [
          {
            "name": "Кол звонков",
            "data": [
              {
                "name": "2017-10-05",
                "y": 180
              },
            ...
            ]
          },
          {
            "name": "alloka.ru",
            "data": [
              {
                "name": "2017-10-05",
                "y": 90
              },
              ...
            ]
          },
          {
            "name": "Прямой заход",
            "data": [
              {
                "name": "2017-10-05",
                "y": 33
              },
              ...
            ]
          },
          ...
        ]
      },
      "calls_per_object": {
        "data": [
          {
            "name": "Test jbject",
            "y": 99
          },
          ...
        ]
      }
    }
    

    Сводная статистика звонков по одному объекту для построения графика.


    GET https://api.alloka.ru/v2/objs/27d2613434bdbfa1/charts/?period=custom&date_from=2017-10-05&date_to=2017-10-15

    Допустимые параметры:


    • period = [day, week, month, year, all, custom]

    • date_from = '2018-12-23'

    • date_to = '2018-12-23'

    Ответ:

    {
      "calls_per_day": {
        "data": [
          {
            "name": "Кол звонков",
            "data": [
              {
                "name": "2017-10-05",
                "y": 90
              },
              ...
            ]
          },
          {
            "name": "Яндекс Поиск",
            "data": [
              {
                "name": "2017-10-05",
                "y": 50
              },
            ...
            ]
          },
          {
            "name": "Google Поиск",
            "data": [
              {
                "name": "2017-10-05",
                "y": 40
              },
            ...
            ]
          },
          {
            "name": "undefined",
            "data": [
              {
                "name": "2017-10-05",
                "y": 10
              },
              ...
            ]
          },
          {
            "name": "Прямой заход",
            "data": [
              {
                "name": "2017-10-05",
                "y": 10
              },
              ...
            ]
          }
        ]
      },
      "source": {
        "data": [
          {
            "name": "Прямой заход",
            "y": 10
          },
          {
            "name": "Яндекс Поиск",
            "y": 50
          },
          {
            "name": "Google Поиск",
            "y": 40
          },
          {
            "name": "undefined",
            "y": 10
          }
        ]
      },
      "duration": {
        "categories": [
          "&lt; 30 сек",
          "30-60 сек",
          "1-5 мин",
          "5-10 мин"
        ],
        "data": [
          80,
          20,
          19,
          20
        ]
      },
      "pages": {
        "data": [
          {
            "name": "https://alloka.ru/",
            "y": 12
          },
          ...
        ]
      },
      "status": {
        "data": [
          {
            "name": "Отвечен",
            "y": 20
          },
          ...
        ]
      },
      "mobile": {
        "data": [
          {
            "name": "Мобильный",
            "y": 50
          },
          {
            "name": "Городской",
            "y": 80
          }
        ]
      }
    }