# How to get Comment's attachments using api

**URL:** <https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230>\
**Category:** API & Developers\
**Created:** [9 July 2021 21:27 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230 "2021-07-09T21:27:58Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon6886428](https://luna1.co/8d76cd.png) [@anon6886428](https://forum.asana.com/u/anon6886428)\
**Post date:** [9 July 2021 21:27 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/1 "2021-07-09T21:27:58Z")

</div>

Hi Greetings,

i’ve stuck in a problem, i need your help asap please.

Asana api is allowing me to get attachments via task id. thats fine.  
but i want to get those attachments which are under some comment.  
How can i get attachments using comment id, or let me know any solution please.

Thanks

---

<div class="post-metadata">

**Author:** ![Frederic\_Malenfant](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/frederic_malenfant/32/8358_2.png) [@Frederic\_Malenfant](https://forum.asana.com/u/Frederic_Malenfant)\
**Post date:** [10 July 2021 01:41 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/2 "2021-07-10T01:41:44Z")

</div>

I think there’s absolutely no method to get that information. The document added with the comment is in the attachments collection as any other comment, and there’s no property to tell that it was added with the comment.

Even in the stories, you see that the comment have been added, but there’s NO story for that document being added to the task !! (I think it’s a bug Asana should fix…)

There’s one solution you can try, but it’s not 100% accurate, but it can help if you need to link a comment with a document…

Look at the “created\_at” of that document, + “create\_at” of stories.

If you find a story that is added less than 10 seconds from a document, you can suppose that they were added simultaneously… ???

I just did a test, and there was less than 1 second between both.  
attachment: “created\_at”:  
“2021-07-10T01:30:39.008Z”  
comment (stories): “created\_at”:  
“2021-07-10T01:30:45.114Z”

But, look at my sample, the difference between them is 6 seconds !!! That’s very long…  
I’m not sure you can use it, but you can try !

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [10 July 2021 02:07 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/3 "2021-07-10T02:07:27Z")

</div>

@Frederic_Malenfant, I think you’re 100% correct. It came up before here:

> [@API to fetch embedded attachments and comments in task](https://forum.asana.com/t/api-to-fetch-embedded-attachments-and-comments-in-task/92573/7):
>
> Hi @Avinash1, I’m not an Asana employee, just a volunteer here in the forum, and am not available for a Skype. Please post a new separate topic for this issue, as it’s not related to the subject of this topic. Thanks! In the API view of things, attachments get attached to tasks, not stories (i.e. comments). And while in the UI you can indeed see the attachment on the comment, in the API there’s no way to retrieve this association; the only association available is between task and attachmen…

@Ross_Grambo or @Andrew-asana, do you know why in the Asana UI, we can see an attachment on a comment but in the API, there’s seemingly no linkage available between attachment and story?

---

<div class="post-metadata">

**Author:** ![Andreas\_Butz](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/andreas_butz/32/17119_2.png) [@Andreas\_Butz](https://forum.asana.com/u/Andreas_Butz)\
**Post date:** [13 July 2021 09:44 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/4 "2021-07-13T09:44:26Z")

</div>

we need the information via API what attachement is added to what comment by comment ID, too.

since Asana have allowed adding attachments to comments just some month ago, Asana has not updated their API yet.  
so that is something like a bug showing these attachements belonging to the task (when asking the API about attachments for tasks).

thanks for any message.

---

<div class="post-metadata">

**Author:** ![Ainur\_Knitto](https://luna1.co/8d76cd.png) [@Ainur\_Knitto](https://forum.asana.com/u/Ainur_Knitto)\
**Post date:** [10 July 2023 03:58 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/5 "2023-07-10T03:58:36Z")

</div>

I am also searching for a similar solution, as I intend to duplicate my tasks and include all the elements within them, such as files within comments. It would be helpful to know the specific comments to which these files are related.

---

<div class="post-metadata">

**Author:** ![Carolina\_Trigo](https://luna1.co/8d76cd.png) [@Carolina\_Trigo](https://forum.asana.com/u/Carolina_Trigo)\
**Post date:** [12 July 2024 12:19 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/6 "2024-07-12T12:19:09Z")

</div>

Hello everyone,  
Does anyone have news about this?  
Is it already possible to get comment attachments using API?  
Thanks

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [12 July 2024 15:04 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/7 "2024-07-12T15:04:52Z")

</div>

> [@Carolina\_Trigo](#):
>
> Does anyone have news about this?

There have not been any changes since the last post in this thread, sorry.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [18 July 2024 16:50 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/9 "2024-07-18T16:50:39Z")

</div>

Hi @Krina_Pestro and welcome to the forum,

I’ve merged your post with an existing thread on this topic.

Unfortunately as you can read in the thread, there is currently no known way to get the attachments that are connected to a `story` (which is the API object for a task comment).

---

<div class="post-metadata">

**Author:** ![Ankur\_Prabhu](https://luna1.co/8d76cd.png) [@Ankur\_Prabhu](https://forum.asana.com/u/Ankur_Prabhu)\
**Post date:** [12 February 2025 12:32 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/10 "2025-02-12T12:32:36Z")

</div>

Hey everyone,

I’m looking for a way to post a message on Slack whenever a comment is added to a task. However, I also need to check if the comment includes attachments.

From what I understand, I can listen for the “attachments added” event, but if multiple attachments are added, I receive separate events for each one, which isn’t ideal.

When I get the comment-added event, is there a way to determine whether the comment contains attachments? Or is there a better approach to handle this efficiently?

Would love to hear how others have tackled this!

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrii\_Reznikov](https://luna1.co/8d76cd.png) [@Andrii\_Reznikov](https://forum.asana.com/u/Andrii_Reznikov)\
**Post date:** [20 February 2025 13:28 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/12 "2025-02-20T13:28:13Z")

</div>

Hi!  
I’ve resolved this problem by storing in my database attachments with status: **new** , when I receive webhook with info about attachment (resource:recource\_type=attachment).  
When I catch webhook with resource\_type=story, it goes after attachments hooks as a rule, I know all attachments from this story (in status new), and change status in database to sent after processing.  
Other way when somebody uploads attachment to task =\> I receive webhook story with resource\_subtype:attachment\_added, so I get text (%username% attached %attachment\_name%) from this story, explode with ‘attached’ phrase, and receive attachment name. Next step is get all attachments from task and find by name this attachment (last one as usual).

---

<div class="post-metadata">

**Author:** ![Никита5](https://luna1.co/8d76cd.png) [@Никита5](https://forum.asana.com/u/%D0%9D%D0%B8%D0%BA%D0%B8%D1%82%D0%B05)\
**Post date:** [20 February 2025 13:39 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/13 "2025-02-20T13:39:49Z")

</div>

Hi!  
Can you please tell me how to track new comments on any task and send the data via webhook ?

---

<div class="post-metadata">

**Author:** ![Andrii\_Reznikov](https://luna1.co/8d76cd.png) [@Andrii\_Reznikov](https://forum.asana.com/u/Andrii_Reznikov)\
**Post date:** [20 February 2025 14:06 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/14 "2025-02-20T14:06:08Z")

</div>

> **[Establish a webhook](https://developers.asana.com/reference/createwebhook)**
>
> Establishing a webhook is a two-part process. First, a simple HTTP POST request initiates the creation similar to creating any other resource. Next, in the middle of this request comes the confirmation handshake. When a webhook is created, we will...

establish to task or to project.  
Warning: each webhook can send not more 10k requests to your service

---

<div class="post-metadata">

**Author:** ![Никита5](https://luna1.co/8d76cd.png) [@Никита5](https://forum.asana.com/u/%D0%9D%D0%B8%D0%BA%D0%B8%D1%82%D0%B05)\
**Post date:** [20 February 2025 14:13 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/15 "2025-02-20T14:13:41Z")

</div>

I can’t confirm the handshake because when I send an HTTP request to [https://app.asana.com/api/1.0/webhooks](https://app.asana.com/api/1.0/webhooks), an empty response is returned to my webhook.

I also get error 400 on the output of the HTTP request

{“errors”:[{“message”:“The remote server which is intended to receive the webhook did not respond with the handshake secret.”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: [Errors](https://developers.asana.com/docs/errors)”}]}

 ![image](https://us1.discourse-cdn.com/asana/original/4X/8/3/d/83de26a9e9e05346fdd66c91dd85e98db14abc44.png)

---

<div class="post-metadata">

**Author:** ![Andrii\_Reznikov](https://luna1.co/8d76cd.png) [@Andrii\_Reznikov](https://forum.asana.com/u/Andrii_Reznikov)\
**Post date:** [20 February 2025 14:17 UTC](https://forum.asana.com/t/how-to-get-comments-attachments-using-api/128230/16 "2025-02-20T14:17:09Z")

</div>

```auto
if ($request->hasHeader('X-Hook-Secret')) {
            return response('ok', 200)
                ->header('X-Hook-Secret', $request->header('X-Hook-Secret'));
        }
//your code here

```

Hope you understand
