"errCode":-501007,"errMsg":"subscribeMessage.send:fail Invalid request param"
START RequestId: 9d9bf191-5aa9-11ea-8756-52540054168a
Event RequestId: 9d9bf191-5aa9-11ea-8756-52540054168a
2020-02-29T04:11:53.902Z 9d9bf191-5aa9-11ea-8756-52540054168a { Error: errCode: -501007 invalid parameters | errMsg: subscribeMessage.send:fail Invalid request param
at Object.callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:358:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
errCode: -501007,
errMsg: 'subscribeMessage.send:fail Invalid request param' }
END RequestId: 9d9bf191-5aa9-11ea-8756-52540054168a
Report RequestId: 9d9bf191-5aa9-11ea-8756-52540054168a Duration:74ms Memory:256MB MemUsage:37.753906MB
config.json
{
"permissions": {
"openapi": [
"subscribeMessage.send"
]
}
}
index.js
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.subscribeMessage.send({
touser: 'o1o3-4xgvaPwVLt7PKG4_KG7xmf4',
page: 'index',
data:{
thing2:{
value:'千岛鱼'
},
amount3:{
value:'120'
},
name4:{
value: '是不是忘了谁'
},
thing6:{
value: '有鱼有虾'
},
time5:{
value:'2018.5.15'
}
},
templateId: 'fwd9CstOmDbgC3WxAvoMct90AZ3kLE92AYZSejwAdVg',
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
前端点击事件:share
share()
{
wx.requestSubscribeMessage({
tmplIds: ['fwd9CstOmDbgC3WxAvoMct90AZ3kLE92AYZSejwAdVg'],
success:(res)=>{
wx.cloud.callFunction({
name:'send'
}).then((res)=>{
console.log(res)
})
}
})
},
我是想发送给指定的openid的微信接受这条消息
求解决吧!!!!好多人都遇到这个问题
模板消息不是下架了吗 你怎么还再用