Closed cn0068 closed 3 years ago
首先这是两个问题:
{"success":false,"message":"access_token missing, hint: [1629155382_210_3befab32bc7561313a552e71de432623], from ip: 1xx.1xx.1xx.2, more info at https://open.work.weixin.qq.com/devtool/query?e=41001"}
这里的报错是因为 message-pusher 向微信的服务器请求时没有携带 access_token 导致的,这种情况应该检查一下配置是否正确。{"success":false,"message":"无效的 access token"}
这里则是因为你提供的 token 和设置的 token 不一致导致的。前者的 access_token 是向微信服务器提供的 token,后者则是用户向 message-pusher 提供的 token,这两个实际上是两个不同的 token。引发混淆的原因在于我没有对 API 的报错消息进行妥当的处理,直接把微信服务器的报错消息返回给了用户,这个后续会进行处理。
奇怪。 1,微信企业号的设置是正确的。微信测试号也没留空。 默认推送方式 corp 一定得设置https,反代? 2,token 和设置的 token是一致的。
确实很奇怪。
对于第一点,请问微信测试号的推送方式可以正常使用吗?
对于第二点,如果是带 token 的话不能这样请求,应该:http//www.xxxx.com:3000/admin/?title=hi&token=xxxx
,这点没有在文档里说清楚。
1,测试号如何获取openid?弄一下午也没搞到。 2,http//www.xxxx.com:3000/admin/?title=hi&token=xxxx这样访问后返回管理页面,无出错提示。但也无消息发送成功提示。
1,开始就用的那个做openid,结果验证失败。 2,带token测试, 系统状况
运行模式:普通模式 内存占用:74.44 MB 消息推送服务 由 JustSong 构建,源代码遵循 MIT 协议 运行测试是上面这样子。
是不是因为我用的是端口转发的原因?自己的服务器,不能用80,用的非80的3000端口。
之前有一个用户反馈用宝塔安装可能会遇到数据库无法创建的问题,详见:https://github.com/songquanpeng/message-pusher/issues/7
应该和端口没关系,我本地开发的时候也是 3000,并不会遇到问题。
数据库创建是正常的,并且能随设置保存更新。
运行:http://www.xxx.com:3000/admin/verify,出现:verification failed
这个链接是让微信的服务器访问的,
我突然意识到有没有是因为你搞混了以下两个 token:
我就是写的一样的,这两个不一样?
当然如果你设的值的是一样的话也没关系。
token设置的都是1
如果设置了token,运行 http//www.xxxx.com:3000/admin/hi&token=xxxxxxxxxxxx ,则出现: {"success":false,"message":"无效的 access token"} 无论设置token与否都出错。请问是什么原因?
请问这个问题还存在吗?
设置了token,运行 http//www.xxxx.com:3000/admin/hi&token=xxxxxxxxxxxx 则没有上面的提示了。 显示以下信息: 系统状况
运行模式:普通模式 内存占用:74.86 MB
http://192.168.50.109:3000/admin/?title=hi&token=1 {"success":true,"message":"ok"}
谢谢! 测试号现在运行是正常了吧!
微信能收到消息就是 okay 了
企业号还是不行。先有这个测试就行了。 另外,我想在路由器中把一些内容推送到微信,如何设置,有调用微信推送的参考代码吗?
企业号还是不行。先有这个测试就行了。
企业号的话我建议你重新设置一下,我感觉是哪里没设置对,之后重启一下应用。
另外,我想在路由器中把一些内容推送到微信,如何设置,有调用微信推送的参考代码吗?
就是普通的 HTTP GET 请求或者 HTTP POST 请求,例子的话,如果有 Python 环境的话: https://github.com/songquanpeng/daily-report/blob/33be58e51abfc1f7fa6ea92c37c6ff5d5faac010/main.py#L13-L24
非常感谢!我自己再测试一下企业号。
企业号也测试好了。 http://192.168.50.109:3000/admin/?&title=hi&description=hellotest&content=markdown35&token=1 {"success":true,"message":"ok"} 打开企业微信,可以看到推送的消息: hi hellotest 点击详细,跳转网页打不开:https://www.xxx.com/message/019306c1-0c07-44bd-b62f-bb22ae7b04b8 但其实用这个是能打开的:http://www.xxx.com:3000/message/019306c1-0c07-44bd-b62f-bb22ae7b04b8 内容: hi hellotest markdown35 请问如何能让跳转网页地址正确显示?
项目根目录下有一个 config.js,那里面的 href 字段填:http://www.xxx.com:3000/
项目根目录下有一个 config.js,那里面的 href 字段填:
http://www.xxx.com:3000/
谢谢,微信跳转正常打开了。 域名未备案也是可以微信跳转的。 另外,POST 请求方式:请求路径为 https://你的域名/前缀/,参数 如何调用,有例子供参考吗?
import requests
res = requests.post("http://www.xxx.com:3000/prefix/", data= {
"title": "标题",
"description" : "描述",
"content": "**Markdown 内容**",
"token": "6666"
})
print(res.text)
Heroku模式试了还是不行,显示:{"success":false,"message":"无效的访问凭证,请检查 token 参数是否正确"}
微信那边配置可以通过
Heroku模式试了还是不行,显示:{"success":false,"message":"无效的访问凭证,请检查 token 参数是否正确"}
这个是因为 token 输错了
Heroku模式试了还是不行,显示:{"success":false,"message":"无效的访问凭证,请检查 token 参数是否正确"}
这个是因为 token 输错了 我看了半天您的代码,刚测试了,不是token问题,helloku里Config Vars少个ACCESS_TOKEN项目,新增上就OK了,WECHAT_VERIFY_TOKEN没用上。
哇,还真是。因为我是部署在自己的服务器上,Heroku 上的 ACCESS_TOKEN 没测试,竟然没发现这个问题。
宝塔安装,后台设置成功。运行测试出错:http//www.xxxx.com:3000/admin/hi 未设置token,出现: {"success":false,"message":"access_token missing, hint: [1629155382_210_3befab32bc7561313a552e71de432623], from ip: 1xx.1xx.1xx.2, more info at https://open.work.weixin.qq.com/devtool/query?e=41001"} 如果设置了token,运行 http//www.xxxx.com:3000/admin/hi&token=xxxxxxxxxxxx ,则出现: {"success":false,"message":"无效的 access token"} 无论设置token与否都出错。请问是什么原因?