Uploading chats
Method | upload.chats |
---|---|
Description | Uploading chats |
Who has access | Agent, Customer |
Components required to work with the method | Data API, Uploading offline inquiries from an outside system |
Maximum number of inquiries per request | 500 |
Required parameters:
- session_id, campaign_id or site_id (if several parameters are stated, the data should be consistent)
- phone or email
Parameters of a request
Title | Type | Required | Valid value | Description |
---|---|---|---|---|
access_token |
string | yes | Authentication session key | |
user_id |
number | no | Unique user ID of a customer of an agent who makes request. Is mandatory for agentYpu can get access to a list of customer users via the method "get.customer_users" |
|
chats |
array | yes | List of chats. Maximum 500 |
|
start_date_time |
iso8601 | yes | YYYY-MM-DD hh:mm:ss | Date and time Can't be in the future. |
name |
string | no | Username | |
phone |
string | no | Visitor's phone number in the format E164 | |
email |
string | no | Visitor's email | |
status |
enum | yes | lost,succeed, refused | Chat status lost (lost); |
initiator |
enum | no | operator, visitor,autoinvite | Chat initiator autoinvite (autoinvite), If the parameter is not given, the first source of a message will be used ("source") |
visitor_session_id |
number | no | Unique ID of a visitor's session from CallGear. To get an ID you need to use the method JS API CallGear.getSessionId() | |
campaign_id |
number | no | Unique ID of an advertising campaign in CallGear. To get campaign_id you can use Data API "get.campaigns" | |
site_id |
number | no | Unique website ID | |
messages |
array | yes | List of messages in a chat | |
date_time |
iso8601 | yes | YYYY-MM-DD hh:mm:ss | Date and time when a message was sent Can't be in the future. |
source |
enum | yes | operator, visitor,system | Message source system (autoinvite), |
employee_id |
number | no | Unique ID of an employee, required if source = operator(Operator)Chat will be appointed to the last employee who sent a message |
|
message |
string | yes | Message |
JSON request structure
{
"jsonrpc": "2.0",
"id": "number",
"method": "upload.chats",
"params": {
"access_token": "string",
"user_id": "number",
"chats": [
{
"start_date_time": "iso8601",
"name": "string",
"phone": "string",
"email": "string",
"status": "enum [lost,succeed, refused]",
"initiator": "enum [operator, visitor,autoinvite]",
"visitor_session_id": "number",
"campaign_id": "number",
"site_id": "number",
"messages": [
{
"date_time": "iso8601",
"source": "enum [operator, visitor, system]",
"employee_id": "number",
"message": "string"
}
]
}
]
}
}
JSON reply structure
{
"jsonrpc": "2.0",
"id": "number",
"result": {
"data": [
{
"id": "number"
}
],
"metadata": "object"
}
}
List of returning errors
Refer to "List of errors common for methods with the verb upload"