问题描述
我目前正在尝试使用Facebook Messenger发送API将托管图像作为附件发送.我发出了类似以下的POST请求:
I am currently attempting to send a hosted image as an attachment using the Facebook Messenger Send API. I make a POST request like the following:
{"message": {"attachment": {"payload": {"url": "http://url.com/image"},
"type": "image"}},
"recipient": {"id": 129760000000000}}
当我使用浏览器访问给定的URL时,它将显示图像.但是,API始终返回错误:
When I access the given URL using a browser, it displays the image. However, the API always returns an error:
{'error': {'code': 100,
'type': 'OAuthException',
'fbtrace_id': 'GlCkjxuGMw0',
'error_subcode': 2018008,
'message': '(#100) Failed to fetch the file from the url'}}
如何解决此错误?任何帮助,我们将不胜感激!
How can I fix this error? Any help is very appreciated!
推荐答案
对于以后可能会迷惑于此问题的人,我设法找出了问题的根源. Messenger附件有一个内置的文件限制,该图像(2MB)覆盖了该图像.重试较小的图像成功.但是,不幸的是,Messenger文档没有指定限制,所以这取决于猜测!
For people who may stumble on this question later, I managed to work out the source of the issue. There is an inbuilt file limit for Messenger attachments, and this image (2MB) was over it. Retrying with a smaller image was successful. However, the Messenger documentation unfortunately does not specify the limit, so it's down to guesswork!
这篇关于Facebook Messenger API:“无法从url提取文件"文件存在时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!