[Public beta]{class="badge informative"}

Generate expressions with the Expression Assistant expression-agent

AVAILABILITY
This feature is currently in public beta. For full details about the release cycle and availability phases, see Journey Optimizer release cycle.
Before using the Expression Assistant, read the related Guardrails and Limitations that apply to generative AI features in Journey Optimizer.

The Expression Assistant is an AI-powered feature built into the Journey advanced expression editor. It helps you generate valid expressions from plain language prompts.

It is available wherever the Journey Advanced expression editor opens. For example, when you configure conditions and routing inside an Optimize activity, or when you configure a Wait activity that uses a custom date and you need a dateTimeOnly expression.

Generate an expression generate

To generate an expression using the Expression Assistant:

  1. Open the Advanced expression editor in your journey, nfor example from a branching condition, an Optimize activity, or a Wait activity with a custom date.

  2. In the text field, describe the expression you want to generate in plain language. For example:

    • “Users from USA and age greater than 18”
    • “Customers who have made a purchase in the last 30 days”

    See Example prompts at the end of this page for ideas.

  3. Click Generate to submit your prompt.

    The assistant starts generating the corresponding expression and displays progress status messages while generation is in progress.

    note
    NOTE
    If the assistant cannot generate a valid expression (for example, if your prompt references fields that do not exist in available data sources), an error message appears. When this happens, revise your prompt to use field names and data sources that are available in your journey configuration, then generate again.
  4. Once the expression is ready, review the result in the panel.

    • Click the Preview icon icon before applying to review the assistant’s output for the scenario you requested.

    • Click Apply to insert the generated expression directly into the advanced expression editor (the same placement you would paste into manually).

    • Use the copy control to grab the suggested expression text and paste it elsewhere if needed.

Example prompts example-prompts

The lists below are prompt ideas only. They do not show generated expression syntax, the exact output depends on the fields and activities defined in your journey.

Journey event and custom action example-prompts-event-action

  • “event with order price total greater than 100”
  • “event where the order was created in the last 7 days”
  • “event where the event type is a commerce purchase”
  • “event with order created in the last hour”
  • “event with order price total over 200 and action response has a status code”

Wait activity expressions example-prompts-datetime

When a Wait activity uses a custom date, you define when the profile continues by building a dateTimeOnly expression in the Advanced expression editor. For example from a profile attribute, an event timestamp, segment qualification data, or a calculated offset from the current time. For how to configure custom waits and applicable limits, see Custom wait.

  • “use customer’s last order date as date time only”
  • “use consent email time as date time only”
  • “convert segment membership last qualification time to date time only”
  • “wait node: one week after Christmas 2024 as date time only”
  • “wait node: 30 days from now at 10 PM as date time only”
  • “wait until 9am today in UTC timezone, return as date time only”
recommendation-more-help
journey-optimizer-help