查询单个聊天记录
服务描述
此接口根据会话id查询会话的详细聊天记录
开发须知
调用本接口前,请先获取appId
服务地址
GET https://{您的专属域名}/chat/openapi/v1/chat/chatRecordHistoryStaff
请求参数
参数 | 位置 | 类型 | 是否必填 | 说明 |
---|---|---|---|---|
appId | header | String | Y | 应用ID |
timestamp | header | String | Y | 时间戳,毫秒 |
sign | header | String | Y | 签名 |
Content-Type | header | String | Y | application/json |
botSessionId | url地址栏 | String | Y | 会话id |
pageNum | url地址栏 | int | N | 页码,从0开始 |
pageSize | url地址栏 | int | N | 页大小,默认100 |
请求数据示例:
GET https://{您的专属域名}/chat/openapi/v1/chat/chatRecordHistoryStaff?botSessionId=12&pageNum=0&pageSize=99
返回结果
参数 | 类型 | 说明 |
---|---|---|
code | String | 结果码 |
message | String | 结果描述 |
data | Page<BotChatRecordHistoryDTO> | 聊天记录分页数据 |
Page<BotChatRecordHistoryDTO>
参数 | 类型 | 说明 |
---|---|---|
list | List<BotChatRecordHistoryDTO> | 聊天记录列表数据 |
size | Integer | 实际获取到的数据条数 |
total | Long | 总页数*每页数据条数(pageSize) |
注意:由于智能客服一般是一问一答。一问一答算一条记录,但是返回的列表分开成了2条数据(机器人欢迎语除外)。
BotChatRecordHistoryDTO
参数 | 类型 | 说明 |
---|---|---|
fromTerminal | String | 发送终端,user_h5:用户;kf_web:坐席 |
content | String | 聊天内容 |
contentType | String | 消息内容类型(image:图片,audio:语音,file:文件,video:视频) |
chatType | int | 聊天类型[人工-聊天(0),系统-欢迎语(1),系统-访客超时未回复提示消息(10),系统-访客超时未回复-结束会话文案消息(20)] |
type | String | 消息类型[发起会话(chat_probe),聊天消息(chat),用户离开(chat_close),评价消息(evaluate),消息撤回(revoke)] |
uuid | String | 聊天消息uuid |
time | Long | 消息发送时间戳 |
msgFrom | String | 消息发送者id |
preSessionId | String | 上一通会话ID |
返回结果示例:
{
"code": "10000",
"message": "调用成功",
"data": {
"total": 9,
"size": 9,
"list": [{
"id": "10001",
"fromTerminal": "user_h5",
"content": "你好,请问在吗",
"contentType": "none",
"chatType": 0,
"type": "chat_close",
"uuid": "d2d0a56215e74a2dba2d833f0358b5c3",
"time": 1603095164030,
"complte": false,
"msgFrom": "dd72912aea3d44f4afdf82b53889b81e",
"preSessionId":""
}, {
"id": "10002",
"fromTerminal": "你好,在的",
"content": "evaluate_close",
"contentType": "none",
"chatType": 0,
"type": "evaluate",
"uuid": "AFA9C8EC6DEBCE6A204F3ABC91BA04EF",
"time": 1603095163951,
"complte": false,
"msgFrom": "2697",
"preSessionId":"10001"
}, {
"id": "10003",
"fromTerminal": "user_h5",
"content": "请问你们短信功能能批量发送20000条数据不?",
"contentType": "none",
"chatType": 0,
"type": "chat",
"uuid": "8A6B5C285D5F4FD9A004B890D8A1F6CD",
"time": 1603095150949,
"complte": false,
"msgFrom": "dd72912aea3d44f4afdf82b53889b81e",
"preSessionId":"10002"
}, {
"id": "10004",
"fromTerminal": "user_h5",
"content": "你好,我们是可以支持的",
"contentType": "none",
"chatType": 0,
"type": "chat",
"uuid": "5146D4A85A29F41D2D6AB5C3894C63B4",
"time": 1603095149289,
"complte": false,
"msgFrom": "dd72912aea3d44f4afdf82b53889b81e",
"preSessionId":"10003"
}, {
"id": "10005",
"fromTerminal": "kf_web",
"content": "撒旦发射点",
"contentType": "none",
"chatType": 0,
"type": "chat",
"uuid": "301C8BA64777840A082F9A978BCFCE03",
"time": 1603095145804,
"complte": false,
"msgFrom": "2697",
"preSessionId":"10004"
}, {
"id": "10006",
"fromTerminal": "kf_web",
"content": "sdafds",
"contentType": "none",
"chatType": 0,
"type": "chat",
"uuid": "BF015571522A9C011B7E19C8E86B4EF2",
"time": 1603095143695,
"complte": false,
"msgFrom": "2697",
"preSessionId":"10005"
}, {
"id": "10007",
"fromTerminal": "user_h5",
"content": "dsfasd",
"contentType": "none",
"chatType": 0,
"type": "chat",
"uuid": "AB4AA66C9B01D63D95D8992BF8E6E22C",
"time": 1603095134878,
"complte": false,
"msgFrom": "dd72912aea3d44f4afdf82b53889b81e",
"preSessionId":"10006"
}, {
"id": "10008",
"fromTerminal": "kf_web",
"content": "<p>您好,我是您的专属客服小马,请问有什么可以帮您?😗</p>",
"contentType": "none",
"chatType": 1,
"type": "chat",
"uuid": "5086BE8B5AC77E948EEF5A7295C5C105",
"time": 1603095128712,
"complte": false,
"msgFrom": "2697",
"preSessionId":"10007"
}, {
"id": "10009",
"fromTerminal": "user_h5",
"content": "hello",
"contentType": "none",
"chatType": 0,
"type": "chat_probe",
"uuid": "E5AABD2187AB23A785881377F39E99D0",
"time": 1603095127919,
"complte": false,
"msgFrom": "dd72912aea3d44f4afdf82b53889b81e",
"preSessionId":"10008"
}]
}
}
内容说明
contentType为如下类型时:image:图片,audio:语音,file:文件
对应的content内容如下:
contentType | content |
---|---|
video | @@video src= groupName=imqcloud20190402 &fileName=M00/06/03/CvcKkWC47paAcZkUAAynlNX4BLI153.mp4 title=628.mp4 size=829332 suffix=video/mp4 @@ |
image | @@img src= groupName=imqcloud20190402 &fileName=M00/06/03/CvcKbGC47oOAV4PoAAMI7Vucnf8083.png |groupName=imqcloud20190402 &fileName=M00/06/03/CvcKj2C47oOAOYm9AADMWxYXrtc593.png @@ |
file | @@file src= groupName=imqcloud20190402& fileName=M00/06/03/CvcKbGC4-T-AEU67AGE8yk8UmZc15.docx title=自动化.docx size=6372554 suffix=application/vnd.openxmlformats-officedocument.wordprocessingml.document @@ |
第三方拿到内容以后解析出来groupName 以及 fileName ,然后调用获取聊天图片视频接口下载视频或者图片
结果码说明
结果码 | 说明 |
---|---|
10000 | 请求成功 |
20001 | 请求失败 |
21002 | 认证失败,请重新登录 |