# Third Party Service System Access - Modify the user's customer service access status

The user access status of the customer service will directly control whether the robot replies to the user.onThis customer has already At this time, the robot will not answer, only the customer service provides service, when the access status isoffThis client has not yet Is connected by customer service, at this time the robot has hit the configuration problem, will automatically reply.

# Configuration information

For example:

  • APPID: xxxxxxxxxxxxxxx
  • TOKEN: xxxxxxxxxxxxxxx
  • EncodingAESKey: xxxxxxxxxxxxxxx

# Modify the Customer Service Access Status interface:

https://chatbot.weixin.qq.com/openapi/kefustate/change/{TOKEN}

Interface type:

POST request

Dxplaination of parameters:

field type Yes Required describe
appid string yes Official Account message template Or Mini Program. appid
openid string yes The user's weixin openid
kefustate string yes Customer Service Status

Customer Service Status:

field type describe
asking string To be connected, The customer talks to the robot
personserving string Connected, Customer service has been connected to the customer service (The old interface state is on)
complete string Access completed, The customer service staff has completed the relevant advisory services for the customer. (The old interface state is off)
needperson string To be converted, The customer expressed a desire to connect with a human customer service agent and was successfully captured by the intelligent robot, usually hitting a skill with the word "turn to human" in its name

Message encryption and decryption access guidelines

For example, the parameters are

<xml>
    <appid><![CDATA[wxxxxx]]></appid>
    <openid><![CDATA[xxxxx]]></openid>
    <kefustate><![CDATA[needperson]]></kefustate>
</xml>

Encrypt the data to the field encrypt Put in body in

var cryptor = new WXBizMsgCrypt(TOKEN, EncodingAESKey, APPID)
var data = `<xml>
    <appid><![CDATA[wxxxxx]]></appid>
    <openid><![CDATA[xxxxx]]></openid>
    <kefustate><![CDATA[off]]></kefustate>
</xml>`
var encrypted = cryptor.encrypt(data)


curl -X post -d '{"encrypt": encrypted}' "https://chatbot.weixin.qq.com/openapi/kefustate/change/{TOKEN}"

Return value:

field type describe
errcode number Error code
errmsg string Error message

Return format:

{
  "errcode": 0,
  "errmsg": ""
}

# Error code:

{
    errcode: 1001,
    errmsg: "TOKEN is not valid"
}
Error code describe
1001 Token invalid
1002 The robot failed the audit.
1003 Lack of signature userid field
1004 Signature field is empty
1005 Signature expired or invalid
1006 Signature verification failed, missing userid field
1007 appid, category,label, desc Field cannot be empty