获取聊天记录
此接口返回的聊天记录中,对于图片、语音、视频,分别展示成文本格式的[image]、[voice]、[video]。对于较可能包含重要信息的图片消息,后续将提供图片拉取URL,近期将上线。
调用说明
1
2
3
4
5
6
7
8
9
|
http请求方式: POST
https://api.weixin.qq.com/customservice/msgrecord/getmsglist
?access_token=ACCESS_TOKEN
POST数据示例如下:
{
"starttime" : 987654321,
"endtime" : 987654321,
"msgid" : 1,
"number" : 10000
}
|
参数说明
参数 | 说明 |
starttime | 起始时间,unix时间戳 |
endtime | 结束时间,unix时间戳,每次查询时段不能超过24小时 |
msgid | 消息id顺序从小到大,从1开始 |
number | 每次获取条数,最多10000条
|
返回说明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 19 20 21 |
{
"recordlist" : [
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2002,
"text" :
" 您好,客服test1为您服务。"
,
"time" : 1400563710,
"worker" :
"test1@test"
},
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2003,
"text" :
"你好,有什么事情?"
,
"time" : 1400563731,
"worker" :
"test1@test"
}
}
|
参数说明
参数 | 说明 |
worker | 完整客服帐号,格式为:帐号前缀@公众号微信号 |
openid | 用户标识 |
opercode | 操作码,2002(客服发送信息),2003(客服接收消息) |
text | 聊天记录 |
time | 操作时间,unix时间戳 |
返回码说明
返回码 | 说明 |
65400 | API不可用,即没有开通或升级到新版客服功能 |
65416 | 查询参数不合法 |
65417 | 查询时间段超出限制
|
调用示例
|
第一次
请求:
https://api.weixin.qq.com/customservice/msgrecord/getmsglist
?access_token=ACCESS_TOKEN
POST数据示例如下:
{
"starttime" : 1464710400,
"endtime" : 1464796800,
"msgid" : 1,
"number" : 10000
{
"recordlist" : [
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2002,
"text" :
" 您好,客服test1为您服务。"
,
"time" : 1464710500,
"worker" :
"test1@test"
},
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2003,
"text" :
"你好,有什么事情?"
,
"time" : 1464710600,
"worker" :
"test1@test"
}
第二次
请求:
https://api.weixin.qq.com/customservice/msgrecord/getmsglist
?access_token=ACCESS_TOKEN
POST数据示例如下:
{
"starttime" : 1464710400,
"endtime" : 1464796800,
"msgid" : 20165258,
"number" : 10000
{
"recordlist" : [
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2002,
"text" :
" 您好,客服test1为您服务。"
,
"time" : 1464710700,
"worker" :
"test1@test"
},
{
"openid" :
"oDF3iY9WMaswOPWjCIp_f3Bnpljk"
,
"opercode" : 2003,
"text" :
"你好,有什么事情?"
,
"time" : 1464710800,
"worker" :
"test1@test"
}
|