Including mention tags in Task comments when

Sorry if this has been asked before, but I am new to the forum and was not successful in searching for a similar question.

I am automating the process of creating Asana tasks within some other applications we run. I have everything working fine with the exception of being able to add @mention tags to the Task comments. I have tried including @, @ within the comment text, but neither seem to work, it just appears as text inside the comment, not as a mention.

Is this not possible using the API? It is key for me to gain faster EU buy-in to the process.

Example payload using gid (I have replaced all with XXXXXXXX):

{
    "projects": [
        "XXXXXXXXXXXXXXXX"
    ],
    "memberships": [
        {
            "project": "XXXXXXXXXXXXXXXX",
            "section": "XXXXXXXXXXXXXXXX"
        }
    ],
    "name": "RMA0002878",
    "due_on": "2025-01-27",
    "assignee": "XXXXXXXXXXXXXXXX",
    "notes": "Hey @XXXXXXXXXXXXXXXX can you check this and then let @XXXXXXXXXXXXXXXX  know what you get?",
    "custom_fields": {},
    "followers": [],
    "images": []
}

This examples uses the user name:

{
    "projects": [
        "XXXXXXXXXXXXXXXX"
    ],
    "memberships": [
        {
            "project": "XXXXXXXXXXXXXXXX",
            "section": "XXXXXXXXXXXXXXXX"
        }
    ],
    "name": "RMA0002878",
    "due_on": "2025-01-27",
    "assignee": "XXXXXXXXXXXXXXXX",
    "notes": "Hey @Fernando Gisone can you check this and let @Steve Tice know what you find out?",
    "custom_fields": {},
    "followers": [],
    "images": []
}

This creates the task as desired but the @XXXXXXXXXXXX in the comments remains as text with @ or @ not as a tag. Is there some other way I need to get these in?

Thanks!

Hi @Tommy_E_Cole_Jr and welcome to the forum,

Yes, it’s possible!

First, just in terms of terminology, based on your code sample, I think you mean to say “Task description”, not “Task comments”. In Asana, “Comments” refers to the stories object which is the string of comments that folks can make that’s located at the bottom of a task’s detail pane. While you can definitely add @mentions in those via the API, that’s not what your code snippet is showing; it looks to me like a task object.

OK, on to the actual answer: see the section on Rich Text in the API docs, specifically Rich Text > Writing Rich Text > Links. You’ll be writing to the html_notes field, not notes, and that section shows you the format to use.

Please ask if anything is not clear!

2 Likes

Perfect! Thank you so much. That worked perfect for me!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.