Add comment
add_commentFull Description
Add a comment to a task. Use ONLY for human-authored discussion, feedback, questions, or additional context. Exactly one of text or html_text must be provided. Do NOT use for actions that are automatically logged (assignments, status changes, completion, field updates). Returns the created story with ID, content, author, and timestamp.
Parameters (1 required, 4 optional)
task_idstringGlobally unique identifier for the task.
html_textstringExactly one of text or html_text must be provided. Allowed elements only: <body>, <strong>, <em>, <u>, <s>, <code>, <ol>, <ul>, <li>, <a>, <blockquote>, <pre>. Do not use <h1>, <h2>, <hr/>, or <img> here. Must be well-formed XML with a single root <body>...</body>. Only <a> may have custom attributes; any attribute on any other element is invalid. Do not use elements outside the allowed list (400). . <a> links: For <a> tags specifically, to make it easier to create @-mentions through the API, we only require that you provide the GID of the object you wish to reference. If you have access to that object, the API will automatically generate the appropriate href and other attributes for you. For example, to create a link to a task with GID "123", you can send the tag <a data-asana-gid="123"/> which will then be expanded to <a href="https://app.asana.com/0/0/123/f" data-asana-accessible="true" data-asana-dynamic="true" data-asana-type="task" data-asana-gid="123">Task Name</a>. You can also generate a link to a task in a specific project or tag by including a data-asana-project or data-asana-tag attribute in the <a> tag. All other attributes, as well as the contents of the tag, are ignored. To keep the contents of your tag and make a custom vanity link, include the property data-asana-dynamic="false" when setting the contents of the tag. You would send <a data-asana-gid="123" data-asana-dynamic="false">This is some custom text!</a> and receive <a data-asana-accessible="true" data-asana-dynamic="false" data-asana-type="task" data-asana-gid="123">This is some custom text!</a> If you do not have access to the referenced object when you try to create a link, the API will not generate an href for you, but will instead look for an href you provide. This allows you to write back <a> tags unmodified even if you do not have access to the resource. If you do not have access to the referenced object and no href is provided, your request will be rejected with a 400 Bad Request error. Similarly, if you provide neither a GID nor a valid href, the request will be rejected with the same error.
is_pinnedbooleanPinned comments stay at the top of the task's activity feed.
Falseopt_fieldsstringComma-separated list of optional fields to include in the response. returns gid,name,task,created_by,created_at,text,html_text,is_pinned by default.
textstringPlain-text comment body. Exactly one of text or html_text must be provided.