Get User Emails

Retrieves all known email addresses from the user's profile in Transmit

Description

This step is used to retrieve all the email addresses stored for a user in Mosaic. Emails are added to user profiles using the Register an Email step and can be removed from the user using the Deregister an Email step. The user's profile can also be viewed from the Admin Portal (from Identity Management > Users), where the registered emails are listed as secondary emails for the user.

Maintaining a list of a user's known email addresses can facilitate email-based authentication flows. For example, before sending an email OTP, the journey can look up a user's email based on username or validate that an email provided by the user is a known email for that user.

The user context for the step may be provided implicitly by the journey if the user is already authenticated; otherwise, a user identifier must be specified in the step configuration. Once triggered, the step retrieves the emails and stores them in the configured output variable so they'll be available for subsequent steps. The emails are stored in the variable in a parameter named list as an array of strings (e.g., ["user@example.com", "user@example2.com"]).

If the step is successfully completed, the journey returns the emails from the user's profile and continues to the next step. If it fails, the journey proceeds to an step failed branch (if one is specified); otherwise, the journey is aborted and an error is sent to the client.

Configuration

Field Description
User Auth State Indicates if the user has authenticated in this journey. If the user is authenticated (default), the user context is provided implicitly by the journey. If not, a user identifier must be configured.
User Identifier User identifier, specified as an expression. Only configured if the journey doesn't authenticate the user before invoking this step.
Output Variable Name of the variable that stores the user's email addresses. The email list is available in the list parameter as an array of strings (e.g., ["user@example.com", "user@example2.com"])
Error Output Variable Name of the variable that stores any errors returned by step
Failure Behavior Determines the behavior in case of failure, which either aborts the journey or proceeds to a failure branch of the control flow (default).

Example

Here are some examples of using this step:

Example 1: Get emails

Suppose a user has the following known email (added using the Register an Email step): user@example.com. This step is configured to store the emails in an output variable named userEmails. A subsequent step can then retrieve the list using userEmails.list, which would return ["user@email.com"] in our example.

Example 2: Validate email is known

Building on the first example, suppose that we want to check if an email provided by the user is a known email for this user (assuming the email is different than the username). In our example, the username and email provided by the user are stored in variables named providedUsername and providedEmail, respectively. This step is configured to retrieve the emails for providedUsername and store them in userEmails.

In our example, the next step is a Generic Condition that checks if the provided email is contained in the list of known emails using the following expression: @std.contains(userEmail.list, providedEmail):