# Set up auto-reply - Open interface

# Configuration information

For example:

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

# Set up the auto-reply interface:

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

Interface type:

POST request

Dxplaination of parameters:

field type Yes Required describe
managerid string yes Administrator id(Can be the creator, administrator id)
skillname string yes Name of Skill
title string yes Standard question
content string yes Automatically answered.
list Array.<string&gt Similar problems to be set up. For example,["Question 1," "Question 2"]

Message encryption and decryption access guidelines

For example, the parameters are

<xml>
    <managerid><![CDATA[Platform Administrator ID]]></managerid>
    <skillname><![CDATA[Name of Skill]]></skillname>
    <title><![CDATA[Standard question]]></title>
    <content><![CDATA[Automatically answered.]]></content>
    <list>
        <question><![CDATA[Similar question 1]]></question>
        <question><![CDATA[Similar question 2]]></question>
    </list>

</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>
    <skillname><![CDATA[Name of Skill]]></skillname>
    <title><![CDATA[Standard question]]></title>
    <content><![CDATA[Automatically answered.]]></content>
    <list>
        <question><![CDATA[Similar question 1]]></question>
        <question><![CDATA[Similar question 2]]></question>
    </list>
</xml>`

var encrypted = cryptor.encrypt(data)

curl -X post -d '{"encrypt": encrypted}' "https://chatbot.weixin.qq.com/openapi/setautoreply/{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 content = " 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 content = {
    "image": {
      "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"
        }
    }, {
    "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"
    }]
  }
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