此接口用来获取从微信、网页、机器人来的历史会话记录。
| 名称 | 类型 | 注释 |
|---|---|---|
| r_id | int | 会话id |
| type | tinyint | 会话来源:1-客户端,2-网页,3-微信,4-机器人,5-客服,8-第三方 |
| support_id | int | 处理客服id |
| support_name | varchar | 处理客服名字 |
| uname | varchar | 用户标识 |
| start_time | datetime | 会话开始时间,格式为:2017-08-20 |
| end_time | datetime | 会话结束时间,格式为:2017-08-20 |
| client_ip | varchar | 用户IP |
| ip_info | varchar | 用户IP详情 |
| evaluate | tinyint | 评价:0-未评价,1-满意,2-一般,3-不满意 |
| evaluate_time | datetime | 评价时间,格式为:2017-08-20 |
| evaluate_remark | text | 评价内容 |
| end_type | tinyint | 服务结束类型,取值为:1-客户主动结束服务,2-客服主动结束服务 |
| servicer_msg_count | int | 客服发出的消息总数 |
| client_msg_count | int | 客户发出的消息总数 |
| first_response | int | 客服第一次响应时间距离服务开始时间的秒数 |
| contents | varchar | 聊天记录的资源url |
| response_speed | int | 响应时常(s) |
| chat_clue | varchar | 线索 |
{
"r_id": "122",
"type": "2",
"support_id": "2321",
"support_name": "张三",
"uname": "u3_o2_slufdbltr0cylrmrcokice",
"start_time": "2017-8-23 12:23:12",
"end_time": "2017-8-23 12:23:12",
"client_ip": "114.248.128.190",
"ip_info": "归属地为北京市",
"evaluate": "1",
"evaluate_time": "2017-8-23 12:44:12",
"evaluate_remark": "服务态度很好",
"end_type": "1",
"servicer_msg_count": "23",
"client_msg_count": "25",
"response_speed": "0",
"chat_clue": "",
"first_response": "34",
"contents": "https://www.bangwo8.com/api/v1/imchat/chatrecords/122.json"
}
| 名称 | 类型 | 注释 |
|---|---|---|
| spokesman | varchar | 发言人的名字。发言人是客服时,返回客服姓名,发言人是用户时,返回用户标识 |
| spokesman_identity | tinyint | 发言人的身份:1-客服,2-用户,3-机器人 |
| msg | text | 聊天内容 |
| create_time | datetime | 消息发送时间 |
{
"spokesman": "u2_6_412696422494",
"spokesman_identity": "2",
"msg": "kj",
"create_time": "2018-10-24 15:14:12"
}
GET /api/v1/imchat/histories.json
说明:返回所有的会话记录,默认按编号升序排列。
调用者权限
管理员
调用参数
| 名称 | 必填 | 类型 | 注释 |
|---|---|---|---|
| uname | 否 | int | 按用户标识筛选 |
| servicestart_start | 否 | datetime | 按服务开始时间筛选:开始时间 |
| servicestart_end | 否 | datetime | 按服务开始时间筛选:结束时间 |
| serviceend_start | 否 | datetime | 按服务结束时间筛选:开始时间 |
| serviceend_end | 否 | datetime | 按服务结束时间筛选:结束时间 |
| page | 否 | int | 分页获取,默认为1 |
| per_page | 否 | int | 每页大小,默认为100 |
说明:默认按编码升序返回。时间参数(servicestart_start、servicestart_end、serviceend_start、updated_end)格式为“2012-01-01”,结束时间是包含当前时间的,例如结束时间为2017-08-29,则返回的记录包含2017-08-29当天的。
调用示例
curl https://www.bangwo8.com/api/v1/imchat/histories.json -v -u {account}:{password}
返回值示例
{
"chats": [
{
"r_id": 111,
"type": "1",
...
},
{
"r_id": 112,
"type": "2",
...
}
...
],
"count": 42,
"next_page": "https://www.bangwo8.com/api/v1/imchat/histories.json?per_page=40&page=2",
"previous_page": null
}
GET /api/v1/imchat/histories/{id}.json
说明:返回当前客服的所有会话记录,默认按编号升序排列。
调用者权限
管理员
调用参数
| 名称 | 必填 | 类型 | 注释 |
|---|---|---|---|
| uname | 否 | int | 按用户标识筛选 |
| servicestart_start | 否 | datetime | 按服务开始时间筛选:开始时间 |
| servicestart_end | 否 | datetime | 按服务开始时间筛选:结束时间,与servicestart_start成对出现 |
| serviceend_start | 否 | datetime | 按服务结束时间筛选:开始时间 |
| serviceend_end | 否 | datetime | 按服务结束时间筛选:结束时间,与serviceend_start成对出现 |
| page | 否 | int | 分页获取,默认为1 |
| per_page | 否 | int | 每页大小,默认为100 |
说明:默认按编码升序返回。时间参数(servicestart_start、servicestart_end、serviceend_start、serviceend_end)格式为“2012-01-01”,结束时间是包含当前时间的,例如结束时间为2017-08-29,则返回的记录包含2017-08-29当天的。
调用示例
curl https://www.bangwo8.com/api/v1/imchat/histories/12323.json -v -u {account}:{password}
返回值示例
{
"chats": [
{
"r_id": 111,
"type": "1",
...
},
{
"r_id": 112,
"type": "2",
...
}
...
],
"count": 42,
"next_page": "https://www.bangwo8.com/api/v1/imchat/histories/12323.json?per_page=40&page=2",
"previous_page": null
}
GET /api/v1/imchat/chatrecords/{id}.json
调用者权限
所有客服
调用参数
| 名称 | 必填 | 类型 | 注释 |
|---|---|---|---|
| time_start | 否 | datetime | 按聊天内容发送日期筛选:开始时间,格式为:2017-8-27 |
| time_end | 否 | datetime | 按聊天内容发送日期筛选:结束时间,格式为:2017-8-27,与time_start成对出现 |
| page | 否 | int | 分页获取,默认为1 |
| per_page | 否 | int | 每页大小,默认为100 |
调用示例
curl https://www.bangwo8.com/api/v1/imchat/chatrecords/221.json -v -u {account}:{password}
返回值示例
Status: 200 OK
{
"im_chatrecords":{
"r_id":"221",
"contents":[
{
"spokesman":213,
"spokesman_identity":1,
"msg":"这里是具体的聊天内容",
"create_time":"2017-8-23 13:12:23"
},
{
"spokesman":234,
"spokesman_identity":1,
"msg":"这里是具体的聊天内容",
"create_time":"2017-8-23 13:12:23"
}
...
]
},
"count":42,
"next_page":"https://www.bangwo8.com/api/v1/imchat/chatrecords/221.json?per_page=40&page=2",
"previous_page":null
}
请求参数
| 名称 | 必填 | 类型 | 注释 |
|---|---|---|---|
| r_Id | 是 | int | 会话id |
| servicesummary_type | 是 | int | 1-im 2-呼叫中心 3-远程协助 获取在线聊天的会话服务总结servicesummary_type=1 |
请求地址
GET /api/v1/servicesummary/{r_Id}.json
说明:接口返回值中的级联类型的字段,当前接口默认返回的是选项ID,以下接口可返回选项内容,而非选项ID
GET /api/v1/servicesummary_v2/{r_Id}.json
调用者权限
所有客服
调用示例
curl https://www.bangwo8.com/api/v1/servicesummary/221.json?servicesummary_type=1 -v -u {account}:{password}
返回参数
| 名称 | 只读 | 类型 | 注释 |
|---|---|---|---|
| ticketTemplateName | 是 | String | 模板名称 |
| custom_fields | 是 | array | 服务总结模板自定义字段 |
返回值示例
{
"status":"200" ,
"message":"Successful",
"data":{
"serviceSummary":{
"ticketTemplateName": "im服务总结模板",
"custom_fields": [//自定义字段
{
"key": "field_1",//自定义字段的唯一标识,可从帮我吧后台查看
"value": "4334"
},
{
"key": "field_3",//自定义字段的唯一标识,可从帮我吧后台查看
"value": "1" //复选框
},
{
"key": "field_2",
"value": "下拉菜单的某一项"
},
{
"key": "field_4",
"value": "附件的下载地址" //附件多个时,以逗号分隔
}
]
}
}
}
没有绑定服务总结模板返回示例
{
"status":"120001" ,
"message":"No service summary template",
}
未填写服务总结返回示例
{
"status":"120002" ,
"message":"No service summary information",
}
请求参数
| 名称 | 必填 | 类型 | 注释 |
|---|---|---|---|
| time_start | 否 | datetime | 开始时间,包含当天 |
| time_end | 否 | datetime | 结束时间,包含当天 |
请求地址
GET /api/v1/serviceState/{sId}.json
调用者权限
管理员
调用示例
curl -X GET -v -u {account}:{password} https://www.bangwo8.com/api/v1/serviceState/356789.json?time_start=2020-06-08&time_end=2020-06-08
返回参数
| 名称 | 类型 | 注释 |
|---|---|---|
| sId | int | 客服id |
| currentState | string | 客服IM当前状态 |
| data | array | 切换状态时间列表 |
返回值示例
Status: 200 OK
{
"serviceState":{
"sId":356789,
"currentState":"离线",
"data":{
"2020-06-08 09:00:07":"在线",
"2020-06-08 12:00:10":"离线",
"2020-06-08 13:30:07":"在线"
}
}
}