收藏
回答

微信公众平台返回错误:errcode 43002,如何解决?

问题描述:通过nodejs服务,发送小程序的订阅通知,微信公众平台返回如下错误:errcode 43002 error:require POST method hint: [1M2FbA0733d434]

nodejs端代码:

let AlarmMs = {

touser: openid,

template_id: "K8hTzXmekOEymE6O57qhstlmt-B9L7c5kYo6ueM8A90",

lang: 'zh_CN',

miniprogramState: 'trial',

page: "index",

data: {

"thing1": {"value": '设备1'},

"time2": {"value": "2020年06月17日 19:28"},

"thing3": {"value": 'nodejs测试'}

},

}

var opts = {

method:'POST',

url: `https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=${accessToken}`,

body: JSON.stringify(AlarmMs),

header: {'content-type': 'application/json'}

}

get(opts).then(function (result) {

result = JSON.parse(result)

if (result.errcode == '0' && result.errmsg === 'ok') {

console.log(result)

}

else {

console.log('errcode',result.errcode,'error:' + result.errmsg)

}

}).catch(err => {

console.log(err);

})

补充说明:经查阅43002的问题描述为:require POST method需要使用POST方法请求

但我在nodejs写的方法就是POST,不知道为什么不好使

回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    2020-06-20

    谁知道你get(opts) 里面又封装了啥。而且你接口地址也写错了


    这个是小程序订阅消息:https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN
    


    2020-06-20
    有用 1
    回复 8
    • 史胜强🇨🇳
      史胜强🇨🇳
      2020-06-20
      非常感谢,地址改过来了,但还是接收到这个错误:errcode 43002 error:require POST method hint: [5nstha00661523]
      2020-06-20
      回复
    • 史胜强🇨🇳
      史胜强🇨🇳
      2020-06-20
      如果是模版内容错误的话,应该回馈相应的错误号,但43002这个错误跟POST有关,我用的就是POST方法呀
      2020-06-20
      1
      回复
    • Mr.Zhao
      Mr.Zhao
      2020-06-20回复史胜强🇨🇳
      我没看到你用POST方法   get()咋写的?哪个库?
      2020-06-20
      回复
    • 史胜强🇨🇳
      史胜强🇨🇳
      2020-06-20
      2020-06-20
      回复
    • 史胜强🇨🇳
      史胜强🇨🇳
      2020-06-20
      get()方法可以用的,我用get获取到了accessToken
      2020-06-20
      回复
    查看更多(3)
登录 后发表内容
问题标签