# Expression Engine

## Overview

In **iX Hello Customer v2**, the **Expression Engine** is the **rules and logic layer** that allows teams to define **dynamic behavior** using expressions instead of hard‑coded logic.

It is used to:

* Evaluate conditions
* Compute values at runtime
* Control visibility, routing, validation, and automation
* Personalize customer and agent experiences

Expression Engine V2 offers a secure, JavaScript-native solution for evaluating expressions in customer v2. It operates within isolated Worker threads, ensuring robust hard timeout protection.

### Where Expressions Are Used

| Location                | How expressions are used            |
| ----------------------- | ----------------------------------- |
| **Say Node**            | Dynamic text using `{{expression}}` |
| **Agent System Prompt** | Personalization & context           |
| **Menu Prompts**        | Dynamic options and text            |

### &#x20;Key Principles:

* Use standard JavaScript syntax — no custom $helper functions for things JavaScript can do\
  natively
* Expressions are read-only — they can read variables and compute results but cannot mutate\
  session state
* Only concise arrow functions are supported (x => x.active) — no block-body arrows\
  (x => { return x.active })

### Template Interpolation

Text fields (Say, Agent, Menu prompts) use {{expression}} interpolation:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Syntax</td><td valign="top">Purpose</td><td valign="top">Example</td></tr><tr><td valign="top">{{expression}}</td><td valign="top">Variable lookup or expression</td><td valign="top">Hello {{name}}, you have {{items.length}} items</td></tr></tbody></table>

* {{expression}} — it’s used to indicate where an expression will be evaluated and substituted at runtime.
* Simple variable names like {{name}} resolve to a variable lookup
* Complex expressions like {{items.filter(x => x.active).length}} are fully evaluated
* The double-brace delimiter avoids collision with JSON content in system prompts
* Non-printable results (objects, arrays) are JSON-stringified; null/undefined produce empty\
  string

Note: For assistance on writing these expressions, use our new and improved v2 of iX Employee v2.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc2/technical-specifications/expression-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
