收藏
回答

云调用订阅号信息报错errCode":-501007,"errMsg":"templateMessa

框架类型 问题类型 操作系统 工具版本
小程序 Bug macOS Nightly v1.02.2002282

"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的微信接受这条消息


求解决吧!!!!好多人都遇到这个问题

最后一次编辑于  2020-02-29
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签