Facebook Messenger API:"Failed to fetch the file from the url" 当文件存在时
Facebook Messenger API: "Failed to fetch the file from the url" when the file exists
我目前正在尝试使用 Facebook Messenger 发送 API 将托管图像作为附件发送。我发出如下 POST 请求:
{"message": {"attachment": {"payload": {"url": "http://url.com/image"},
"type": "image"}},
"recipient": {"id": 129760000000000}}
当我使用浏览器访问给定的 URL 时,它会显示图像。然而,API总是returns一个错误:
{'error': {'code': 100,
'type': 'OAuthException',
'fbtrace_id': 'GlCkjxuGMw0',
'error_subcode': 2018008,
'message': '(#100) Failed to fetch the file from the url'}}
我该如何解决这个错误?非常感谢任何帮助!
对于以后可能会遇到这个问题的人,我设法找出了问题的根源。 Messenger 附件有内置的文件限制,这张图片 (2MB) 超过了限制。使用较小的图像重试成功。但是,不幸的是,Messenger 文档没有指定限制,所以只能靠猜测了!
我有同样的问题,我的 facebook 机器人在 flask python 中并通过将 "threaded=True" 添加到我的 app.run 解决了它。
if <strong>name</strong> == '<strong>main</strong>':
app.run(host='127.0.0.1', port=5000, debug=True, threaded=True)
如果文件名或附件有空格,也会发生此错误。
我目前正在尝试使用 Facebook Messenger 发送 API 将托管图像作为附件发送。我发出如下 POST 请求:
{"message": {"attachment": {"payload": {"url": "http://url.com/image"},
"type": "image"}},
"recipient": {"id": 129760000000000}}
当我使用浏览器访问给定的 URL 时,它会显示图像。然而,API总是returns一个错误:
{'error': {'code': 100,
'type': 'OAuthException',
'fbtrace_id': 'GlCkjxuGMw0',
'error_subcode': 2018008,
'message': '(#100) Failed to fetch the file from the url'}}
我该如何解决这个错误?非常感谢任何帮助!
对于以后可能会遇到这个问题的人,我设法找出了问题的根源。 Messenger 附件有内置的文件限制,这张图片 (2MB) 超过了限制。使用较小的图像重试成功。但是,不幸的是,Messenger 文档没有指定限制,所以只能靠猜测了!
我有同样的问题,我的 facebook 机器人在 flask python 中并通过将 "threaded=True" 添加到我的 app.run 解决了它。
if <strong>name</strong> == '<strong>main</strong>':
app.run(host='127.0.0.1', port=5000, debug=True, threaded=True)
如果文件名或附件有空格,也会发生此错误。