小程序通过统一服务消息发送公众号模板消息需要哪些条件?小程序与公众号是否需要绑定同一个开发平台账号???
const response = await axios({
method: 'post',
url: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send',
responseType: 'stream',
params: {
access_token: token,
},
data: {
"touser": openid,
"mp_template_msg": {
"template_id": "OKxDu8ufmxiYgI7lj0FqZYA3l1H3F4KMubCRPwD5zOs",
"url": "http://weixin.qq.com/download",
"miniprogram": {
"appid": "wx8aac6848530185b8",
"pagepath": "pages/home/home"
},
"data": {
"first": {
"value": '商品',
"color": "#173177"
},
"keyword1": {
"value": '单号',
"color": '#1d1d1d'
},
"keyword2": {
"value": '用户',
"color": '#1d1d1d'
},
"keyword3": {
"value": '号码',
"color": '#1d1d1d'
},
"keyword4": {
"value": '地址',
"color": '#1d1d1d'
},
"keyword5": {
"value": '备注',
"color": '#1d1d1d'
},
"remark": {
"value": '已付款!',
"color": '#173177'
}
}
}
}
});
推送小程序模板消息成功了,推送公众号模板消息没有消息
公众号要求与小程序有绑定且同主体,不需要绑定开放平台
我的公众号与小程序关联了但是用统一服务接口只能发送小程序模板消息而且还是在服务通知推送的,公众号模板消息推送不了
const response = await axios({
method: 'post',
url: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send',
responseType: 'stream',
params: {
access_token: token,
},
data: {
"touser": openid,
"weapp_template_msg": {
"template_id": "9KOg1Kx0U5Ga7Rwoum2SA_0_8oAmOI0P_roVkHjwBTQ",
"page": "pages/home/home",
"form_id": "d56df50b1b144fb783459ea553c5d794",
"data": {
"keyword1": {
"value": "339208499"
},
"keyword2": {
"value": "2015年01月05日 12:30"
},
"keyword3": {
"value": "腾讯微信总部"
},
"keyword4": {
"value": "广州市海珠区新港中路397号"
},
"keyword5": {
"value": "2015年01月05日 12:30"
},
"keyword6": {
"value": "腾讯微信总部"
}
},
"emphasis_keyword": "keyword1.DATA"
},
"mp_template_msg": {
"template_id": "OKxDu8ufmxiYgI7lj0FqZYA3l1H3F4KMubCRPwD5zOs",
"url": "http://weixin.qq.com/download",
"miniprogram": {
"appid": "wx8aac6848530185b8",
"pagepath": "pages/home/home"
},
"data": {
"first": {
"value": '商品',
"color": "#173177"
},
"keyword1": {
"value": '单号',
"color": '#1d1d1d'
},
"keyword2": {
"value": '用户',
"color": '#1d1d1d'
},
"keyword3": {
"value": '号码',
"color": '#1d1d1d'
},
"keyword4": {
"value": '地址',
"color": '#1d1d1d'
},
"keyword5": {
"value": '备注',
"color": '#1d1d1d'
},
"remark": {
"value": '已付款!',
"color": '#173177'
}
}
}
}
});
只发送公众号模板消息
const response = await axios({
method: 'post',
url: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send',
responseType: 'stream',
params: {
access_token: token,
},
data: {
"touser": openid,
"mp_template_msg": {
"template_id": "OKxDu8ufmxiYgI7lj0FqZYA3l1H3F4KMubCRPwD5zOs",
"url": "http://weixin.qq.com/download",
"miniprogram": {
"appid": "wx8aac6848530185b8",
"pagepath": "pages/home/home"
},
"data": {
"first": {
"value": '商品',
"color": "#173177"
},
"keyword1": {
"value": '单号',
"color": '#1d1d1d'
},
"keyword2": {
"value": '用户',
"color": '#1d1d1d'
},
"keyword3": {
"value": '号码',
"color": '#1d1d1d'
},
"keyword4": {
"value": '地址',
"color": '#1d1d1d'
},
"keyword5": {
"value": '备注',
"color": '#1d1d1d'
},
"remark": {
"value": '已付款!',
"color": '#173177'
}
}
}
}
});
同一业务,多次推送,用户很容易取关的