# Third Party Service System Access - Check 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

# View Customer Service Access Status Interface:

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

Interface type:

POST request

Dxplaination of parameters:

field type Yes Required Default value describe
appid string yes Official Account message template or Mini Program appid
openid string yes User's weixin openid
type string no simple simple/all: Simple gets the kfstate field only, all gets the status field extra

Message encryption and decryption access guidelines

For example, the parameters are

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

Encrypt the data to the field encrypt Into the body.

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


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

Return value:

field type describe
errcode number Error code
kefustate string on/off On is connected, off is not connected
status string Fields for Human Customer Service Access Status

status Field Dxplaination:

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
complete string Access completed, The customer service staff has completed the relevant advisory services for the customer.
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

Return format:

{
  "errcode": 0,
  "kefustate": "on/off"
}

# Error code:

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