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.
Same here
Same here
How to solve it ,need help
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!
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 } } } }'
Same here
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
Same here.
File a bug report
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")...
Same here