Messenger Image Attachment Error 100 with subcode 2018047
5

HI, is there any change in Messenger's Attachment Upload API?

A few days ago we suddenly got numerous error 'code': 100, 'error_subcode': 2018047 with images that work well for months.

I've checked out threads with this subcode on the community platform like https://developers.facebook.com/community/threads/797236411747568/ https://developers.facebook.com/community/threads/1262589634365379/ https://developers.facebook.com/community/threads/353484249015125/ ,but there aren't any response so I made a new one.

We use it via Send API to simultaneously send a message with an attachment as instructed in the doc. We've read what's on https://developers.facebook.com/docs/messenger-platform/reference/attachment-upload-api and reckon that subcode 2018047 is meant for "Upload attachment failure. A common way to trigger this error is that the provided media type does not match type of file provided int the URL", but we failed understand how did we get this error without any change.

We use the API with AWS S3 url as its payload. Here is the payload example. { "messaging_type": "RESPONSE", "recipient": {"id": "some_recipient_id"}, "message": {"attachment": {"type":"image", "payload": {"url":"some-s3-url.png"}}}, "notification_type": "REGULAR", }

Metadata of those file on S3 has Content-Type value defined as image/jpeg and image/png respectively. They could still be access publicly too. Files' size are around 100-300kb. And replicating that with the same payload on Graph API Explorer works fine.

Here are a few examples of fbtrace_id we got from the error response A_os9lmxXbIraSEWHUsOuzA AmEJrnVImUNZ4B1Eg0vVwai ANKWIv2G1LFypsVXPWdPrrz AgcuXPTuw0tLMQkaWhpXs9S

Do you have any ideas or suggestion? Thank you in advance.

Thanathip
Asked about 11 months ago
Selected Answer
1

Same here

April 16 at 8:18 PM
Pornnapa
1

Same here

April 25 at 6:13 AM
Nicolás
1

How to solve it ,need help

May 7 at 7:11 PM
Pintu Das
1

I've just figured out how to deal with this. This is how I send an attachment to the Instagram messenger:

const api = axios.create();
const fbUrl = 'https://graph.facebook.com/v19.0/PAGE_ID/messages?access_token=xxx';
const formData = new FormData();
formData.append('recipient', JSON.stringify({
    id: SOME_IGSID
}));
formData.append('message', JSON.stringify({
    attachment: {
        type: "image",
        payload: {
            URL: "https://somedomain.com/sample-image.png"
            is_reusable: true,
        }
    }
}));
formData.append('platform', 'instagram');
api.post(fbUrl, formData);

And this is how I send the image to Facebook messenger:

const api = axios.create();
const fbUrl = 'https://graph.facebook.com/v19.0/PAGE_ID/messages?access_token=xxx';
const readStream = fs.createReadStream("path/to/the/file.png");
const formData = new FormData();
formData.append('recipient', JSON.stringify({
    id: SOME_PSID
}));
formData.append('message', JSON.stringify({
    attachment: {
        type: "image",
        payload:{} // payload is empty
    }
}));
formData.append('filedata', readStream);
api.post(fbUrl, formData);

Hope that helps!

May 8 at 5:28 AM
Andrey
2

Upload attachment failure. A common way to trigger this error is that the provided media type does not match type of file provided int the URL

curl -X POST "https://graph.facebook.com/v19.0/Your-page-id/message_attachment" \ -H "Content-Type: application/json" \ -d '{ "access_token":"Your_page_access_token", "message":{ "attachment":{ "type":"image", "payload":{ "url":"https.your-url.com/image.jp", "is_reusable": true } } } }'

March 27 at 11:28 PM
Pranav
2

Same here

April 11 at 9:25 PM
Jame Rattikron
2

Same here. Amazingly enough, it seems to depend on the way the server hosting the image is serving it - but I cannot figure out what element of the response triggers the error (the 'Content-Type' header is correct).

More details here: https://community.home-assistant.io/t/facebook-messenger-no-longer-able-to-send-local-images/719956

April 29 at 2:49 AM
Bogdan
3

Same here.

October 13 at 6:20 PM
Michel
4

File a bug report

June 12 at 4:01 AM
Lars
Bogdan

Where exactly? Because trying to open a bug report just leads to a message saying that the only support is via the developer community (aka "this place")...

April 23 at 5:34 AM
5

Same here

July 7 at 4:40 AM
Hwa-young