Задать вопрос

Телефония

Примечание

API телефонии работает в тестовом режиме. Дополнительное описание API присутствует в каждом аккаунте Мегаплана по адресу /api/v3/docs

Маршрут звонка (умный перевод на ответственного)

URI: /api/v3/callRoute/?{"phone": "{phoneNmber}"}

METHOD: GET

Входные параметры

phoneNumber - JSON строка - номер телефона который звонит (79991231212)

Выходные данные

CallRoute

{
    "contentType": "CallRoute",
    "type": "string",
    "timeout": "integer",
    "employees": {
        "contentType": "Employee",
        "firstName": "string",
        "lastName": "string",
        "middleName": "string",
        "name": "string",
        "position": "string",
        "uid": "integer",
        "gender": "string",
        "contactInfo": null,
        "birthday": {
            "contentType": "DateOnly",
            "year": "integer",
            "month": "integer",
            "day": "integer"
        },
        "age": "integer",
        "availableActions": "string",
        "unreadNewsCount": "integer",
        "dateLastReadNews": "string",
        "availableTransports": "string",
        "id": "string",
        "avatar": {
            "contentType": "File",
            "name": "string",
            "extension": "string",
            "size": "integer",
            "path": "string",
            "mimeType": "string",
            "timeCreated": {
                "contentType": "DateTime",
                "value": "string"
            },
            "width": "integer",
            "thumbnail": "string",
            "possibleActions": "string",
            "id": "string"
        }
    }
}

CallInfo объект

{
    "contentType": "CallInfo",
    "fromPhone": "string",
    "toPhone": "string",
    "fromUser": { // | null
        "contentType": "Employee | ContractorHuman | ContractorClient",
        "id":  "integer"
    },
    "toUser": { // | null
        "contentType": "Employee | ContractorHuman | ContractorClient",
        "id":  "integer"
    },
    "providerId": "string", // JSON id звонка на стороне провайдера телефонии
    "timeFrom": {
        "contentType": "DateTime",
        "value": "string"
    },
    "timeTo": {
        "contentType": "DateTime",
        "value": "string"
    },
    "type": "in | out | conf | miss | fail",
    "state": "calling | talking | finished | failed | hold",
    "recordLinks": "[string]", // JSON массив строк с ссылками на запись разговора
    "id": "integer" // Id звонка в мегаплане
}

Событие звонка

Здесь передаются все события входящий, исходящий, разговор, завершение звонка и т.д.

URI: /api/v3/callInfo

METHOD: POST

Входные параметры

Body:

{
    "contentType": "CallInfo",
    "fromPhone": "string",
    "toPhone": "string",
    "fromUser": null,
    "toUser": null,
    "providerId": "string",
    "timeFrom": {
        "contentType": "DateTime",
        "value": "string"
    },
    "timeTo": {
        "contentType": "DateTime",
        "value": "string"
    },
    "type": "in | out | conf | miss | fail",
    "state": "calling | talking | finished | failed | hold",
    "recordLinks": "string",
    "id": "string"
}

Выходные данные

Response:

{
    "contentType": "CallInfo",
    "fromPhone": "string",
    "toPhone": "string",
    "fromUser": null,
    "toUser": null,
    "providerId": "string",
    "timeFrom": {
        "contentType": "DateTime",
        "value": "string"
    },
    "timeTo": {
        "contentType": "DateTime",
        "value": "string"
    },
    "type": "in | out | conf | miss | fail",
    "state": "calling | talking | finished | failed | hold",
    "recordLinks": "string",
    "id": "string"
}

История разговоров

URI: /api/v3/сallHistory

METHOD: POST

Входные параметры

Body:

Массив сущностей CallInfo

[
    {
        "contentType": "CallInfo",
        "fromPhone": "string",
        "toPhone": "string",
        "fromUser": null,
        "toUser": null,
        "providerId": "string",
        "timeFrom": {
            "contentType": "DateTime",
            "value": "string"
        },
        "timeTo": {
            "contentType": "DateTime",
            "value": "string"
        },
        "type": "in | out | conf | miss | fail",
        "state": "calling | talking | finished | failed | hold",
        "recordLinks": "string",
        "id": "string"
    }
    ....
]

Выходные данные

Response:

Массив созданных или обновленных сущностей

[
    {
        "contentType": "CallInfo",
        "fromPhone": "string",
        "toPhone": "string",
        "fromUser": null,
        "toUser": null,
        "providerId": "string",
        "timeFrom": {
            "contentType": "DateTime",
            "value": "string"
        },
        "timeTo": {
            "contentType": "DateTime",
            "value": "string"
        },
        "type": "in | out | conf | miss | fail",
        "state": "calling | talking | finished | failed | hold",
        "recordLinks": "string",
        "id": "string"
    }
    ....
]

Список настроек пользователей для телефонии

URI: /api/v3/callUserConfig

METHOD: GET

Выходные данные

Response:

[{
    "contentType": "CallUserConfig",
    "employee": {
        "contentType": "Employee",
        "firstName": "string",
        "lastName": "string",
        "middleName": "string",
        "name": "string",
        "position": "string",
        "uid": "integer",
        "gender": "string",
        "contactInfo": null,
        "birthday": {
            "contentType": "DateOnly",
            "year": "integer",
            "month": "integer",
            "day": "integer"
        },
        "age": "integer",
        "availableActions": "string",
        "unreadNewsCount": "integer",
        "dateLastReadNews": "string",
        "availableTransports": "string",
        "id": "string",
        "avatar": {
            "contentType": "File",
            "name": "string",
            "extension": "string",
            "size": "integer",
            "path": "string",
            "mimeType": "string",
            "timeCreated": {
                "contentType": "DateTime",
                "value": "string"
            },
            "width": "integer",
            "thumbnail": "string",
            "possibleActions": "string",
            "id": "string"
        }
    },
    "settings": "string",
    "internalNumber": "string",
    "id": "string"
}]

Настройка пользователя для телефонии

URI: /api/v3/callUserConfig/{id}

METHOD: GET | PUT | POST

Входные параметры

id - integer - Id Конфигурации

Body:

{
    "contentType": "CallInfo",
    "fromPhone": "string",
    "toPhone": "string",
    "fromUser": null,
    "toUser": null,
    "providerId": "string",
    "timeFrom": {
        "contentType": "DateTime",
        "value": "string"
    },
    "timeTo": {
        "contentType": "DateTime",
        "value": "string"
    },
    "type": "in | out | conf | miss | fail",
    "state": "calling | talking | finished | failed | hold",
    "recordLinks": "string",
    "id": "string"
}

Выходные данные

Response:

{
    "contentType": "CallUserConfig",
    "employee": {
        "contentType": "Employee",
        "firstName": "string",
        "lastName": "string",
        "middleName": "string",
        "name": "string",
        "position": "string",
        "uid": "integer",
        "gender": "string",
        "contactInfo": null,
        "birthday": {
            "contentType": "DateOnly",
            "year": "integer",
            "month": "integer",
            "day": "integer"
        },
        "age": "integer",
        "availableActions": "string",
        "unreadNewsCount": "integer",
        "dateLastReadNews": "string",
        "availableTransports": "string",
        "id": "string",
        "avatar": {
            "contentType": "File",
            "name": "string",
            "extension": "string",
            "size": "integer",
            "path": "string",
            "mimeType": "string",
            "timeCreated": {
                "contentType": "DateTime",
                "value": "string"
            },
            "width": "integer",
            "thumbnail": "string",
            "possibleActions": "string",
            "id": "string"
        }
    },
    "settings": "string",
    "internalNumber": "string",
    "id": "string"
}

Настройка пользователя для телефонии по id сотрудника

URI: /api/v3/сallUserConfig/Employee/{employeeId}

METHOD: GET

Входные параметры

employeeId - integer - Id сотрудника

Выходные данные

Response:

{
    "contentType": "CallUserConfig",
    "employee": {
        "contentType": "Employee",
        "firstName": "string",
        "lastName": "string",
        "middleName": "string",
        "name": "string",
        "position": "string",
        "uid": "integer",
        "gender": "string",
        "contactInfo": null,
        "birthday": {
            "contentType": "DateOnly",
            "year": "integer",
            "month": "integer",
            "day": "integer"
        },
        "age": "integer",
        "availableActions": "string",
        "unreadNewsCount": "integer",
        "dateLastReadNews": "string",
        "availableTransports": "string",
        "id": "string",
        "avatar": {
            "contentType": "File",
            "name": "string",
            "extension": "string",
            "size": "integer",
            "path": "string",
            "mimeType": "string",
            "timeCreated": {
                "contentType": "DateTime",
                "value": "string"
            },
            "width": "integer",
            "thumbnail": "string",
            "possibleActions": "string",
            "id": "string"
        }
    },
    "settings": "string",
    "internalNumber": "string",
    "id": "string"
}