How could I map profile ID to user ID or email?

I am using Zapier to post a slack message when someone is @ mentioned in Asana. However it seems the @ mention is using profile ID, and I can’t extract the email address from this profile ID to be able to ping them in slack. Any suggestions?

2 Likes

@Cindy_Wang2 - welcome to the forum! Could you post a code snip (or screenshot of the Zapier module), obfuscating any private info? That “profile ID” corresponds to a user object in Asana’s data model, which includes their email address. I’m not sure if the specific module you’re using in Zapier will support returning optional fields, but if not, you could make a subsequent call to GET a user. I’m not sure if that specifically is a supported action in Zapier (maybe someone who builds more frequently in Zapier can chime in).

Thank you Stephen. Basically if I @ mention someone, it shows as “https://app.asana.com/0/profile/PROFILEIDNUMBER” while “Get a user” requires
" user_gid string required

A string identifying a user. This can either be the string “me”, an email, or the gid of a user."
I am wondering if there is any way to get the gid or email from profile ID and I haven’t found any way.


@Cindy_Wang2 - ah I see, I just played around with this and can confirm I see similar behavior. Does the Zapier module allow you to do any configuration? What you see is the text field of the story (comment); if you can change that to the html_text field, then that exposes an <a> tag with the user’s GID stored in the data-asana-gid property.

If you’re not able to change that configuration, I’m not sure of other easy workarounds (maybe someone with more familiarity with task stories like @Phil_Seeman can help?). Perhaps you can make a custom HTTP call (I assume this is a pre-built Zapier module for task comments?) to the task, grab the most recent comment story, and then use process above.

EDIT: based on this post, as of last year at least, it wasn’t easily possible to go backward from “profile” id to user id:

Hi Cindy,

Where specifically are you seeing/getting this URL string?

@Phil_Seeman - When I call GET on the stories endpoint, I see that pattern in the text return (I’m assuming that’s what Zapier gives).

@Stephen_Li Thank you. However, I am not sure I understand what you suggested. When Zapier is triggered based on a new comment in Asana, it only allows “Text”. I don’t think Zapier reads a “html_text” field.


@Phil_Seeman If I use @ mention in a task comment, that Text field in Zapier would turn that @ mentioned user part into a string like https://app.asana.com/0/profile/ followed by the profile ID.

@Cindy_Wang2,

After the trigger step gives you the comment, it looks like you would need to use the Webhooks by Zapier action to retrieve the comment - that will give access to all of the fields including html_text. That does require some knowledge of the Asana API, but also there are a number of posts here in the forum about Webhooks by Zapier.

2 Likes

I am running into a The app returned “Forbidden” (HTTP Status Code: 403) error.
It is too bad Asana doesn’t make this easier.

I just tested it; this is how you need to set up your Webhooks configuration:

Where you see 2/159… you’ll put your Personal Access Token.

Let me know if any questions!

1 Like

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