微信开发模板消息推送,回复错误代码48001?

小程序 文章 2022-02-16 11:40 3201 0 全屏看文

AI助手支持GPT4.0

微信开发模板消息推送,回复错误代码48001?WeChat development template message push, reply error code 48001?

微信开发模板消息推送,回复错误代码48001?

发送微信模板消息,模板权限已获得,使用后台python编写发送程序,本地测试,小程序已经注册,可以获得access_token,发送后回复内容为:"errcode":48001,"errmsg":"api unauthorized rid: 620c59ff-25d1138a-55bce6a3"

代码如下url = 'https://api.weixin.qq.com/cgi-bin/message/template/send'params = {    'access_token': access_token,    'data': {        "touser": "xxxxxxxxxxxx",        "template_id": "WLSiIt0f0H5WwNILmcf3gY9aADrhjQJ1pJWaHKmz0ZA",        "url": "http://weixin.qq.com/download",        "topcolor": "#FF0000",        "data": {            "first": {   "value": "您的设备已触发温度报警。",   "color": "#173177"            },        "keyword1": {            "value": "1222032091",            "color": "#173177"        },        "keyword2": {            "value": "温湿度恒温箱",            "color": "#173177"        },        "keyword3": {            "value": "2021年06月07日19时24分",            "color": "#173177"        },        "keyword4": {            "value": "温度超标 45°C",            "color": "#173177"        },        "remark": {            "value": "06月07日19时24分",            "color": "#173177"        }    },}}response = requests.post(url=url, params=params)



When sending wechat template messages, the template permission has been obtained. The sending program is written in background python, tested locally, and the applet has been registered to obtain access_ After sending, the reply content is: "errCode": 48001, "errmsg": "API unauthorized rid: 620c59ff-25d1138a-55bce6a3". The code is as follows url = ' https://api.weixin.qq.com/cgi-bin/message/template/send 'params = { 'access_token': access_token, 'data': { "touser": "xxxxxxxxxxxx", "template_id": "WLSiIt0f0H5WwNILmcf3gY9aADrhjQJ1pJWaHKmz0ZA", "url": " http://weixin.qq.com/download "," Topcolor ":" #ff0000 "," data ": {" first ": {" value ":" your device has triggered a temperature alarm. "," color ":" #173177 "}," keyword1 ": {" value ":" 1222032091 "," color ":" #173177 "}," keyword2 ": {" value ":" thermostat "," color ":" #173177 "}," keyword3 ": {" value ":" 19:24 on June 7, 2021 "," color ":" #173177 "}," keyword4 ": {" value ":" the temperature exceeds 45 ° C "," color ":" #173177 "}," remark ": {" value ":" 19:24 on June 7 "," color ":" #173177 "} " } },}}response = requests.post(url=url, params=params)

回答:

社区技术运营专员-horanzhou:

你好,

详情请参考:https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Global_Return_Code.html


许先森:

小程序的发送消息的api也不是你调用的这个url呀

-EOF-

AI助手支持GPT4.0