发送微信订阅消息一直出错
user refuse to accept the msg rid: 5ff8563e-2acaf6dc-75492f03
This API has been unsupported hint
踩坑记录
真正的订阅消息文档
流程文档
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html
调用数据文档
只有这个api可以使用
templateSend: 'https://api.weixin.qq.com/cgi-bin/message/subscribe/send'
这些全部不行
templateSend2: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send',
templateSend3: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send'
首先第一步需要调用,如果找不到就硬写, 千万不要<button open-type="subscribe"></button> 这个虽然授权了, 根本没用, 应该是永久模板使用的。 跟我们没有关系
一定要加,不然收不到。鼻子都气歪了
wx.requestSubscribeMessage({
tmplIds: ["模板id"],
success (res) { }
})
第二步, 发送订阅消息,此消息只能发送一次,第二次要重新授权
const {
access_token,
open_id
} = this.props;
const data2 = {
touser: open_id,
template_id: "模板id",
page: "/pages/page/index",
data: {
thing1: {
value: "酒店"
},
thing4: {
value: "起床"
}
}
}
api.templateSend(access_token, data2)
.then((res) => {
console.log(res);
})