首页 > nodejs微信开发 40016错误

nodejs微信开发 40016错误

var appid = 'wx8d038a1d7be18a8d';
var appsecret = '3db8cce6c69a3e873c6f13219d9f93cb';
var requrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='+appid+'&secret='+appsecret;
var jsonStr = {
    "button":[
        {
            "type":"click",
            "name":"今日歌曲",
            "key":"V1001_TODAY_MUSIC"
        },
        {
            "name":"菜单",
            "sub_button":[
                {
                    "type":"view",
                    "name":"搜索1",
                    "url":"http://www.soso.com/"
                },
                {
                    "type":"view",
                    "name":"视频1",
                    "url":"http://v.qq.com/"
                },
                {
                    "type":"click",
                    "name":"赞一下我们ya",
                    "key":"V1001_GOOD"
                }]
        }]
};
//console.log(typeof jsonStr);
var creatMenuUrl;
request(requrl, function (error, response, body) {
    if (!error && response.statusCode == 200) {
        //console.log(body); // Show the HTML for the Google homepage.
        var access_token = JSON.parse(response.body).access_token;

        creatMenuUrl = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token='+access_token;
        request.post(creatMenuUrl, JSON.stringify(jsonStr),function(err,httpResponse,body){
            console.log(body)
        });
    }
});

这是哪里错了吗?在线等。。。


应该是“赞一下我们ya“这个按钮字符串太长了,微信自定义菜单的字符串长度是有限制的

【热门文章】
【热门文章】