小程序模板消息 errcode:41001
发布于 5 年前 作者 zdai 8340 次浏览 来自 问答

服务器端调用

POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN

一直报错,errcode 41001 errmsg:access_token missing hint:[**********]

ACCESS_TOKEN已通过AppId和AppSecret获取到,并存储与数据库中。包括某一天第一次请求access_token(access_token过期)也是这个问题。

var access_token_ = "access_token" + "=" + access_token;

var reqUrl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?" + access_token_ ;

access_token是我获取的值

requrl是请求地址

以下是请求Post时携带的其他JSON数据

var dataJson = new Json();

dataJson.add(“touser”, openid);

dataJson.add(“template_id”, template_id);

dataJson.add(“form_id”, prepayid);

    

var datawordJson = dataJson.addObject(“data”); 

    

 var key1Json = datawordJson.addObject(“keyword1”);

 key1Json.add(“value”, transactionId);

    

  var key2Json = datawordJson.addObject(“keyword2”);

  key2Json.add(“value”, pdname);

    

 var key3Json = datawordJson.addObject(“keyword3”);

 key3Json.add(“value”, cashFee);

    

var key4Json = datawordJson.addObject(“keyword4”);

 key4Json.add(“value”, timeEnd);

请教大神,谢谢

回到顶部