[Typescript] Retrieve foundry user from their email

Hello community,

Is it possible to retrieve a Foundry user, given that I have that user’s email address in my object?

I am trying to write a function that returns a list of users as recipients for an email notification. Based on certain logic, it is a different combination of recipients. My function currently returns the raw email addresses, but AIP Assist indicates I should return users or that function won’t appear in the configurator.

This is triggered from a rule on a modify action on my object.

Hi!

Out-of-the-box, the answer is no.

In TypeScript v1, there is a Users interface that can be imported from @foundry/functions-api, but the only available methods are the ones listed in the above screenshot.

What can be done, however, is you can hit Foundry’s Multipass APIs using a Python Code Repository (Pipelines > Python) to generate a dataset of Users on your Foundry instance. The response of the relevant endpoint includes both the User ID (which is the Primary Key) and the “Username” which is really just the email used to access the platform among other things.

If you were to create an Object Type out of this new dataset, you could refactor your logic to return the User IDs of the recipients of email notifications.

Thanks, Josh! This worked.

  • Used a Python code repo to create a dataset of Foundry users hitting this endpoint:

    • ‘{your-stack}.palantirfoundry.com/api/v2/admin/users’
  • Then, used that dataset and pipeline builder to output this as an object type in our Ontology.

Thanks again for your suggestion.

1 Like