How to write a condition
This guide shows you how to build a rule in the visual condition builder. The builder appears on a condition node, on an experience condition, on an initialize-open condition, and on a field option.
Steps
- Choose the node or the field that takes the condition.
- Find the Logic section in the inspector.
- Choose a data source: Responses, Actions, Feature flags, Conditions, or Window Location.
- Choose an operator. The choices include equals, not equals, greater than, and contains.
- Enter a value.
Join more than one rule
- Create an AND group or an OR group.
- Add your rules inside it.
With AND every rule must match. With OR one rule must match. Put a group inside another group to build a larger rule.
Example
To show a step only to a visitor who is on one page and who accepted marketing:
- Create an AND group.
- Add a rule: Window Location → pathname equals
/pricing. - Add a rule: Responses →
marketing_opt_inequalstrue.
The group matches only when both rules are true.
API and MCP
You can also do this task with the Management API, the MCP server, or code that you send to picked_run.
| Task | GraphQL | MCP tool | Run |
|---|---|---|---|
| Write the rule of a condition node | conditionUpdate, experienceFlowUpdate | update_experience_flow | tools.update_experience_flow({ experience_id, workspace_id, update_conditions }) |
| Write the experience condition or the initialize-open condition | experienceUpdate, experienceFlowUpdate | update_experience_flow | tools.update_experience_flow({ experience_id, workspace_id, condition, initialize_open }) |
| Write the condition of a field option | fieldUpdate, experienceFlowUpdate | update_experience_flow | tools.update_experience_flow({ experience_id, workspace_id, update_fields }) |
The API and the MCP server take each rule as a JSON Logic expression.
Related
- About conditions and the logic engine — what a rule can read.
- Condition builder — the rule structure.
