Right now I am using the Event API to subscribe to a project and listen to all events related to it, when someone use @ to mention someone it trigger an event but is handle like a comment, ant the mention will look like Log in - Asana , but the id used is not the same user ID that you could retrieve with the API, but nevertheless that link will take you to the user task list, so my doubt is what is that id that appear in the mention link and how I can filter which user is mentioned?
Hi Victor,
Youâve found a part of our API that is not very intuitive. As you figured out, the mention actually returns the users âmy tasksâ project: https://app.asana.com/0/(id)/(id)
. To figure out who the user is, you would then need to look at the memberships of that project. Only the user can only be a member of their âmy tasksâ.
Sorry that this is not very clear or simple!
So, basically the IDs that appear when someone is mentioned and are in this format Log in - Asana are the ID of âMy Tasksâ which is a project, and that project only have one owner ID who is the ID of the user who was mentioned? There is a way of request only the projects where the user is the owner?
@Jeff_Schneider do you know if any of this is mentioned somewhere in the documentation ? And thanks for your help .
Hey Victor,
Yep â youâve got it. The only way to get the user from a mention is to:
- Parse the project id from the mentionâs URL
- Get that project (which is the userâs âmy tasksâ)
- The âownerâ of the project is the user from the mention
Unfortunately, this process is not documented explicitly, however, the resources you need to query are documented: projects, users.
Thanks!
@Jeff_Schneider, I need a little more help. Do you know if there is a way to retrieve or get those types projects which are âMy Tasksâ from specific user?
I was testing getting all the projects but apparently âMy Tasksâ doesnât appear.
Iâm sorry to say that there is no easy way to get a specific userâs âMy Tasksâ. There are potential workarounds, though they are not great. If you let me know what youâre trying to build, I may be better able to help you find a solution for the project.
I am working on a Chrome Extension, and I would like to subscribe to âMy tasksâ project so I can be watching when tasks are assigned and so on. I was doing that subscribing to the projects the user already have but there is the scenario where the user doesnât have tasks so there will be no projects to subscribe or there is the scenario where tasks are assigned without being on a project. So I think the best option is to subscribe to âMy taskâ.
Hey Victor, sorry that itâs not easier to get a userâs âMy Tasksâ. We hope to improve this in the future.
If you are trying to get all of the tasks assigned to a particular user, you could do something like this:
GET /tasks?assignee=123456&limit=10&workspace=123456
. This request gets all tasks assigned to a particular user (you can use a user-id, email, or âmeâ to select the user). You donât need to provide a project so it will still get tasks for users that donât have any projects.
I hope this helps!