skip to Main Content

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!

3

Answers


  1. Chosen as BEST ANSWER

    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!


  2. 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)

    Login or Signup to reply.
  3. This error happens also if the file name or the attachment has spaces.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search