##12 3 4 5 6 7 8 9 | http request method: POST
https://api.weixin.qq.com /customservice/msgrecord/getmsglist ?access_token=ACCESS_TOKEN POST data examples are as follows:
{
"starttime " : 987654321,
"endtime" : 987654321,
##"msgid" : 1,
##"number" : 10000
}
Parameter description
##Parameter | Description | starttime | Start time, unix timestamp | #endtime | End time, unix timestamp, each query period cannot More than 24 hours | msgid | Message id order is from small to large, starting from 1 | number | Get the number of items each time, up to 10,000 | Return description ##123 4567891011 12131415161718192021 | #{
"recordlist" : [
{
"openid" : "oDF3iY9WMaswOPWjCIp_f3Bnpljk" ,
##"opercode" : 2002, "text" : " Hello, customer service test1 is at your service." ,
: "test1@test"
## {
"Opercode" : 2003,
## "Text"##: "Hello, what's the matter?" ,
## "Time" : 1400563731,
## "worker" : "test1@test"
} ],
"number":2,
"msgid":20165267
}
|
Parameter Description
Parameters | Description | worker | Complete customer service account, the format is: account prefix@public WeChat ID | openid | User ID | opercode | Operation code, 2002 (sent by customer service Message), 2003 (Customer service receives message) | text | Chat record | time | Operation time, unix timestamp |
Return code description
Return code | Explanation | ##65400 | API is not available, that is, it has not been activated or upgraded to a new version Customer service function | 65416 | The query parameter is illegal | 65417 | The query time period exceeds the limit |
Call example 第一次
请求:
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)不一样,则该时间段的后续聊天记录获取完毕;
|