云函数如何请求sendTemplateMessage?

发布于 8 年前作者 gangxie17831 次浏览最后编辑 8 年前来自 ask
WXOPEN Club 内容图片

总是返回null

2 回复
fangdeng
fangdeng1 楼6 年前

照着我这个格式去写   首先  npm  命令    n__pm install  request-promise__

安装request-promise

//npm install  request-promise

const rp = require(‘request-promise’);

// 云函数入口函数

exports.main = async(event, context) => {

var res = await rp(

{

method: ‘post’,

uri: https://api.weixin.qq.com,

body: {

xxx:‘’ ,

aaa:‘aaa’,

bbb:‘bbb’

},//参数

headers: {},//请求头

json: true  //是否json数据

}

).then((  body) => {

return body

}).catch(err => {

return err;

})

return res;

}

xiuying46
xiuying462 楼6 年前

要实现批量发送,该怎么写呢,求赐教