微信公众平台返回错误:errcode 43002,如何解决?
发布于 6 年前 作者 xiulan86 14848 次浏览 来自 问答

问题描述:通过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: \`<a href="https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" rel="noopener noreferrer" target="_blank">https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access\_token=</a>${accessToken}\`,

	body: JSON.stringify(AlarmMs),

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

}

 

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

	result = JSON.parse(result)

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

		console.log(result)

	}

	else {

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

	}

}).catch(err =&gt; {

	console.log(err);

})

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

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

1 回复

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

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