post a comment through the API (asana API)

Hello Team,

We need to post a comment on task using Asana API , is that possible ? if yes please let me ping possible ways and API link.

If not - please provide us a alternative way to do post a comment on task.

Thanks in advance!!

Hi @Vivekanandababu_Kodi,

Yes, it’s possible! Comments are called Stories in the Asana API. Use this API endpoint to create a new story on a task:

Hi How can I do it in Asana 3.2.1 ? api_response = client.tasks.create_story_for_task(
task_gid=task_gid, opt_fields=opt_fields
) this method didn’t work ?

Hi @Jakub_Cielepak and welcome,

What client library is that? Python? Node?

HI @Phil_Seeman Python, asana version 3.2.1

Hi @Jakub_Cielepak,

Here’s how you would make that request with our Python V3.2.1 version

import asana

client = asana.Client.access_token('<YOUR_PERSONAL_ACCESS_TOKEN>')
result = client.stories.create_story_for_task('<YOUR_TASK_GID>', {'text': 'This is a comment'})

TIP: you can see check how to do this in our developer docs under “PYTHON-OLD” (these sample codes are for python client library versions <= V3.2.1)

1 Like

Thank you ! @John_Vu @Phil_Seeman