Get Comments

For a given task, is there a way to get comments of said task?

Hi @Jack_Remmert

You can’t get “only” comments, as they are special kind of stories (task history).

So, you must query for all stories of that task, as described here
https://developers.asana.com/docs/#get-stories-from-a-task
GET /tasks/{task_gid}/stories

Then, filter the result with type = “comment”.

Because they’re hard to get and you must do a separate query for each task, my suggestion is always to keep them in a local cache, and use “task.modified_at” to invalidate your local cache and update the stories.

1 Like

@Frederic_Malenfant is correct, but I’d like to make one tweak: the type field on stories is deprecated—it’s leftover from when we didn’t have a great way to express the variety of stories in the API, and we’ve kept it in the API only for backwards compatibility. Instead, you should look at the resource_subtype field for a "comment_added" story.

3 Likes

Thanks for the tip, I’ll update Bridge24 to use that filter.

I think you should update the documentation, as I copied it from
https://developers.asana.com/docs/#asana-stories

In the samples on the right, we can see the new resource_subtype = “comment_added” property, but also the deprecated type = “comment”.

1 Like