发送小程序订阅消息,请求参数中公众号模板信息时必填项?为什么要必填啊?
发布于 5 年前 作者 ganghe 1118 次浏览 来自 问答

2 回复

      let res = await rp({

        url: "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token,

        method: 'POST',

        body: JSON.stringify({

          "touser": open.data[i].openid,

          "template_id": "ujTmUWuS4BZMKpnrBEfJS4_2J34w3cfVS7kMzqg4hWI",

          "topcolor": "#FF0000",

          "data": {

            "first": {

              "value": "您有新的订单,请及时处理",

              "color": "#173177"

            },

            "keyword1": {

              "value": event.username,

              "color": "#173177"

            },

            "keyword2": {

              "value": event.phone,

              "color": "#173177"

            },

            "keyword3": {

              "value": event.storename,

              "color": "#173177"

            },

            "keyword4": {

              "value": event.geton,

              "color": "#173177"

            },

            "keyword5": {

              "value": event.day+" "+event.menuName,

              "color": "#173177"

            },

            "remark": {

              "value": event.price+"",

              "color": "#173177"

            },

          }

        })

      })

回到顶部