(首先-请原谅我的中文,我写中文不是非常流利)
我正在是开发一个微信服务公众号。我用客服接口来发消息,我已经有一个access_token(而已经确保我的appid和secret是对的)。 但是我总收到一个"invalid openid" error.
我本来以为我的openid用错了,但是我用同一个openid在获取用户基本信息没有问题 (http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html)
我想问大家知不知道我有什么东西我没有做。。。谢谢!
我的code:
request.get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET', function (err, response, body) {
var bodyJSON = JSON.parse(body);
var token = bodyJSON.access_token;
console.log('access token is ', token);
request.post({
url: 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' + token,
json: {
openid: "OPENID",
Msgtype: "text",
Text: {
Content: "Test 123"
}
}
}, function (err, response, body) {
return res.json({
err: err,
response: response,
body: body
});
});
});
把这段json中的Msgtype换成msgtype,Text换成text。微信文档上这几个参数都是小写,可能是这个问题