# Expression Builder

## Overview

The Expression Builder is a visual tool for creating webhook filters without writing code. Filter your webhook notifications to only receive updates that match specific criteria.

**Available when creating and maintaining:**

* Webhook subscriptions [(API documentation)](/api-release-8.25/dataloy-rest-api/webhooks.md)
* Subscription templates

**Example**: Instead of getting notified about all voyage updates, only get notified for voyages with status "Nominated" or voyages longer than 30 days.

## Add Your First Condition

1. Click **+ Add Condition**
2. Click field to open the field selector and select a "Field" (e.g., `voyageHeader.voyageStatus.statusTypeDesc`).&#x20;
3. Choose an "Operator" (=, >, <, etc.)
4. Enter the "Value" (e.g., "Nominated")

<figure><img src="/files/rS0ceqC1ajLB1Sg0o58A" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Notice the expression preview: `voyageHeader.voyageStatus.statusTypeDesc = "Nominated"`
{% endhint %}

## Add Multiple Conditions

Click **+ Add Condition** again to add more filters:

* By default, conditions use **"Match all"** (AND logic) – both must be true
* Switch to **"Match any"** (OR logic) – either condition can be true

<figure><img src="/files/U0M2VHyyi0xNq38bllFB" alt=""><figcaption></figcaption></figure>

**Match all example**: `statusTypeDesc = "Nominated" AND daysCanal > 1`\
**Match any example**: `statusTypeDesc = "Nominated" OR daysCanal > 1`

## Create Groups for Complex Logic

Click **+ Add Group** to create parentheses around conditions:

<figure><img src="/files/mJ5YraRu9EVSxWQZJu0e" alt=""><figcaption></figcaption></figure>

**Result**: `daysCanal > 1 AND (daysTotal < 10 OR daysTotalAtSea < 5)`

## Compare to Field

Instead of comparing to a static value, you can compare one field to another field by toggling **Compare to Field**.

<figure><img src="/files/tRgpRao26egQi0dUvKb5" alt=""><figcaption></figcaption></figure>

**Use case**: Get notified when loading takes longer than discharging:

```
daysLoading > daysDischarging
```

## Previous vs Current Values

When subscribing to updates, you can compare current and previous field values:

* **Previous**: The field value before the update
* **Current**: The field value after the update

**Example**: If voyage daysLoading change from 2.3 to 2.5:

* Previous value = 2.3
* Current value = 2.5

<figure><img src="/files/5pMZRVmqrGlRBWYXYAbZ" alt=""><figcaption></figcaption></figure>

Get notified when loading days increases:

```
prev.daysLoading < daysLoading
```


---

# 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://api.dataloy.com/api-release-8.25/dataloy-rest-api/webhooks/expression-builder.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.
