微信公众号
获取聊天记录
获取聊天记录
此接口返回的聊天记录中,对于图片、语音、视频,分别展示成文本格式的[image]、[voice]、[video]。对于较可能包含重要信息的图片消息,后续将提供图片拉取URL,近期将上线。
调用说明
http请求方式: POST https://api.weixin.qq.com/customservice/msgrecord/ getmsglist ?access_token=ACCESS_TOKEN POST数据示例如下:
{
"starttime" : 987654321,
"endtime" : 987654321,
"msgid" : 1,
"number" : 10000
}
参数说明
返回说明
{
"recordlist" : [
{
"openid" : "oDF3iY9WMaswOPWjCIp_f3Bnpljk" ,
"opercode" : 2002,
"text" : " 您好,客服test1为您服务。" ,
"time" : 1400563710,
"worker" : "test1@test"
},
{
"openid" : "oDF3iY9WMaswOPWjCIp_f3Bnpljk" ,
"opercode" : 2003,
"text" : "你好,有什么事情?" ,
"time" : 1400563731,
"worker" : "test1@test"
}
],
"number":2,
"msgid":20165267
}
参数说明
返回码说明
调用示例
第一次 请求: 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"
},
......
],
"number": 10000 ,
"msgid": 20165258 } 请求的number( 10000 )和返回的number( 10000 )一样,该时间段可能还有聊天记录未获取,将msgid( 20165258 )填进下次请求中;
第二次 请求: 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"
},
......
],
"number":4,
"msgid":20165267 } 请求的number( 10000 )和返回的number(4)不一样,则该时间段的后续聊天记录获取完毕;