Send attachments using an attachment ID in Facebook Messenger
The typical way to send attachments in Facebook Messenger in Flow XO, such as a video or an image, is by using a Send Image task, for example, and uploading the image to Flow XO or providing the URL of an image you have hosted elsewhere. Usually this works perfectly fine. When sending a high volume of messages to Facebook Messenger, however, attachment delivery using this method can start to become unreliable. For reasons internal to the Facebook API, Facebook may start returning the following error:
(#100) Failed to fetch the file from the url
If you start running into this error, you can upload images to Facebook and receive an Attachment ID, which you can use to send the same image any time in the future. Facebook will cache the image on its servers rather than downloading them each time you send a message, and should eliminate this error as well as make message sending more efficient.
The easiest way to get an Attachment ID is to send an image to yourself using our Messenger Actions integration and then taking note of the Attachment ID that Facebook returns. You can then use that attachment ID instead of a URL using the same Send Attachment task from Messenger Actions, and Facebook will send the image from its internal cache.
NOTE: If you usually build your Flow XO flows on a desktop, you can make your life easier by using the Desktop version of Messenger to run the helper flow described in this article, so you that you can directly copy and paste urls and resulting attachment IDs between Messenger and Flow XO: https://www.messenger.com/desktop
We have prepared a helper flow that you can install into your account that will ask you for the URL of your image:
After you install this flow into your account and enable it you can run it by chatting with your bot and typing 'get attachment id'
You will be asked for the type of attachment and the URL, and as long as you provide a valid URL that matches that type of attachment you selected you will be given an attachment ID from Facebook and the helper flow will attempt to send your image back to you using the stored attachment ID. If you see your image twice, the process was successful. Sometimes if Facebook Messenger is busy, you may have to try more than once to get it to cache your image, but once it does cache it, that attachment ID should work reliably.
To use this attachment ID, send your attachments using the Messenger Actions integration (you can find it in Other Services in the actions menu) rather than Send Image.
That's all there is to it! Please reach out to firstname.lastname@example.org if you have any trouble using this technique to improve media delivery on Facebook Messenger.