Uploads chats
| Method | upload.chats |
|---|---|
| Description | Uploads chats |
| Available to | Agent, Client |
| Required components | Data API and Upload Chats from an External System |
| Maximum chats per request | 50 |
Required parameter combinations
-
Provide at least one of visitor_session_id, campaign_id, or site_id. If you provide more than one, the values must refer to the same context.
-
Provide at least one of phone or email.
Request parameters
| Name | Type | Required | Valid values | Description |
|---|---|---|---|---|
access_token |
string | yes | Access token used to authenticate the request. | |
user_id |
number | no | Unique ID of the client user on whose behalf the agent is making the request. Required for agents. To retrieve a list of client users, use the "get.customer_users" method. | |
chats |
array | yes | Chats to upload. Maximum: 50. | |
start_date_time |
iso8601 | yes | YYYY-MM-DD hh:mm:ss | Date and time when the chat started. Must not be in the future and must be later than the associated visitor session. |
phone |
string | no | Visitor phone number in E.164 format. | |
email |
string | no | Visitor email address. | |
status |
enum | yes | lost, succeeded, refused | Chat status. If initiator is visitor and the chat contains no operator or visitor messages, CallGear ignores the supplied value and sets status to lost. |
initiator |
enum | no | operator, visitor, autoinvite | Chat initiator. If omitted, the source of the first message is used. |
visitor_session_id |
number | no | CallGear visitor session ID, obtained using Comagic.getSessionId(). The session must have been created no more than 180 days before start_date_time. | |
campaign_id |
number | no | CallGear advertising campaign ID. Use "get.campaigns" to retrieve campaign IDs. campaign_id cannot be -1. | |
source_id |
number | no | CallGear traffic source ID. Only active sources belonging to the client account can be specified. When visitor_session_id is provided, source_id is derived from the session. | |
messages |
array | yes | Messages in the chat. | |
date_time |
iso8601 | yes | YYYY-MM-DD hh:mm:ss | Date and time when the message was sent. Must not be in the future and must be later than start_date_time. |
source |
enum | yes | operator, visitor, system | Message sender. |
employee_id |
number | no | CallGear employee ID. Required when source is operator. The employee who sent the final operator message is assigned to the chat. | |
message |
string | yes | Message text. | |
ext_id |
string | no | Unique chat ID in your system. |
Example request
{
"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",
"source_id": "number",
"site_id": "number",
"messages": [
{
"date_time": "iso8601",
"source": "enum [operator, visitor, system]",
"employee_id": "number",
"message": "string"
}
],
"ext_id": "string"
}
]
}
}
Example response
{
"jsonrpc": "2.0",
"id": "number",
"result": {
"data": [
{
"id": "number"
}
],
"metadata": "object"
}
}
Possible errors
See the "Errors for upload methods" section.