Method upload.offline_messages
Description Uploading offline applications
Available to Agent, Client
Necessary components for working with the method Data API, Loading offline applications from an external system
Maximum number of applications in one request 50 pcs

Required parameters:
- visitor_session_id, campaign_id or site_id (if several parameters are specified, the data must be consistent)
- phone or email

Request parameters

Title Type Required Valid values ​​ Description
access_token string yes Authentication session key
user_id number no Unique user identifier of the agent client on behalf of which the request is made
Is required for the agent
To obtain a list of client users, you must use the method "get.customer_users"
offline_messages array yes List of offline applications.
Maximum 50
date_time iso8601 yes YYYY-MM-DD hh:mm:ss Date and time the request was created.
Can't be in the future.
Must be greater than the transmitted visitor session.
If the parameter is not passed, the time of the call will be entered
phone string yes, if not specified email Visitor phone number in E164 format
email string yes, if not specified phone Visitor Email
message string no Visitor message
visitor_session_id number yes, if campaign_id or site_id is not specified Unique identifier of the visitor session received from CallGear. To get the ID, you must use the JS API method Comagic.getSessionId(). In this case, the session must be created no earlier than 180 дней to date_time
campaign_id number yes, if visitor_session_id or site_id is not specified Unique identifier for an advertising campaign in CallGear. To get campaign_id you can use the Data API method "get.campaigns".
If "campaign_id": -1 is transmitted, then be sure to specify site_id.
source_id number no Unique source identifier. It is possible to transfer only a non-remote source in the context of the client. If visitor_session_id is passed, then we will define source_id using the session parameters.
site_id number yes, if campaign_id or visitor_session_id is not specified Unique site identifier.
form_name string no Name of the custom JS Form.
user_fields array no Custom fields added to the application. Before passing, you need to create a user field using the method "create.offline_message_user_field"

JSON request structure```json

{ "jsonrpc": "2.0", "id": "number", "method": "upload.offline_messages", "params": { "access_token": "string", "user_id": "number", "offline_messages": [ { "date_time": "iso8601", "name": "string", "phone": "string", "email": "string", "message": "string", "visitor_session_id": "number", "campaign_id": "number", "source_id": "number", "site_id": "number", "form_name": "string", "ext_id": "string", "user_fields": [ { "ext_id": "string", "value": "string" }, { "ext_id": "string", "value": "string" } ] } ] } }

### JSON response structure```json
{
    "jsonrpc": "2.0",
    "id": "number",
    "result": {
        "data": [
            {
                "id": "number"
            }
        ],
        "metadata": "object"
    }
}

List of returned errors

Look at the section "List of errors for methods with the verb upload"