使用
// replace `APP_ID` and `SECRET` with corresponding value
var wechat = require('wechat-api')(APP_ID, SECRET)
// 查询自定义菜单信息
wechat.getMenu(function(err, result) {
//
// the `result` will be the json response
//
// when error happens:
//
// err == {"errcode":40013,"errmsg":"invalid appid"}
// result == null
//
})
// 根据 OpenID 获取用户信息
wechat.getUserInfo({
openid: 'o6_bmjrPTlm6_2sgVt7hMZOPfL2M',
lang: 'zh_CN'
}, function(err, result) {
//
// result === {
// "subscribe": 1,
// "openid": "o6_bmjrPTlm6_2sgVt7hMZOPfL2M",
// "nickname": "Band",
// "sex": 1,
// "language": "zh_CN",
// "city": "广州",
// ...
// }
//
})