> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-console/automations/triggers/monitor.md).

# Monitor

Fire an automation whenever a smart contract emits a matching on-chain event.

A monitor trigger watches one of your smart contracts and fires the automation every time a chosen event is emitted on-chain. In this guide, a `Transfer alerts` automation sends a push notification whenever someone moves more than 1 token.

{% hint style="info" %}
**You need a registered deployment.** Monitors watch contracts registered with BaaS: deploy through the CLI with [`baas deploy`](/baas-cli/deploy.md), or register the deployment in the Console's [**Contracts**](/baas-console/contracts/register-a-contract.md) section. The event list comes from the ABI of the registered version.
{% endhint %}

## Point it at an event

{% stepper %}
{% step %}

### Pick the Monitor type

On the **Pipeline** tab, open the [trigger configuration](/baas-console/automations/triggers.md) and pick **Monitor**.
{% endstep %}

{% step %}

### Choose the contract

The choices unlock one after the other. Pick the **Contract name**, then a **Version** (the latest is preselected). Finish with the **Deployment** to watch, identified by its address and network. In our example: your token contract, latest version.
{% endstep %}

{% step %}

### Choose the event

Pick the **Event** to watch. In our example: `Transfer`.
{% endstep %}

{% step %}

### Save

Filters are optional and can be added at any time. Click **Save**: the monitor starts watching once the automation is [**Active**](/baas-console/automations/manage-an-automation.md).
{% endstep %}
{% endstepper %}

## Filter the events

The **Only fire for…** panel narrows down which events fire the automation, with the same rules as everywhere else in the Console. A rule reads one of the event's single-value arguments, `args.to` or `args.value` for a transfer: click **Add filter**, pick the argument, an operator and a value. With two rules or more, choose **All rules** to fire only for an event that satisfies every rule, or **Any rule** for an event that satisfies at least one.

Use **Add group** to nest **All rules (AND)** and **Any rule (OR)** groups. Scalar fields also support **≠**; text supports **contains**, **starts with** and **ends with**. OpenZeppelin evaluates monitor text comparisons without case sensitivity.

In our example, a single rule is enough: `args.value` **>** `1`, with **Smart unit** on, so only transfers above 1 token fire the automation.

Operators, values, the **Smart unit** switch and the limits are on the [Filters](/baas-console/filters.md) page. An event that reaches the monitor but fails its rules fires nothing.

## What stays editable

Reopen the trigger to adjust its filters or to watch another deployment, as long as the event keeps the same shape.

Once the automation has an action, that shape is fixed: the event's signature, its argument names, which arguments are indexed, and which carry a unit. A save that would change it is refused. Remove the actions first.

## When it fires

* The monitor checks the chain about every minute, so expect a short delay between the transaction and the run. On a network that requires block confirmations, it waits for those too.
* One matching event is one run: a transaction emitting three matching events records three [runs](/baas-console/automations/runs-and-logs.md).
* Redelivered events are deduplicated: the same event never fires twice.

## What actions receive

The event arrives under `trigger.event`: `args` holds the arguments by the names the ABI declares (`from`, `to`, `value` for a `Transfer`), and `raw` its on-chain origin (`transactionHash`, `blockNumber`, `timestamp`). The full envelope is in the [Trigger object](/baas-console/automations/reference/trigger.md#monitor-the-event-envelope) reference.

{% hint style="info" %}
**Display `formatted`, compute with `raw`.** A message shows `formatted`. Anything that must stay exact, like an argument of a later [transaction](/baas-console/automations/actions/transaction.md), takes `raw`. An amount with no unit declared arrives as a plain decimal string.
{% endhint %}

In our example, the [notification](/baas-console/automations/actions/notification.md) message uses both the amount and the transaction hash:

```
Transfer alert: {{trigger.event.args.value.formatted}} tokens ({{trigger.event.raw.transactionHash}})
```

Field encodings and the full envelope, including `trigger.monitor.id`, are in the [Trigger object](/baas-console/automations/reference/trigger.md) reference.

## Next

* [Runs and logs](/baas-console/automations/runs-and-logs.md): follow each event's run and read its logs.
* [Triggers](/baas-console/automations/triggers.md): back to the section overview.
* [Deploy a contract](/baas-cli/deploy.md): register the contract you want to monitor.
