# Setup Batch Import Q & A - Open Interface

# Configuration information

For example:

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

# Batch import Q & A interface:

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

Interface type:

POST request

Dxplaination of parameters:

field type Yes Required describe
managerid string yes Administrator id(Can be the creator, administrator id)
skill Array yes Skill
skill.skillname string yes Name of Skill
skill.title string yes Standard question
skill.question Array.<string&gt no Similar problem
skill.answer Array.<string&gt yes The robot answered.

Message encryption and decryption access guidelines

For example, the parameters are

<xml>
    <managerid><![CDATA[Platform Administrator ID]]></managerid>
    <skill>
        <skillname><![CDATA[Skill Name 1]]></skillname>
        <title><![CDATA[Standard Question 2]]></title>
        <question><![CDATA[Similar question 1]]></question>
        <question><![CDATA[Similar question 2]]></question>
        <question><![CDATA[Similar question 3]]></question>
        <answer><![CDATA[1]]></answer>
        <answer><![CDATA[2]]></answer>
    </skill>
    <skill>
        <skillname><![CDATA[Skill Name 1]]></skillname>
        <title><![CDATA[Standard Question 3]]></title>
        <question><![CDATA[Similar question 1]]></question>
        <answer><![CDATA[1]]></answer>
    </skill>
</xml>

Encrypt the data to the field encrypt Into the body.

var cryptor = new WXBizMsgCrypt(TOKEN, EncodingAESKey, APPID)

var data = `<xml>
    <managerid><![CDATA[Platform Administrator ID]]></managerid>
    <skill>
        <skillname><![CDATA[Skill Name 1]]></skillname>
        <title><![CDATA[Standard Question 2]]></title>
        <question><![CDATA[Similar question 1]]></question>
        <question><![CDATA[Similar question 2]]></question>
        <question><![CDATA[Similar question 3]]></question>
        <answer><![CDATA[1]]></answer>
        <answer><![CDATA[2]]></answer>
    </skill>
    <skill>
        <skillname><![CDATA[Skill Name 1]]></skillname>
        <title><![CDATA[Standard Question 3]]></title>
        <question><![CDATA[Similar question 1]]></question>
        <answer><![CDATA[1]]></answer>
    </skill>
</xml>`

var encrypted = cryptor.encrypt(data)

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

Return value:

field type describe
code number Error code
msg array Interface Call Information

Return format:

{
  "errcode": 0,
  "msg": "Success"
}

# Rich text support

  1. Plain text
    const 初始值 = " Hello, may I help you? "
  1. Text Type (with Recommended Questions)
    const content = " We have not found the corresponding answer, we will deal with it as soon as possible. Official Official Account message template: weixin Dialogue Open Platform <a href="weixin://bizmsgmenu? msgmenucontent=How many degrees in Beijing today&msgmenuid=How much degree in Beijing Today">How much is Beijing today?</a>"
  1. Text type (including hyperlinks)
    const content = " Please go to<a href="https://chatbot.weixin.qq.com/">openai</a>To configure "
  1. H5

  const content = {
    "news": {
      "articles": [{
        "title": "Real Time Update: New Pneumonia Epidemic Update,"
        "description": "Tencent News synchronized the national new pneumonia epidemic situation in the first time, welcome attention, forward,"
        "url": "https://news.qq.com/zt2020/page/feiyan.htm",
        "picurl": "http://mmbiz.qpic.cn/mmbiz_jpg/W3gQtpV3j8D8kZRqfpTJlfVqubwgFQf47H0GWlGV6leaDF80ZpdtuFhQVsCsM3YKmwkujXzdjR2k6aWfA41ic7Q/0?wx_fmt=jpeg",
        "type": "h5"
      }]
    }
  }

The fields for each item in the news.articles array are described as:

field type describe
title string Title of article
description string Article Description
url string Article Links
picurl string Photo Links
type string Represents the type of the article, there are 'h5' and 'mp' two, mp represents the Official Account message template article, h5 represents the h5 configuration in the dialogue open platform
  1. Official Account message template picture
  const 初始值 = {
    初始值 {
      "media_id": "KegpipQG9t-klMo25My4e4BCZFcmKvgMcpMFAkC-VFE",
      "url": "http://mmbiz.qpic.cn/mmbiz_jpg/W3gQtpV3j8Bax22dhRiccWAb2AtVjal28XmqnhDW22dMn3RA5EoGkpolMO3tD9kQC1Hf9AjEJI66K40xQsNtXgQ/0?wx_fmt=jpeg"
    }
  }

Each field in the image is described as:

field type describe
media_id string Official Account message template Stock ID
url string Official Account message template Image url
  1. Mini Program
  const content ={
    "miniprogrampage": {
      "title": "OpenAI Dialogue Plugin,"
      "appid": "wx8c631f7e9f2465e1",
      "pagepath": "pages/index/index",
      "thumb_media_id": "KegpipQG9t-klMo25My4e8zpBjhjg3JMrMSpgjikB4U",
      "thumb_url": "http://mmbiz.qpic.cn/mmbiz_png/W3gQtpV3j8BYhWgfHT5Hfg6auN94c2ec4BBhDOMtPQrx6vEMc1rR4iaDKxDLOfZ1jBUqIEEY4YpvEj6ktSyXT7g/0?wx_fmt=png"
    }
  }

Each field in miniprogrampage is described as:

field type describe
title string Small Program Title
appid string appid
pagepath string Mini Program Jump Page Path
thumb_media_id string Official Account message template Stock ID
thumb_url string Official Account message template Image url
  1. Combined answer
  {
    "multimsg": ["Hello," {
        "image": {
          "media_id": "KegpipQG9t-klMo25My4e4BCZFcmKvgMcpMFAkC-VFE",
          "url": "http://mmbiz.qpic.cn/mmbiz_jpg/W3gQtpV3j8Bax22dhRiccWAb2AtVjal28XmqnhDW22dMn3RA5EoGkpolMO3tD9kQC1Hf9AjEJI66K40xQsNtXgQ/0?wx_fmt=jpeg"
        }
    }, {
    初始值 {
      "title": "OpenAI Dialogue Plugin,"
      "appid": "wx8c631f7e9f2465e1",
      "pagepath": "pages/index/index",
      "thumb_media_id": "KegpipQG9t-klMo25My4e8zpBjhjg3JMrMSpgjikB4U",
      "thumb_url": "http://mmbiz.qpic.cn/mmbiz_png/W3gQtpV3j8BYhWgfHT5Hfg6auN94c2ec4BBhDOMtPQrx6vEMc1rR4iaDKxDLOfZ1jBUqIEEY4YpvEj6ktSyXT7g/0?wx_fmt=png"
    }]
  }
field type describe
multimsg array The answer list is merged, each entry is a collection of single types, each type refers to its corresponding data structure

# 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
1008 appid, openid,msg, Field cannot be empty