CNode

nodejs开发微信公众号

问答
Hhelloedmund发布于10 年前最后回复10 年前18 回复9817 浏览0 收藏

各位有用nodejs开发过微信公众号吗?小弟我的是未认证的订阅号...通过接口生成自定义菜单时,报错40007,invalid media_id? 不知道是不是因为我的公众号未认证的原因

查看回复

回复 (18)

I
i5ting#1·10 年前
H
haozxuan#2·10 年前

是因为你的多媒体id无效;

H
helloedmund#3·10 年前
引用 haozxuan是因为你的多媒体id无效;

@haozxuan 我并没有添加多媒体啊,只是用json来生成自定义菜单

H
helloedmund#4·10 年前
引用 haozxuan是因为你的多媒体id无效;

@haozxuan

wechatApi.createMenu(menu).then(function(msg) { console.log(msg) }) Wechat.prototype.createMenu = function(menu) { var that = this return new Promise(function(resolve, reject) { that .fetchAccessToken() .then(function(data) { var url = api.menu.create + 'access_token=' + data.access_token request({method: 'POST', url: url, body: menu, json: true}).then(function(response) { var _data = response.body if (_data) { console.log(_data + "create test") resolve(_data) } else { throw new Error('Create menu fails') } }) .catch(function(err) { reject(err) }) }) }) }

的error message 是 invalid media_id, err code : 40007 后来查询了微信文档 1.png 发现是不是未认证的订阅号没有权限啊,只是不明白为什么会报media_id 的错

H
helloedmund#5·10 年前
引用 i5tinghttps://github.com/i5ting/wechat dev with nodejs 自己找吧

@i5ting

wechatApi.createMenu(menu).then(function(msg) { console.log(msg) }) Wechat.prototype.createMenu = function(menu) { var that = this return new Promise(function(resolve, reject) { that .fetchAccessToken() .then(function(data) { var url = api.menu.create + 'access_token=' + data.access_token request({method: 'POST', url: url, body: menu, json: true}).then(function(response) { var _data = response.body if (_data) { console.log(_data + "create test") resolve(_data) } else { throw new Error('Create menu fails') } }) .catch(function(err) { reject(err) }) }) }) } 的error message 是 invalid media_id, err code : 40007 后来查询了微信文档 1.png 发现是不是未认证的订阅号没有权限啊,只是不明白为什么会报media_id 的错

H
helloedmund#6·10 年前

不知道为啥,贴点代码总是会报错,算了,还是截图: 2.png 3.png

J
jiangli373#8·10 年前

给看下你的menu结构呢

T
tomoya92#9·10 年前

未认证的公众号没有菜单权限,想折腾可以申请一个测试账号,绝大部分功能都有

来自酷炫的 CNodeMD

W
welchwsy#10·10 年前

没有权限,正解

Z
zhangzeyang#11·10 年前

没开发过,不过有这个意向。学习学习 From Noder

Y
yakczh#13·10 年前

有没有微信支付的指南?

W
woodbon#14·10 年前

mark 自豪地采用 CNodeJS ionic

C
chux0519#15·10 年前

最近也在搞公众号,个人类未认证的订阅号确实是没有自定义菜单权限的。

C
chux0519#16·10 年前
引用 chux0519最近也在搞公众号,个人类未认证的订阅号确实是没有自定义菜单权限的。

@chux0519 另外,使用koa2的同学们可以看看,我把接入部分注册成koa2的中间件了koa2wechat

H
hdumok#17·10 年前

应该是你在menu创建里media_id 但是id 对应的素材你是没有的 素材是要上传的才有id 官方文档里那个id 是乱填只是个说明

H
hdumok#18·10 年前

没权限好像是报 api unauthorized

参与回复
登录后即可参与回复。登录