# ad_rule.triggered

A scheduled run of an ad rule with a `notify` action found campaigns or ad sets meeting every condition.

### When it fires

Each object is announced at most once per rule cooldown. A run where every object is still in cooldown sends nothing.

### Failed actions

An object whose action `failed` gets no cooldown, so the next run retries it and reports it again.

### Payload notes

`objects` lists only the objects the run acted on. `objects[].conditions` repeats every condition of the rule with `actual`, the value the object reached.

### Actions

`objects[].actions` says what the rule did: `done`, `skipped` (with a `reason` such as `already_paused` or `at_limit`) or `failed`. On `adjust_budget` it carries `previousDailyBudget` and `newDailyBudget`; empty on a notify-only rule.

### Run context

`run.today` and `run.timezone` give the ad account's calendar date the windows used. `run.timezoneAssumed` is `true` when UTC was assumed. `run.currency` is the currency of money metrics, or `null` when unknown.




**Payload for `ad_rule.triggered`:**

- **id** (required) `string`: Stable webhook event ID: the dedupe key, also sent as the X-Zernio-Event-Id header and identical on every retry and redelivery.
- **profiles**: `WebhookProfiles` - See schema definition
- **test** `boolean`: Always true when present: only a sample sent by POST /v1/webhooks/test with an event carries it. Real deliveries never do.
- **event** (required) `string`: No description - one of: ad_rule.triggered
- **account** (required): `WebhookAdsAccount` - See schema definition
- **rule** (required) `object`: 
  - **id** (required) `string`: Zernio ad rule ID.
  - **name** (required) `string`: No description
  - **level** (required) `string`: Whether the rule evaluates campaigns, ad sets or ads. - one of: campaign, adset, ad
  - **platformAdAccountId** (required) `string`: Platform-native ad account ID the rule watches.
- **run** (required) `object`: 
  - **id** (required) `string`: ID of the rule run that triggered.
  - **ranAt** (required) `string` (date-time): Scheduled time of the run (UTC).
  - **today** (required) `string` (date): The ad account's calendar date (YYYY-MM-DD) the condition windows were resolved against, so `today` and `last_7d` mean the account's days, not UTC days.
  - **timezone** (required) `string`: IANA timezone used for `today`, for example `Europe/Madrid`.
  - **timezoneAssumed** (required) `boolean`: True when the ad account has no known timezone and UTC was assumed.
  - **currency** (required) `string,null`: ISO 4217 currency of the ad account, which money metrics (`spend`, `cpc`, `cpm`, `cpa`) and condition values are in. Null when unknown.
- **objects** (required) `array[object]`: The campaigns, ad sets or ads this run acted on, at the rule's `level`, including those whose action failed. Objects still in cooldown are left out.
  - **platformId** (required) `string`: Platform-native ID of the campaign or ad set.
  - **name** (required) `string`: Name on the platform. Falls back to `platformId` when the platform reports none.
  - **platformCampaignId** (required) `string,null`: Platform-native ID of the campaign the object belongs to (on a campaign-level rule, the campaign's own ID). Null when unknown.
  - **conditions** (required) `array[object]`: Every condition of the rule, with the value the object reached.
    - **metric** (required) `string`: `spend`, `impressions`, `clicks`, `conversions`, `ctr`, `cpc`, `cpm`, `cpa` or `roas`. New values may be added.
    - **window** (required) `string`: `today`, `yesterday`, `last_3d`, `last_7d`, `last_14d`, `last_30d`, `this_month`, `last_month` or a custom range, in the account's calendar (see `run.today`). New values may be added.
    - **op** (required) `string`: `>`, `>=`, `<`, `<=`, or `top` and `bottom` for a rank condition, whose `actual` is the object's position (1 first).
    - **value** (required) `number`: The threshold set on the rule.
    - **actual** (required) `number,null`: The object's value for the metric over the window. Null when it cannot be computed, for example a cost per action with no actions.
  - **actions** (required) `array[object]`: What the rule did to the object. Empty on a rule that only notifies.
    - **type** (required) `string`: No description - one of: pause, activate, adjust_budget, adjust_bid, adjust_target, reallocate_budget, duplicate, edit_name
    - **status** (required) `string`: Action result.

- `skipped`: the action could not or need not apply (already paused or active, budget at its limit, a budget that is unknown, not daily or set at another level, no live ads, or a permanent refusal from the platform).
- `failed`: it errored and will be retried on the next run. - one of: done, skipped, failed
    - **reason** (required) `string,null`: Why the action was skipped or failed, or the platform's message. Null when done.

Skipped: `already_paused`, `already_active`, `at_limit`, `budget_unknown`, `budget_not_daily`, `budget_level_mismatch`, `no_live_ads`, `budget_shared`, `portfolio_bid_strategy`, `unsupported_bid_strategy`, `no_target_cpa`, `no_target_roas`.

`daily_limit_reached`: held back by the action's `maxChangesPerDay`. `ads_allowance_exceeded`: a reactivation or budget increase for a team past its free live-ads allowance.

`reallocation_incomplete` (failed): a receiver left alone because a giver's cut did not apply, tried again next run.
    - **previousDailyBudget** (required) `number,null`: On `adjust_budget`, the daily budget before the change, in the ad account currency. Null otherwise.
    - **newDailyBudget** (required) `number,null`: On `adjust_budget`, the daily budget after the change. Null when nothing changed.
    - **previousName** (required) `string,null`: On `edit_name`, the object's name before the change. Null otherwise.
    - **newName** (required) `string,null`: On `edit_name`, the name after the change. Null when nothing changed.
    - **previousBidAmount** (required) `number,null`: On `adjust_bid`, the cap before the change. Null otherwise.
    - **newBidAmount** (required) `number,null`: On `adjust_bid`, the cap after the change. Null when nothing changed.
    - **targetMetric** (required) `string,null`: On `adjust_target`, which target moved. Null otherwise. - one of: cpa, roas, 
    - **previousTarget** (required) `number,null`: On `adjust_target`, the target before the change. Null otherwise.
    - **newTarget** (required) `number,null`: On `adjust_target`, the target after the change. Null when nothing changed.
- **timestamp** (required) `string` (date-time): UTC time at which Zernio generated this event.