Live Chat API
# Live Chat API
# API Declaration
The "token" param must be contained in the header of the https request when calling the API.
Token is the only global API call credential for the Sobot API open platform. It is used when developers call the business APIs and thus should be properly kept. At least 32 chars should be reserved to store token. The validity period of token is currently 24 hours. It needs to be refreshed regularly or reacquired according to the token failure prompt returned by the API. When requesting the token API, regardless of the existence of token, a new token will be returned and its expiry time will be reset (currently 24 hours).
Token usage description:
- Developers need to obtain and manage the token uniformly. When calling the Sobot open APIs of various business, they should use the same token, instead of refreshing and obtaining new tokens for each business. Otherwise, it will easily lead to token invalidation and affect the normal API call.
- The current validity period of the token is transmitted by the returned expire_in, which is currently a value within 86,400 s. Developers need to refresh the new token in advance based on this valid time.
- Developers should reacquire the token according to the token invalidation prompt returned by the API.
# API Call
# ● Get the Access Token Code
API description:
Get the open API token, which is only applicable to all APIs of Sobot Open Platform v5.0. Contact the Sobot after-sales service personnel to get appid and app_key in the API.
Request method:
GET
Request URL:
https://sg.sobot.io/api/get_token
Request param:
Param | Type | Required | Description |
---|---|---|---|
appid | String | Yes | API credential ID, the unique API call credential ID for the 3rd-party users |
create_time | String | Yes | Timestamp (s), e.g.: timestamp 1569397773 for 2019-09-25 15:49:33 |
sign | String | Yes | Signature, md5(appid + create_time + app_key) sign signature, app_key is private key |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
token | String | Yes | token code |
expires_in | String | Yes | Credential valid time |
Timestamp conversion tool:
http://tool.chinaz.com/Tools/unixtime.aspx
sign signature generation example:
E.g., appid = "1"; create_time="1569397773"; app_key="2"
sign = Md5("115693977732") is 258eec3118705112b2c53dc8043d4d34.
Request example:
curl https://sg.sobot.io/api/get_token?appid=1&create_time=1569397773&sign=258eec3118705112b2c53dc8043d4d34
Return example:
{
"item": {
"token": "4ac37cb2e9c740dba4b75a34d5358802",
"expires_in": "86400"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# ● Request for Agent
API description:
API type: Active call API
API function: Support initiating a request for chat between user and agent as a user by calling this API and establishing a chat
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/chat_connect
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
partnerid | String | Yes | The enterprise's user ID, which can be passed by the enterprise itself |
source | String | No | Customer source: 0-PC, 1-WeChat, 2-SDK, 3-Weibo, 4-H5 |
channel_id | String | No | Sub-channel id |
agentid | String | No | Designate agent ID |
tran_flag | String | No | Whether to transfer to the designated agent alone: 1-Yes, 0-No |
groupid | String | No | Designate skill group |
params | String(json) | No | Custom Param |
user_tels | String | No | User's phone no. |
user_emails | String | No | User's e-mail |
user_name | String | No | User's real name |
user_nick | String | No | User's nickname |
user_img | String | No | User avatar |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
Item object:
Param | Type | Required | Description |
---|---|---|---|
status | Integer | Status: -1: Rejected due to repeated request, 0: Queuing, 1: Succeeded, 2: No agent, 3: Blacklisted | |
agent_name | String | Agent Name | |
agent_face | String | Agent Avatar | |
agentid | String | Agent ID | |
visitorid | String | User ID | |
cid | String | Chat ID | |
count | Integer | Queuing position |
Request example:
curl https://sg.sobot.io/api/chat/5/user/chat_connect
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"partnerid" : "123",
"source" : "0",
"agentid" : "61673ee8d98d4282a95cdad38ffd5f5b",
"tran_flag" : "1",
"params" : "{\\"name\\":\\"lxl\\",\\"age\\":18}",
"user_tels" : "13778967890 ;13278907890",
"user_emails" : "xiaoming@1com; xiaoming2@1com",
"user_img":"https://sobot-www.oss-cn.aliyuncs.com/0019JPG",
"user_name" : "xiaoming"
}'
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Return example:
{
"item": {
"status": 1,
"visitorid" :"fdd445a5b10f303297752dc3625db648",
"agent_name" :"admin01",
"agent_face":"https://sobot-www.oss-cn.aliyuncs.com/61125123PNG",
"agentid":"61673ee8d98d4282a95cdad38ffd5f5b",
"cid":"eca9155a77384d64bb64a132e8459b7e"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
# ● Customer inquires agent
API description:
API type: Active call API
API function: Support sending messages to agent as a user by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/chat_send
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
partnerid | String | Yes | The enterprise's user ID, which can be passed by the enterprise itself |
content | String | Yes | User question |
msg_type | String | No | Message type (text, image, voice; it's text by default. When it's image or voice, content will pass the image or audio URL, and audio supports mp3 and wav) |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
status | String | Status: 1: Succeeded, 2: User was not connected to agent |
Request example:
curl https://sg.sobot.io/api/chat/5/user/chat_send
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d ' {
"partnerid": "123",
"content": "https://bbs.sangfor.com.cn/data/attachment/sfchat/image/20687/15719849png",
"msg_type": "image"
} '
2
3
4
5
6
7
8
9
10
Return example:
{
"item": {
"status": "1"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
# ● Agent message push
API description:
API type: Callback API
API function: Sobot system will push agent messages to the user's pre-configured callback URL.
Param description:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | System code 2: Live chat business | |
type | String | Message type chat_user_msg: Users receive messages | |
is_encrypt | String | Whether to encrypt, true: Encrypt, false: Not encrypt | |
content | Object | For message content details, see the table below |
Message content:
Param | Type | Required | Description |
---|---|---|---|
msg_code | String | Message code: 200: Customer accesses to agent; 201: Customer receives queue position change; 202: Customer receives messages from agent; 204: Customer goes offline; 209: Customer receives agent evaluation invitation | |
msgid | String | Message ID | |
msg_type | String | Message type: text (including html tag), image | |
msg | String | Message Content | |
agentid | String | Agent ID | |
agent_nick | String | Agent Nickname | |
agent_face | String | Agent Avatar | |
partnerid | String | Customer docking ID | |
params | String | Customer docking custom field | |
cid | String | Chat ID |
Request method:
POST
Type:
1) Customer accesses to chat:
{
"sys_code":"2",
"type":"chat_user_msg",
"is_encrypt":"false",
"content":{
"cid":"a3afd241d1064780a508cbf644fc93bd",
"agent_nick":"admin01",
"msgid":"d25f2bfe4f8f4573af5751f6ab61ea70",
"agent_face":"https://sobot-test.oss-cn.aliyuncs.com/coPNG",
"partnerid":"222",
"msg_code":"200",
"params":{
"name":"xiaoming",
"age":18
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2) Customer receives queue position change:
{
"sys_code":"2",
"type":"chat_user_msg",
"is_encrypt":"false",
"content":{
"cid":"a3afd241d1064780a508cbf644fc93bd",
"msg_code":"201",
"count":"3",
"msgid":"5646d04350e84f689ca855153c58c0f9",
"partnerid":"222",
"params":"{'name':'xiaoming','age': 18}"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
3) Customer receives messages from agent:
{
"sys_code":"2",
"type":"chat_user_msg",
"isEncrypt":"false",
"content":{
"cid":"a3afd241d1064780a508cbf644fc93bd",
"msg":"222",
"agent_nick":"admin01",
"msgid":"ab48f1e755ac766d8732501a3ef1a1161573465172716",
"msg_type":"text",
"agent_face":"https://sobot-test.oss-cn.aliyuncs.com/co123PNG",
"partnerid":"222",
"msg_code":"202",
"params":""
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
4) Customer goes offline:
{
"sys_code":"2",
"type":"chat_user_msg",
"is_encrypt":"false",
"content":{
"cid":"a3afd241d1064780a508cbf644fc93bd",
"msg_code":"204",
"msgid":"eda5990841fc4f42a8a1ea5ef731a0c6",
"partnerid":"222",
"params":""
}
}
2
3
4
5
6
7
8
9
10
11
12
5) Customer receives agent evaluation invitation:
{
"sys_code":"2",
"type":"chat_user_msg",
"is_encrypt":"false",
"content":{
"agentid":"61673ee8d98d4282a95cdad38ffd5f5b",
"msg_code":"209",
"agent_nick":"admin01",
"msgid":"68bab5d926334703a8a8c790aa99dd03",
"partnerid":"222",
"params":{
"name":"xiaoming",
"age":18
},
"cid":"83766ca85b3a4159b05b00b82dc12197"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ● Customer evaluation
API description:
API type: Active call API
API function: Support user to give satisfaction evaluation by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/comment
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
partnerid | String | Yes | The enterprise's user ID, which can be passed by the enterprise itself |
type | String | Yes | Evaluation type: 0: Bot evaluation, 1: Agent evaluation |
solved | String | Yes | Evaluation result: 0: Unresolved, 1: Resolved |
score | String | No | Agent evaluation score (1, 2, 3, 4, 5) |
tag | String | No | Evaluation tag. In case of two or more tags, use "," to separate them |
remark | String | No | Evaluation |
comment_type | String | No | Evaluation type: 0: Invited evaluation, 1: Proactive evaluation |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
status | Integer | Status: 0. Failed; 1. Succeeded; 2: Evaluated; 3: No inquiry,Evaluation unavailable | |
cid | String | Chat ID |
Request example:
curl https://sg.sobot.io/api/chat/5/user/comment
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"partnerid" : "123",
"type" : "1",
"solved" : "1"
}'
2
3
4
5
6
7
8
9
10
Return example:
{
"item": {
"status":1,
"cid":"eca9155a77384d64bb64a132e8459b7e"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# ● Customer ends chat
API description:
API type: Active call API
API function: Support user to end the current chat by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/out
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
partnerid | String | Yes | The enterprise's user ID, which can be passed by the enterprise itself |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
status | Integer | Status: 1. Succeeded |
Request example:
curl https://sg.sobot.io/api/chat/5/user/out
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"partnerid" : "123"
}'
2
3
4
5
6
7
8
Return example:
{
"item": {
"status":1
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
# ● Query offline messages
API description:
API type: Active call API
API function: Support user to get offline messages sent by agent after the chat ends by calling this API For users docked by the open platform API, no offline message data are available because all messages will be pushed to the message URL.
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/offline_msg_data
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
visitorid | String | Yes | Visitor ID |
timezone | String | NO | timezone |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
size | Integer | Offline messages | |
msg_data | List | Agent list and the corresponding agent message list |
msg_data object:
Param | Type | Required | Description |
---|---|---|---|
sender | String | Sender ID | |
sender_name | String | Sender nickname | |
send_face | String | Sender avatar | |
msg_list | List | Message list |
msg_list object:
Param | Type | Required | Description |
---|---|---|---|
cid | String | Chat ID | |
msg | String | Message body | |
ts | String | Message sending time | |
t | String | Message sending time stamp(Millisecond level) |
Request example:
curl https://sg.sobot.io/api/chat/5/user/offline_msg_data
-X POST
-H 'language: en'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"visitorid" : "xx",
"timezone":"Asia/Shanghai"
}'
2
3
4
5
6
7
8
Return example:
{
"item": {
"size": 2,
"msg_data":[
{
"sender": "61673ee8d98d4282a95cdad38ffd5f5b",
"sender_name": "admin01",
"sender_face":"https://sobot-www.oss-cn.aliyuncs.com/console/25123PNG",
"msg_list": [
{
"cid": "c36d04f18b4e48eaa88e7a5c93212a0a",
"msg": "111",
"ts": "2019-10-31 19:13:57",
"t": "1676459190000"
},
{
"cid": "c36d04f18b4e48eaa88e7a5c93212a0a",
"msg": "222",
"ts": "2019-10-31 19:13:59",
"t": "1676459190000"
}
]
}
]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# ● Query customer chat list
API description:
API type: Active call API
API function: Support acquiring a user's chat record list (cid list) in the system by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/query_cids
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
visitorid | String | YES | Visitor ID: Select either visitorid or partnerid |
partnerid | String | NO | The enterprise's user ID, which can be passed by the enterprise itself |
start_time | String | NO | Start time |
timezone | String | NO | timezone |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
items | List | No | Object list |
items object:
Param | Type | Required | Description |
---|---|---|---|
cid | String | Chat ID | |
start_date_time | Long | Chat time: millisecond | |
visitorid | String | Visitor ID |
Request example:
curl https://sg.sobot.io/api/chat/5/user/query_cids
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"visitorid" : "xx"
}'
2
3
4
5
6
7
8
Return example:
{
"items": [
{
"cid": "825a57e755a240559e03deec267e6463",
"start_date_time": 1568603119126,
"visitorid": "7f27b999bbe94274ab1a738568aba137"
},
{
"cid": "1874cbc483b64d4b9f1b7f06de083638",
"start_date_time": 1568613840540,
"visitorid": "7f27b999bbe94274ab1a738568aba137"
}
],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ● Query customer chat records
API description:
API type: Active call API
API function: Support acquiring the detail records of a chat by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/get_detail_by_cid
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
cid | String | Yes | Chat ID |
partnerid | String | No | Enterprise's user ID: for open platform users |
from | Integer | No | Source: 0: Open platform; 1: PC/H5/SDK |
visitorid | String | No | Sobot user ID: for all users |
name_flag | Integer | No | Agent name type: 0: Nickname (default); 1: Real name |
timezone | String | No | timezone |
Description:
Three query modes: cid, visitorid, partnerid + from; Mode priority: cid, visitorid, partnerid + from;
When visitorid or partnerid + from is passed in, it indicates querying the user's last chat record.
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
items | List | No | Object list |
items object:
Param | Type | Required | Description |
---|---|---|---|
sender_name | String | Sender nickname | |
sender_type | Integer | Sender type: 0: User, 1: Bot, 2: Agent | |
sender_face | String | Sender avatar | |
receiver_name | String | Receiver nickname | |
receiver_type | Integer | Receiver type: 0: User, 1: Bot, 2: Agent | |
receiver_face | String | Receiver avatar | |
leave_msg_flag | String | User Submission 1-Submission (1 for submission, 0 for default) | |
sender | String | Sender ID | |
receiver | String | Receiver ID | |
msgid | String | Message ID | |
ts | String | Sending time format: yyyy-MM-dd HH:mm:ss | |
t | String | Sending time format: millisecond timestamp | |
msg | String | Chat Message | |
msg_type | Integer | Message type: 0: text, 1: image, 2: audio, 3: rich text | |
cid | String | Chat ID |
Request example:
curl https://sg.sobot.io/api/chat/5/user/get_detail_by_cid
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"cid" : "49142902cfa74f2d9af8e7c1b546221d",
"name_flag" : 1
}'
2
3
4
5
6
7
8
9
Return example:
{
"items": [{
"cid": "49142902cfa74f2d9af8e7c1b546221d",
"msg":"<img src='http://bbs.sangfor.com.cn/data/attachment/sfchat/image/201910/154687/15719849png' class='webchat_img_upload upNowImg uploadedFile'>",
"msg_type": 1,
"msgid": "ab221eb4fbde4ea0b9fa728448470503",
"receiver": "61673ee8d98d4282a95cdad38ffd5f5b",
"receiver_name": "admin01",
"receiver_type": 2,
"sender": "fdd445a5b10f303297752dc3625db648",
"sender_face": "https://sobot-www.oss-cn.aliyuncs.com/console/7e20834c439748c780ca9648ca6c0cde/userImage/20161207150019JPG",
"sender_name": "xiaoming",
"sender_type": 0,
"t": "1572514382820",
"ts": "2019-10-31 17:33:02"
}],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ● Query agent work time
API description:
API type: Active call API
API function: Support acquiring the work time of livechat group by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/admin_is_work
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
groupid | String | No | Skill group ID |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
is_work | Boolean | Work status: true: On duty, false: Off duty |
Request example:
curl --location --request POST 'https://sg.sobot.io/api/chat/5/user/admin_is_work?groupid=1d89fad9e31d4498b1196f7580666e52' \
--header 'language: en' \
--header 'token: 4ac37cb2e9c740dba4b75a34d5358802' \
--header 'content-type: application/json' \
--data-raw ''
2
3
4
5
Return example:
{
"item": {
"is_work": true
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
# ● Query agent real-time data
API description:
API type: Active call API
API function: Support acquiring the list of currently online agents and their status in the system by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/get_once_data
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param: None
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
item object:
Param | Type | Required | Description |
---|---|---|---|
admin_list | List | Online agent list. For details, see the text below | |
admin_size | Integer | No. of online agents | |
online_user_size | Integer | No. of online users | |
wait_user_size | Integer | No. of queuing users | |
robot_user_size | Integer | No. of bot chats |
admin_list object:
Param | Type | Required | Description |
---|---|---|---|
agentid | String | Agent ID | |
group_name | List | Agent skill group name list | |
groupid | List | Agent skill group ID list | |
count | Integer | No. of users received by agent in real time | |
agent_email | String | Agent Email | |
status | Integer | Agent status (1: online, 2: occupied) | |
status_code | Integer | Custom status: 3. Break; 4. Training; 5. Meeting; 6. Dining; 7. Active | |
agent_name | String | Agent Name | |
agent_face | String | Agent Avatar | |
remark | String | Agent note | |
agent_nick | String | Agent Nickname | |
max_count | Integer | Agent reception maximum | |
status_time | String | Status duration time format: hh:mm:ss |
Request example:
curl https://sg.sobot.io/api/chat/5/user/get_once_data
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
2
3
4
5
Return example:
{
"item": {
"wait_user_size": 0,
"admin_size": 1,
"online_user_size": 0,
"robot_user_size": 0,
"admin_list": [
{
"agentid": "61673ee8d98d4282a95cdad38ffd5f5b",
"status_code": 0,
"agent_name": "admin01",
"agent_email": "123456@1com",
"group_name": [
"group01",
"group02",
"group03"
],
"groupid": [
"c4a3a9b8bc5742079d57d154ef2e2cc2",
"ef06c796d2b64218afc511dab1cd1283",
"a457f4dfe92842f8a11d1616c1c58dc1"
],
"count": 0,
"agent_face": "https://sobot-www.oss-cn.aliyuncs.com/console/7e25123PNG",
"remark ": "hello",
"max_count": 10,
"service_no": "1",
"status_time": "06:53:56",
"agent_nick": "admin01",
"status": 1
}
]
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ● Query online skill group list
API description:
API type: Active call API
API function: Support querying details of all online agent skill groups in the current system by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/query_group
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param: None
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
items | List | No | Object list |
items object:
Param | Type | Required | Description |
---|---|---|---|
groupid | String | Skill group ID | |
group_name | String | Skill Group Name | |
create_time | Long | Creation time (second timestamp) |
Request example:
curl https://sg.sobot.io/api/chat/5/user/query_group
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
2
3
4
5
Return example:
{
"items": [{
"groupid" : "c4a3a9b8bc5742079d57d154ef2e2cc2",
"group_name" : "group01",
"create_time" : 1540176885
}],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
# ● Query online agent list
API description:
API type: Active call API
API function: Support querying details of all online agents in the current system by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/chat/5/user/query_agent
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
timezone | String | No | timezone |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
items | List | No | Object list |
items object:
Param | Type | Required | Description |
---|---|---|---|
agentid | String | Agent ID | |
group_name | List | Agent skill group name list | |
groupid | List | Agent skill group ID list | |
agent_email | String | Agent Email | |
agent_name | String | Agent Name | |
role_name | String | Role | |
agent_no | String | Agent work no. | |
agent_status | String | Agent status, 0: Not activated, 1: Enabled, 2: Platform controlled, 9: Disable, -1: Delete | |
create_time | String | Creation time (yyyy-MM-dd) | |
department_name | String | Department Name | |
createTimeAbs | String | Creation time time stamp (Millisecond level) |
Request example:
curl https://sg.sobot.io/api/chat/5/user/query_agent
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
2
3
4
5
Return example:
{
"items": [
{
"agent_email": "123456@1com",
"agent_name": "admin01",
"agent_no": "1",
"agent_status": "1",
"agentid": "61673ee8d98d4282a95cdad38ffd5f5b",
"create_time": "2016-04-19",
"department_name": "head office",
"group_name": [
"group01",
"group02",
"group03"
],
"groupid": [
"c4a3a9b8bc5742079d57d154ef2e2cc2",
"ef06c796d2b64218afc511dab1cd1283",
"a457f4dfe92842f8a11d1616c1c58dc1"
],
"role_name": "super admin"
}
],
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# ● Query service summary record
API description:
API type: Active call API
API function: Support acquiring service summary records by calling this API
Request method:
POST
Request URL:
https://sg.sobot.io/api/wb/5/data/query_summary
request headers:
Param | Type | Required | Description |
---|---|---|---|
language | String | Yes | Language identifiers: en-English, zh-Chinese |
Request param:
Param | Type | Required | Description |
---|---|---|---|
cid | String | Yes | Chat ID: cid |
Return param:
Param | Type | Required | Description |
---|---|---|---|
ret_code | String | Yes | Return code |
ret_msg | String | Yes | Return message |
item | Object | No | Return object |
Item object:
Service Summary
Param | Type | Required | Description |
---|---|---|---|
summary_new_or_old_flag | Integer | 0. No service summary submitted 1. Online old version service summary submitted 2. Service summary submitted | |
summary_classify_codes | String | Service category code | |
summary_classify_names | String | Service Category | |
summary_classify_paths | String | Service category path | |
summary_template_name | String | Service Template | |
summary_handle_progress | Integer | Processing Progress | |
summary_handle_progress_name | String | Processing progress name | |
remark | String | Note | |
customer_fields | List | Custom Field | |
summary_staff_name | String | Summary Agent | |
update_time | String | Summary Time | |
cid | String | Chat ID |
Online old service summary
Param | Type | Required | Description |
---|---|---|---|
summary_new_or_old_flag | Integer | 0. No service summary submitted 1. Online old version service summary submitted 2. Service summary submitted | |
summary_flag | String | Summary status: 1: Summarized, 0: Unsummarized | |
update_time | String | Summary Time | |
operation_name | String | Business Unit | |
req_type_name | String | Business type | |
question_status | String | Resolution status: 1: Resolved, 0: Unresolved | |
question_description | String | Note description | |
invalid_session | String | Invalid chat: 1: Invalid, 0: Valid | |
fields | List | Custom field list | |
summary_staff_name | String | Summary Agent | |
cid | String | Chat ID |
fields object:
Param | Type | Required | Description |
---|---|---|---|
fieldid | String | Field ID | |
field_name | String | Field name | |
field_value | String | Field value |
Request example:
curl https://sg.sobot.io/api/wb/5/data/query_summary
-X POST
-H 'language: en'
-H 'content-type:application/json'
-H 'token: 4ac37cb2e9c740dba4b75a34d5358802 '
-d '{
"cid": "xx"
}'
2
3
4
5
6
7
8
Return example:
Service Summary
{
"item": {
"cid": "3cd40201989943df8cd1ed845efcb043",
"summary_new_or_old_flag": 2,
"summary_classify_codes": "0003,0002",
"summary_classify_names": "0003A,0002B",
"summary_classify_paths": "AAA/0003A,AAA/0002B",
"summary_template_name": "default1",
"summary_staff_name": "admin01",
"summary_handle_progress": "2",
"summary_handle_progress_name": "Resolve",
"remark": "summary",
"customer_fields": [
{
"fieldid": "28f002c873c344d9a8f9b3606830dfbb",
"field_name": "field01",
"field_value": "value01"
},
{
"fieldid": "9b9086c5bed84016af5adf273d41110e",
"field_name": "field02",
"field_value": "value02"
}
],
"update_time": "1554716281854"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Online old service summary
{
"item": {
"cid": "3cd40201989943df8cd1ed845efcb043",
"summary_flag": "1",
"operation_name": "Business Unit",
"req_type_name": "type01,type02",
"summary_staff_name": "admin01",
"question_status": "1",
"question_description": "remark some question",
"fields": [
{
"fieldid": "28f002c873c344d9a8f9b3606830dfbb",
"field_name": "field01",
"field_value": "value01"
},
{
"fieldid": "9b9086c5bed84016af5adf273d41110e",
"field_name": "field02",
"field_value": "value02"
}
],
"invalid_session": "0",
"update_time": "1554716281854"
},
"ret_code": "000000",
"ret_msg": "success"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Error code
# ● Operation Done
Error code | Error description |
---|---|
000000 | Operation done (Any code other than this code is an error code) |
# ● System Exception
Error code | Error description |
---|---|
900001 | Null token |
900002 | Token expired. Get a new one |
900003 | Incorrect signature |
900004 | Company api configuration info not found |
999999 | Unknown System Exception |
# ● Business Exception
Error code | Error description |
---|---|
200001 | Partnerid not passed |
200002 | Company info not found |
200003 | Visitor info not found |
200004 | Param cannot be null |
200005 | Entry ID or entry name not passed |
200006 | The visitor is offline and cannot evaluate |
200007 | The message has been evaluated and cannot be evaluated again |
200008 | Message content is not passed |
200009 | Evaluation type is not passed |
200010 | Evaluation result is not passed |
200011 | Chat ID is not passed |
200012 | Message ID is not passed |
200013 | Evaluation status is not passed |
200014 | Bot info is not passed |
210001 | Email not registered |
210002 | Email cannot be blank |