Write Custom User Data

Updates custom user data stored by Mosaic for your application

Description

This step is used to manage custom user data stored by Mosaic for your application. For example, this step can be used to note a preference for email vs SMS OTP delivery.

This step evaluates the data expression at runtime, and then merges the data with the existing custom data stored for the user for the application that initiated the journey. The merge is shallow so the value of a nested object or array will just replace the existing one (see Example below).

Once merged, the updated custom data object is stored in a variable so it can be accessed by subsequent journey steps (using the Read Custom User Data step). However, if the expression cannot be resolved or the merge doesn't succeed, the journey will fail.

Note

Custom user data is limited to 500 KB per application

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 User identifier, specified using an expression. Only configured if the journey doesn't authenticate the user before invoking this step.
Data to update Additional user custom_data to add or update for the current user, specified in JSON format and using expressions. Default is {}.

Example

Suppose data to update =

Copy
Copied
{
    "name": {
        "first_name" : "bob"
    },
    "membership" : "gold"
}

And custom data before update =

Copy
Copied
{
    "name": {
        "first_name" : "steve",
        "last_name" : "jones"
    }
}

Then custom data after update =

Copy
Copied
{
    "name": {
        "first_name" : "bob"
    },
    "membership" : "gold"
}