{ errCode: -501007,errMsg: 'subscribeMessage.send:fail missing wxCloudApiToken' }
错误代码
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
// const id = event.actionFilter;
const _id = event.actionFilter._id
const info = await db.collection('goods_group').doc(_id).get()
const {openid,goodsname} = info.data
try {
const result = await cloud.openapi.subscribeMessage.send({
touser: openid,
page: 'page/home/home',
lang: 'zh_CN',
data: {
name1: {
value: goodsname
},
thing2: {
value: '不符合平台规范'
},
thing8: {
value: '尽快联系客服'
}
},
templateId: 'y4yi_hX_KsE4X3xQHtes6iyPOlNgcDw0M6lmXvp99X4',
miniprogramState: 'trial'
})
return result
}
catch (err) {
return err
}
云函数代码
你好,CMS Webhook 触发的云函数不支持微信云调用