'Facebook Messenger API: "Failed to fetch the file from the url" when the file exists
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}}
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!
Solution 1:[1]
I had the same problem, my facebook bot was in flask python and solved it by adding "threaded=True" to my app.run.
if name == 'main':
app.run(host='127.0.0.1', port=5000, debug=True, threaded=True)
Solution 2:[2]
This error happens also if the file name or the attachment has spaces.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jose Angel Lopez |
| Solution 2 | Federico Schiocchet |
