注意,以下接口的使用都需要进行接口鉴权
1.查询在线客服会话接口
-
HTTP请求方式:POST
-
请求url:{HOST}/v20170418/webChat/queryWebchatSession/{ACCOUNTID}?sig={sig}
-
请求时请将{HOST}换成对接数据查询中获取到的请求域名,{ACCOUNTID}替换为账户编号,{SIG}是根据鉴权规则生成的,请看鉴权文档,查看具体的生成规则
-
鉴权文档:接口鉴权
-
频次限制:20次/每分钟
-
查询数据限制:默认最多返回1000条数据
请求示例:
http://apis.7moor.com/v20170418/webChat/queryWebchatSession/N00000000556
?sig=DBD2D28F3D895AAD1572925AAE50AEA8
请求体
字段 | 类型 | 是否必须 | 备注 |
_id | String | 否 | 主键 |
sName | String | 否 | 用户名称 |
createTimeBegin | String | 否 | 创建时间开始,格式yyyy-MM-dd hh:mm:00 |
createTimeEnd | String | 否 | 创建时间结束,格式yyyy-MM-dd hh:mm:00 |
beginTimeBegin | String | 否 | 开始时间开始,格式yyyy-MM-dd hh:mm:00 |
beginTimeEnd | String | 否 | 开始时间结束,格式yyyy-MM-dd hh:mm:00 |
endTimeBegin | String | 否 | 结束时间开始,格式yyyy-MM-dd hh:mm:00 |
endTimeEnd | String | 否 | 结束时间结束,格式yyyy-MM-dd hh:mm:00 |
manualTimeBegin | String | 否 | 人工时间开始,格式yyyy-MM-dd hh:mm:00 |
manualTimeEnd | String | 否 | 人工时间结束,格式yyyy-MM-dd hh:mm:00 |
msgCountType | String | 否 | “gt” : “大于”,“lt”: “小于“,“eq”:”等于”.消息条数范围,和msgCount一起使用。例如:msgCountType的值为”gt”, msgCount的值为”100”,就组成一个查询条件是”消息条数大于100” |
msgCount | String | 否 | 消息条数,和msgCountType一起使用。例如:msgCountType的值为”gt”, msgCount的值为”100”,就组成一个查询条件是”消息条数大于100” |
area | String | 否 | 地域 |
page | int | 否 | 查询第几页数据,默认1 |
pageSize | int | 否 | 每页数量,默认100 |
请求体示例
{
"createTimeBegin": "2020-11-07 00:00:00",
"createTimeEnd": "2020-12-07 00:00:00",
"beginTimeBegin": "2020-11-07 00:00:00",
"beginTimeEnd": "2020-12-07 00:00:00",
"endTimeBegin": "2020-11-07 00:00:00",
"endTimeEnd": "2020-12-07 00:00:00",
"manualTimeBegin": "2020-11-07 00:00:00",
"manualTimeEnd": "2020-12-07 00:00:00",
"msgCountType": "gt",
"msgCount": "5"
}
返回值:
字段 | 含义 |
code | 响应码 |
message | 响应信息 |
data | 返回数据,JSON格式 |
finishAllReason | 会话结束类型 完整数据 |
data:
count | 查询到的在线客服会话数 |
webchatSession | 在线客服会话数据 |
webchatSession
_id | 会话主键 |
sid | 访客id |
type | 类型,默认webchat 在线客服 |
status | 状态 undeal待领取 deal 已领取 finish 已关闭 unassign 未分配 invalid 无效的 changePeer 已流转 |
account | 账户编号 |
createTime | 创建时间 |
accessId | 用户植入七陌代码中的accessId的值 |
platform | 平台来源 pc 网站咨询 wap wap咨询 sdk app咨询 weixin 微信咨询 |
sName | 用户名称 |
customerId | 用户Id(没有关联用户返回“NA”) |
seoSource | 搜索来源 |
seoKeywords | 关键字 |
ip | IP地址 |
fromUrl | 咨询页面url值 |
urlTitle | 咨询页面title |
area | 地域 |
toPeer | 所属技能组 |
manualTime | 人工开始时间 时间戳 |
user | 所属坐席 |
lastClaimTime | 最后领取时间 时间戳 |
beginTime | 坐席领取时间 格式 yyyy-MM-dd hh:mm:ss |
agentClaimTime | 坐席领取时间 时间戳 |
manualTime | 人工时间 |
lastAgentMsgTimeStamp | 坐席最后一下回复的时间 |
firstReplyTime | 第一次回复的时间 |
replyMsgCount | 客服回复消息数 |
totalMsgCount | 消息总数 |
msgCount | 用户发送消息数 |
lastCustomerMsgTimeStamp | 用户最后一条消息的时间 |
fromUser | 流转前坐席 |
lastRedirectTime | 上次转接|抢接|转技能组时间 |
previousPeer | 流转前技能组 |
username | 所属坐席名称 |
lastRedirectUserTime | 直接转坐席的时间 |
startCustomerWaitTimeStamp | 用户开始等待的时间戳 |
remark | 备注 |
finishReason | 结束类型 |
finishUser | 结束坐席 |
endTime | 会话结束时间 |
otherParams | 扩展字段中数据。"otherParams": { "customField": { "name": "小明", "age": 18 } } |
code :
代码 | 含义 |
200 | 请求成功 |
400 | 请求体参数错误 |
403 | 接口访问频次达到上限或者鉴权失败 |
500 | 服务器错误 |
返回200示例
{
"code": 200,
"message": "success!",
"data": {
"count": 2,
"webchatSession": [
{
"_id": "0b611750-b9df-11eb-a1d5-fbbe5001fc4d",
"sid": "f53372c0-b9de-11eb-ac4c-97248b52f7a1",
"type": "webchat",
"status": "deal",
"account": "N00000022688",
"createTime": "2021-05-21 10:48:38",
"createTimeStamp": 1621565318475,
"accessId": "9db19f70-b531-11ea-a6a9-0f67401481c2",
"platform": "wap",
"autoClaimVersion": "0.5216360280704826_1621565379690",
"sName": "mmkjjx2vL3N",
"userStatus": "offline",
"seoSource": "",
"seoKeywords": "",
"ip": "xxx.xxx.xxx.xxx",
"biUpdateTime": "2021-05-21 10:51:33",
"fromUrl": "http://123456",
"urlTitle": "lyhtest",
"referrer": "undefined",
"otherParams": {},
"firstOtherParams": {},
"isNewVisitor": false,
"area": "中国 四川 成都",
"toPeer": "testlyh",
"manualTime": 1621565355738,
"startCustomerWaitTimeStamp": 1621565379690,
"robotCid": "",
"leakNum": 0,
"msgCount": 3,
"totalMsgCount": 3,
"lastTimeStamp": 1621565460640,
"lastCustomerMsgTimeStamp": 1621565460640,
"lastMessage": {
"contentType": "text",
"content": "转人工"
},
"lastMessageFrom": "customer",
"serviceMan": "manual",
"user": "[8001]李雨航测试账号(yuhang)",
"lastClaimTime": 1621565379690,
"beginTime": "2021-05-21 10:49:39",
"agentClaimTime": 1621565379690,
"havePushNoAgentMsg": false,
"history": [
{
"user": "8001",
"time": "2021-05-21 10:49:39",
"type": "claim"
}
],
"masterArr": [
"ad2704c0-b52e-11ea-b5b7-3bb3af3a00d1"
],
"autoClaimVersions": [
"0.5216360280704826_1621565379690"
],
"sBreakTime": 1621565493729,
"customerId": "NA"
},
{
"_id": "004d17b0-b9df-11eb-958b-a1d46e6359a7",
"sid": "e78937e0-b9de-11eb-a566-b507ac37cfd4",
"type": "webchat",
"status": "invalid",
"account": "N00000022688",
"createTime": "2021-05-21 10:48:19",
"createTimeStamp": 1621565299887,
"accessId": "9db19f70-b531-11ea-a6a9-0f67401481c2",
"platform": "wap",
"autoClaimVersion": "0.020611627802199495_1621565299887",
"sName": "mmkjja2XP5y",
"userStatus": "offline",
"seoSource": "",
"seoKeywords": "",
"ip": "xxx.xxx.xxx.xxx",
"biUpdateTime": "2021-05-21 10:49:21",
"fromUrl": "http://123456",
"urlTitle": "lyhtest",
"referrer": "undefined",
"otherParams": {},
"firstOtherParams": {},
"isNewVisitor": false,
"area": "中国 四川 成都",
"toPeer": "testlyh",
"manualTime": 1621565299898,
"redisRecordDelayTime": 1621565299908,
"sBreakTime": 1621565361802,
"customerId": "NA"
}]
}
}
返回400示例:
{
"code": 400,
"message": "Please check your parameters"
}
返回403示例:
{
"code": 403,
"message": "Server is busy, max request frequency is 20/min"
}
返回500示例:
{
"code": 500,
"message": "Internal Server Error"
}
2.查询在线客服聊天记录接口:
接口:
-
HTTP请求方式:POST
-
请求地址:{url}/v20160818/webChat/queryWebchatMessage/{ACCOUNTID}?sig={SIG}
-
请求时请将{url}换成对接数据查询中获取到的请求域名,{ACCOUNTID}替换为账户编号,{SIG}是根据鉴权规则生成的,请看鉴权文档,查看具体的生成规则
-
鉴权文档:接口鉴权
-
频次限制:20次/每分钟
请求url:
http://apis.7moor.com/v20160818/webChat/queryWebchatMessage/N00000000556
?sig=DBD2D28F3D895AAD1572925AAE50AEA8
请求体
字段 | 类型 | 是否必须 | 备注 |
sid | String | 是 | 访客id |
sessionId | String | 否 | 会话唯一标识,也是上面查询会话接口每个会话返回的_id 可以通过这个字段只查询当前会话的聊天记录 |
dateTimeBegin | String | 否 | 消息发送时间开始,格式 yyyy-MM-dd HH:mm:ss |
dateTimeEnd | String | 否 | 消息发送时间结束,格式 yyyy-MM-dd HH:mm:ss |
请求体示例
{
"sid": "77985680-bb57-11e6-9c64-57233bb19f22",
"dateTimeBegin": "2020-12-06 09:58:23",
"dateTimeEnd": "2020-12-06 09:58:25"
}
返回值:
字段 | 含义 |
code | 响应码 |
message | 响应信息 |
data | 返回数据,JSON格式 |
data:
count | 查询到的聊天记录数 |
webchatMessage | 在线客服聊天记录 |
webchatMessage
_id | 主键 |
account | 账户编号 |
sid | 访客id |
contentType | 消息类型 |
message | 消息内容 |
platform | 平台来源 |
when | 消息时间戳 |
dateTime | 消息时间 |
status | 状态 |
type | 消息类型 in 用户发送消息 out 坐席回复消息 |
user | 只有当type为out时才有此字段 system 系统发送的消息 robot 机器人回复的消息 uuid 坐席回复的消息 ,坐席编号uuid,如:"a81f78f0-3618-11e8-b149-99f8357b7d75" |
accessId | 用户植入七陌代码中的accessId的值 |
showHtml | 是否显示为html形式 |
notShow | 是否显示给用户看,wap接入才有 |
sessionId | 会话id |
以下字段只有使用客服系统回复用户消息(out)才有,通过调用访客端api接口发送的contentList(out)消息没有以下字段 | |
exten | 坐席工号 |
displayName | 坐席名称 |
im_icon | 坐席头像 |
通过调用访客端api接口发送的消息(in and out)会传以下字段 | |
docking | 是否api接口发送 |
dockingMsgList | 是否api接口contentList发送 |
code :
代码 | 含义 |
200 | 请求成功 |
400 | 请求体参数错误 |
403 | 接口访问频次达到上限或者鉴权失败 |
500 | 服务器错误 |
返回200示例:
{
"code": 200,
"message": "success!",
"data": {
"count": 1,
"webchatMessage": [
{
"_id": "189b30e0-edfe-11e8-953d-f911ce3c9583",
"sid": "12321@N00000022688",
"contentType": "text",
"type": "out",
"user": "a81f78f0-3618-11e8-b149-99f8357b7d75",
"message": "haha",
"platform": "pc",
"when": 1542853622522,
"dateTime": "2020-11-22 10:27:02",
"status": "undeal",
"accessId": "4d9dd870-6fa4-11e8-93dd-ed7ac0014c30",
"account": "N00000022688",
"sessionId": "d77b3e80-edfc-11e8-81e8-7f430a948a93",
"kefu": "",
"showHtml": false,
"exten": "8000",
"displayName": "zhangxiaojuan",
"im_icon": "https://fs-test.7moor.com/N00000022688/icon/2018-08-09/1533808316064/d9d48a00-9bb9-11e8-9af5-d5979d761ba7.jpg"
},
{
"_id": "78a5a7d1-bb57-11e6-9c64-57233bb19f22",
"account": "N00000000556",
"sid": "77985680-bb57-11e6-9c64-57233bb19f22",
"contentType": "text",
"message": "会话来源于<a target='_blank' href='http://114.215.205.38:8015/?34c36cb0-60f7-11e6-a592-1182eff1a067'>im</a>",
"platform": "pc",
"when": 1480989504208,
"dateTime": "2020-12-06 09:58:24",
"status": "undeal",
"type": "in",
"accessId": "34c36cb0-60f7-11e6-a592-1182eff1a067",
"showHtml": "true",
"notShow": "true",
"sessionId": "77ae4f80-bb57-11e6-bbb7-9b8127df3997"
}
]
}
}
返回400示例:
{
"code": 400,
"message": "Please check your parameters"
}
返回403示例:
{
"code": 403,
"message": "Server is busy, max request frequency is 20/min"
}