# User Tag Batch Backhaul Settings - Open Interface
# Configuration information
For example:
- APPID: xxxxxxxxxxxxxxx
- TOKEN: xxxxxxxxxxxxxxx
- EncodingAESKey: xxxxxxxxxxxxxxx
# Batch Setup User Tag Interface:
https://chatbot.weixin.qq.com/openapi/label/batchset/{TOKEN}
Interface type:
POST request
Dxplaination of parameters:
field | type | Yes Required | describe |
---|---|---|---|
appid | string | yes | Official Account message template or Mini Program appid |
category | string | yes | Label name, such as Finished piece |
label | string | yes | Secondary label name, For example, unfinished./Finished piece |
desc | string | yes | Label Classification Rules, For example, in the app./User information not completed |
list | Array.<string> | To set the openid of the tag, for example,["openid_1", "openid_2"] |
Message encryption and decryption access guidelines
Run the example code
cd src
rm -rf bin
mkdir bin
javac -d bin -cp "lib/*" demo/OpenAiDemo.java com/qq/weixin/mp/aes/*java com/tencent/nlp/openai/*java
# appid 初始值 encodingAESKey用https://chatbot.weixin.qq.com/Application for Robot Information Replacement
java -cp "bin:lib/*" demo.OpenAiDemo appid Token encodingAESKey
For example, the parameters are
<xml>
<appid><![CDATA[wxxxxx]]></appid>
<category><![CDATA[Finished piece]]></category>
<label><![CDATA[complete]]></label>
<desc><![CDATA[Complete the user information in the app]]></desc>
<list>
<openid><![CDATA[openid_1]]></openid>
<openid><![CDATA[openid_初始值]]></openid>
</list>
</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>
<category><![CDATA[Finished piece]]></category>
<label><![CDATA[complete]]></label>
<desc><![CDATA[Complete the user information in the app]]></desc>
<list><openid><![CDATA[[openid_1]]]></openid><openid><![CDATA[[openid_2]]></openid></list>
</xml>`
var encrypted = cryptor.encrypt(data)
curl -X post -d '{"encrypt": encrypted}' -H "content-type:application/json" "https://chatbot.weixin.qq.com/openapi/label/batchset/{TOKEN}"
Note: When sending a request for a post, you need to specify content-type: "application/json"
Return value:
field | type | describe |
---|---|---|
code | number | Error code |
answer_type | string | Answer type: text, music, news |
msg | array | Answer Details |
from_user_name | string | The user initiating the query, corresponding to the userid of the signing interface |
to_user_name | string | A robot that accepts a query |
status | string | When the robot returns, Possible values: FAQ, NOMATCH, CONTEXT_FAQ、GENERAL_FAQ |
Return format:
{
"errcode": 0,
"msg": "Success"
}
# 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 |