# Open Interface Documentation
# Configuration information
For example:
- APPID: xxxxxxxxxxxxxxx
- TOKEN: xxxxxxxxxxxxxxx
- EncodingAESKey: xxxxxxxxxxxxxxx
# Interface information
# 1. ObtainsignatureInterface:
https://chatbot.weixin.qq.com/openapi/sign/{TOKEN}
Interface type:
POST request
Dxplaination of parameters:
| field | type | Yes Required | describe |
|---|---|---|---|
| username | string | no | User nickname |
| avatar | string | no | User avatar |
| userid | string | yes | User ID(It can be any value.) |
Return value:
| field | type | describe |
|---|---|---|
| signature | string | The signature of the request interface, about 500 bytes in length |
| expiresIn | number | Expiration date |
Return format:
{
signature: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImp0aSI6IjI2NTQ0NzYzLTk1NzctNDZlNS1iOTFlLTA3NjAyMzhiMjUwNSIsImlhdCI6MTU4NjA5Nzc4MSwiZXhwIjoxNTg2MTAxMzgxfQ.qugHipCyBnONQRGY2fadm1LH-bLi0TrVqam3vZTpRcI
expiresIn: 7200
}
signature Can also be obtained locally by jwt signature
const signature = jwt.encode(
EncodingAESKey,
{
username: "some people,
userid: "alsjdasf12",
avatar:
"https://res.wx.qq.com/a/wx_fed/weixin_portal/nothing/static/img/1L3ryyg.png",
},
"HS256",
)
Request Example:

# 2. Intelligent Dialogue Interface:
https://chatbot.weixin.qq.com/openapi/aibot/{TOKEN}
Interface type:
POST request
Dxplaination of parameters:
| field | type | Yes Required | describe |
|---|---|---|---|
| signature | string | yes | Obtained in the previous step signature Return value |
| query | string | yes | Messages sent by the user |
| env | string | no | The default isonline, debugThe test environment,onlineIt's the online environment. |
| first_priority_skills | Array[string] | no | Limit Skill Hit Range For example:["Skill 1"], only match all Q & A content in hit "Skill 1" |
| second_priority_skills | Array[string] | no | Limit Skill Hit Range For example:["Skill 2"], only match all Q & A content in the hit "Skill 2," more than first_priority_Skills Hit Priority Low |
Request Example:

Return value:
| field | type | describe |
|---|---|---|
| ans_node_id | int32 | Skill id |
| ans_node_name | string | classification/Name of Skill |
| title | string | Standard question/Intended Name |
| answer | string | The answer to the hit |
| answer_type | string | Type of response |
| msg | array | Answer Details(Abandoned) |
| confidence | float | Respond to Confidence Index |
| options | Array<Option≶ | List of Recommended Questions(This field appears only when there is a recommendation) |
| 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、FAQ_RECOMMEND |
| msg_id | string | Message id |
| query | string | Messages sent by the user |
Recommended Question Option field explaination:
| field | type | describe |
|---|---|---|
| ans_node_name | string | Recommended classification |
| title | string | Recommendation criteria |
| answer | string | Recommended Answers |
| confidence | float | Referral Information Index |
Return format:
{
"ans_node_id": 17130001,
"ans_node_name": "Fist guessing,"
"answer": "Let the game begin,"
"answer_open": 1,
"answer_type": "text",
"article": "",
"confidence": 1,
"create_time": "1652946752175",
"dialog_session_status": "NONE",
"dialog_status": "NONE",
"event": "",
"from_user_name": "dTo6FS96YzJ",
"intent_confirm_status": "",
"is_default_初始值 false,
"list_options": false,
"msg": [
{
"ans_node_id": 17130001,
"ans_node_name": "Fist guessing,"
"article": "",
"confidence": 1,
"content": "2",
"debug_info": "",
"event": "",
"list_options": false,
"msg_type": "text",
"opening": "",
"request_id": 130,
"resp_title": "Start guessing,"
"scene_status": "",
"session_id": "",
"status": "FAQ",
"take_options_only": false
}
],
"msg_id": "31904d53",
"opening": "",
"request_id": 130,
"ret": 0,
"scene_status": "",
"session_id": "",
"skill_id": "",
"skill_name": "Fist guessing,"
"slot_info": [],
"slots_info": [],
"status": "FAQ",
"take_options_only": false,
"title": "Start guessing,"
"to_user_name": "oEUI4g02QjGf54nLxtexWl01UkytI2",
"msgtype": "text",
"query": "Start guessing,"
"rid": "31904d53"
}
The dialogue platform question and answer strategy has a total of three paragraphs:
- The first paragraph "accurate hit": the user problem score is greater than the robot account threshold, this time for accurate name,
statusThe field isFAQ、CONTEXT_FAQ、GENERAL_FAQof equal value- The second paragraph "problem recommendation": the user's problem score is less than the robot account threshold, but greater than the product of the threshold and the recommendation threshold.
statusThe field isFAQ_RECOMMEND, and at this timeoptionsThere will be a corresponding recommendation- The third paragraph "Miss": The user question score is less than the product of the bot account threshold and the recommendation threshold. At this time for a miss,
statusThe field isNOMATCH
# 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 |