Lunogram

Accessing Data

Use user data, events, and step results to personalize journeys

Journeys can access user profiles, triggering events, and data captured from previous steps. This data is available in templates, conditions, and user updates.

Data Structure

At any point during a journey, two top-level objects are available:

{
  "user": {
    "id": "abc123",
    "email": "chris@example.com",
    "phone": "+01234567890",
    "identifier": [
      { "external_id": "usr_42", "source": "default" }
    ],
    "locale": "en",
    "timezone": "America/Chicago",
    "data": {
      "first_name": "Chris",
      "plan": "premium"
    }
  },
  "journey": {
    "my_entrance": {
      "data": {
        "order_id": "ORD-1001",
        "amount": 29.99
      }
    },
    "enrich_user": {
      "body": {
        "loyalty_points": 300,
        "tier": "gold"
      }
    }
  }
}
  • user contains the user's profile fields and custom properties under data.
  • journey contains output from previous steps, keyed by each step's data key.

Accessing User Data

User profile fields are available directly under user. Custom properties live under user.data:

{{user.email}}
{{user.locale}}
{{user.data.first_name}}
{{user.data.plan}}

Accessing Event Data

When a journey is triggered by an event, the event payload is stored under the entrance step's data key. If the entrance has a data key of my_entrance:

{{journey.my_entrance.data.order_id}}
{{journey.my_entrance.data.amount}}

Data Keys

Entrance and action steps can have a Data Key that makes their output available to later steps. You set the data key in the step's sidebar.

Journey Data Key Example

Action Responses

When an action step executes, its response is stored under the step's data key. For example, an action step with data key enrich_user:

{{journey.enrich_user.body.loyalty_points}}
{{journey.enrich_user.body.tier}}

Using Data in User Updates

Copy step data into user profiles:

Journey Data Key User Update Example

{
  "loyalty_points": "{{ journey.enrich_user.body.loyalty_points }}",
  "loyalty_tier": "{{ journey.enrich_user.body.tier }}"
}

Using Data in Campaigns

Campaign templates do not access the journey object directly. Instead, campaigns define variables — named placeholders with optional defaults. When a campaign step is used in a journey, you map journey data to these variables.

1. Define variables on the campaign

In the campaign settings, add variables such as order_id and loyalty_points. You can set a default value for each.

2. Map journey data to variables in the journey editor

When configuring a Send step, each campaign variable appears as a field. Use the variable picker or type a Liquid expression to map journey data:

Campaign VariableValue
order_id{{ journey.my_entrance.data.order_id }}
loyalty_points{{ journey.enrich_user.body.loyalty_points }}

3. Use variables in the template

Inside the campaign template, reference variables under campaign:

Hi
{{user.data.first_name}}, Your order
{{campaign.order_id}}
earned you
{{campaign.loyalty_points}}
points!

For email campaigns using the React Email editor, the same data is available as props:

export default function Email(props: EmailProps) {
  return (
    <p>
      Your order {props.campaign.order_id} earned you{" "}
      {props.campaign.loyalty_points} points!
    </p>
  );
}

Campaign variables let you reuse the same campaign across different journeys. Each journey maps its own data to the campaign's variables independently.

Template Context Reference

The full context available when rendering a campaign template:

PathDescription
user.emailUser's email address
user.phoneUser's phone number
user.localeUser's locale
user.timezoneUser's timezone
user.data.*Custom user properties
campaign.*Campaign variables (populated from journey data or defaults)
nowCurrent timestamp
preferences_urlLink to the user's preference center
unsubscribe_urlOne-click unsubscribe link (email only, when a subscription is set)

Summary

DataPath
User profile fieldsuser.email, user.phone, user.locale, etc.
Custom user propertiesuser.data.property_name
Entrance event datajourney.DATA_KEY.data.property
Action responsejourney.DATA_KEY.body.property
Campaign variable (in templates)campaign.variable_name

Replace DATA_KEY with the data key you configured on the step.

On this page