Using the endpoint to get all attachments related to a task includes inline attachments (including those in stories). This is clearly documented behavior:
Note that within the Asana app, inline images in the task description do not appear in the index of image thumbnails nor as stories in the task. However, requests made to
GET /attachmentsfor a task will return all of the images in the task, including inline images.
Source: Get attachments from an object
As I try replicating the same attachments gallery experience as the Asana webapp, I am consistently wrestling with filtering the task attachments array so that it contains ONLY attachments that are not represented elsewhere.
The problem is that I do not need to request ALL stories of each task. However, this prevents me from properly filtering the attachments array since I cannot parse the html_text of the task stories to know which attachments are actually inline within stories.
I also do not always need to request each task’s html_text. This also prevents me from detecting the inline attachments for filtering.
Does anyone have a performant solution for this? How can we use the Asana API (sparingly and optimally) to replicate the attachments gallery on a task within the Asana webapp?