author:php.cn update time:2022-04-11 14:39:39
WeChat session control
Session Control
##Create Session
This interface creates a session between the customer service and the user. If the customer service and user session already exist, 0 will be returned directly. The designated customer service account must be bound to WeChat ID and online.
Calling instructions
1234567 | ##http request method: POST
https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
POST data examples are as follows:
{
"kf_account" : "test1 @test",
"openid" : "OPENID"
}
|
Parameter description
##ParameterDescription | | kf_account
Complete customer service account, the format is: account prefix@public account WeChat ID | | openid
fans The openid | |
return description
##123 4 5 Return data example (JSON return result when correct): | {
"errcode" : 0,
"errmsg" : "ok"
}
Close session Call instructions 1 2 3 4 5 6 7 | http request Method: POST
https: //api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN
POST data example is as follows:
{
"kf_account" : "test1@test" ,
"openid" : "OPENID"
}
|
Parameter description
Parameter | Description | kf_account | Complete customer service account, the format is: account prefix@public account WeChat ID | openid | Fan’s openid |
Return instructions
1 2 3 4 5 | Return data example (JSON return result when correct):
{
##"errcode" : 0,
"errmsg" : "ok"
}
| Main return code
Return code | Description | 0 | Success | 65400 | API is not available, that is, the new version of customer service function has not been activated/upgraded | 65401 | Invalid customer service account | 65402 | The account has not been bound to WeChat ID and cannot be put into use | 65413 | There is no session information corresponding to the user | 65414 | The customer is being serviced by another customer service Reception | 40003 | illegal openid | Get customer session status
This interface gets a customer's session. If it does not exist, kf_account is empty. Calling instructions 1 2 | http request method: GET
##https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID
| Parameter description
Parameter | Description | openid | fan’s openid | Return instructions
12345 Return data example (JSON return result when correct): { "createtime" : 123456789, "kf_account" : "test1@test" } Parameter description Parameter description kf_account Customer service being received , empty means no one is receiving createtime session access time. Main return code Return code description 0 Success 65400 API is not available, that is, it is not activated/upgraded to the new version of customer service function 40003 Illegal openid Get customer service session list Call description 12 http request method: GEThttps://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT Parameter description Parameter description kf_account complete customer service account, the format is: account prefix @ official account WeChat ID returns saying 1 2 3 4 5 6 7 8 9 10 11 12 13 | Return data example (JSON return result when correct):
{
"sessionlist" : [
#: "OPENID" ## },
##
through " : "OPENID"
}
]
}
Get unconnected session List Call description
##12
http request method: GET
https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token=ACCESS_TOKEN
Return description
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Return data example (JSON return result when correct):
{
"count" : 150, "waitcaselist" : [
## {
"latest_time" : 123456789, ##
"OPENID"
## }, ##
"Latest_time" ##: 123456789,
## "Openid" : "OPENID"
}
]
}
Parameter Description
Parameters Description
| count
Number of unconnected sessions
waitcaselistNot connected to the session list, a maximum of 100 pieces of data will be returned, in the order of visits | | openidFans’ openid | | latest_timeThe time of the fan’s last message | | Return code description Return code | Description | 0 | Success | 65400 | API is not available, that is, it has not been activated or upgraded to the new version of customer service function | 65401 | Invalid customer service account | 65402 | The customer service account has not been bound to WeChat ID and cannot be put into use | 65413 | There is no session information corresponding to the user | 65414 | Fans are being received by other customer service | 65415 | The specified customer service is not online | ##40003 | Illegal openid |
|
|