我按照官方的文档写了个类似的云函数用来发送模板消息,官网文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/templateMessage.send.html
但是用的时候总是提示Error: errCode: -604101 function has no permission to call this API
官方文档例子:

我写的代码:

其中page和
emphasisKeyword 是非必填的,我就没写

微信小程序开发问题解答
微信小程序开发者回答:
楼主缺少个权限声明文件config.json
{
"permissions": {
"openapi": ["templateMessage.send"]
}
}
然后用最新0409版开发工具上传部署
微信小程序开发者回答:
mac 04090 正式版 也遇到同样的问题
config.json[
{
"permissions": {
"openapi": [
"openapi.wxacode.getUnlimited"
]
}
}
]
本文网址:http://www.91bianli.com/weixinxiaochengxu/12925.html