Get User Phones

Retrieves all known phone numbers from the user's profile in Transmit

Description

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

Maintaining a list of a user's known phone numbers can facilitate SMS-based authentication flows. For example, before sending an SMS OTP, the journey can look up a user's phone number based on username or validate that a phone number provided by the user is a known phone number 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 phone numbers and stores them in the configured output variable so they'll be available for subsequent steps. The phone numbers are stored in the variable in a parameter named list as an array of strings, where each phone number is specified in E.164 format (e.g., ["+14155552671", "+14155557999"]).

If the step is successfully completed, the journey returns the phone numbers 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 phone numbers. The phone number list is available in the list parameter as an array of strings, where each number is specified in E.164 format (e.g., ["+14155552671", "+14155557999"])
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 phone numbers

Suppose a user has the following known phone number (added using the Register a Phone step): +14155552671. This step is configured to store the phone numbers in an output variable named userPhones. A subsequent step can then retrieve the list using userPhones.list, which would return ["+14155552671"] in our example.

Example 2: Validate phone number is known

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

In our example, the next step is a Generic Condition that checks if the provided phone number is contained in the list of known phone numbers using the following expression: @std.contains(userPhones.list, providedPhone):