Rules — automate your ad management

/rules = if-then automation. Cron every 15 min. Pause losers, scale winners, protect spend. Companion to Ads Manager.

Written By Salvatore Sinigaglia

Last updated About 4 hours ago

/rules = if-then automation. Cron every 15 min. Pause losers, scale winners, protect spend. Companion to Ads Manager.

Rules — automate your ad management

Rules Engine = if-then automation for your ads. Wevion evaluates every active rule every 15 minutes (cron with 2-minute offset) and acts on matching campaigns / ad sets / ads via SQS workers. Companion to Ads Manager (PRD-16): Ads Manager monitors, Rules Engine acts. Use cases: pause losers automatically, scale winners, protect daily spend, get alerted on anomalies.

Who is this for

Mediabuyers who want to stop doing repetitive manual actions ("pause every campaign with CPA > X for 3 days") and instead let the platform handle the routine + focus on strategy. Especially valuable when managing 10+ active campaigns where manual scanning every morning becomes a bottleneck.

What a rule is

A rule has 5 parts:

  1. Scope — which ad accounts + which entity level (campaign / adset / ad) + entity filter (name contains, status)
  2. Conditions — one or more {metric, operator, value, time_range} combined with AND / OR logic
  3. Actions — what to do when conditions match (pause, activate, increase / decrease budget %, relaunch, notify only)
  4. Scheduleinterval (every N min), daily_at_time, or day_parting
  5. Protections — cooldown, max executions per day, plus budget-change cap fields (configurable; enforcement is coming — see rul-108)

Status is one of paused / active. New rules start paused — toggle to active when ready. When the circuit breaker trips, the rule is set back to paused (not a separate error status).

How evaluation works

Wevion runs a cron job in apps/backend/src/server.ts every 15 minutes (with a 2-minute offset). Each tick:

  1. Cron selects rules where status = active AND last_evaluated_at < 15 min ago
  2. Updates last_evaluated_at first (prevents duplicate enqueue if a tick overlaps)
  3. Enqueues message to SYNC SQS queue (50 max in-flight, 15-min visibility timeout, 20 max attempts)
  4. evaluate-rules.worker.ts fetches latest metrics + checks conditions
  5. For matching entities: enqueues to execute-rule-action.worker.ts
  6. Worker performs the action on the platform (Meta / Google / TikTok / etc.)
  7. Records execution in automation_rule_execution table + audit log

Reality check: "every 15 min" is the minimum cadence. Sub-15-min evaluation is not supported by design — protects against runaway loops + respects platform rate limits.

Use cases

Pause losers

IF cpa > 30 AND spend > 50 FOR last_7dTHEN pause adsetCOOLDOWN 360 min

Kills underperforming ad sets without you logging in every morning.

Scale winners

IF roas > 3 AND spend > 100 FOR last_3dTHEN increase_budget_pct 20COOLDOWN 720 min, MAX 3/day

Scales winners by 20% up to 3 times per day, then waits the cooldown.

Protect daily spend

IF budget_spent_pct > 80 FOR todayTHEN notify_only

Alerts you when 80% of daily budget consumed — manual decision on extra budget.

Frequency cap

IF frequency > 5 FOR last_7dTHEN pause adset

Prevents creative fatigue auto-burning audiences.

Where it lives in the app

Route /rules. Sidebar entry Rules. Pages:

  • List (/rules) — all rules with status + last execution + next fire time
  • Builder (/rules/new, /rules/:id/edit) — create / edit
  • Detail (/rules/:id) — execution history + metrics snapshots
  • Templates (/rules/templates) — pre-built rules to fork

Cross-platform rules

Cross-platform rules (rules that span Meta + Google + TikTok + LinkedIn + Taboola in one rule) sit behind the ENABLE_CROSS_PLATFORM_RULES feature flag. 13 metrics supported (spend, spend_pct, impressions, clicks, ctr, cpc, cpm, purchases, purchase_value, conversions, roas, cpa, cpl) with 5 operators. See rul-117 extensions.

What you'll see

In /rules:

  • Table: rule name, status badge, entity level, schedule, last fired, execution count
  • Per-row actions: Edit, Pause / Resume, Duplicate, Delete, View executions
  • Top toolbar: New rule, From template, Bulk actions

In execution history:

  • Timeline of fires with entity counts (evaluated / matched / acted / skipped / errored)
  • Per-entity result with before / after values + metric snapshot

Key concepts to learn next

Best practices

Start narrow

First rule: target ONE ad account, ONE entity level, ONE condition. Watch execution history for a week. Then expand scope.

Preview before activating

Every new rule: use preview / dry-run to see what would have matched. Avoids surprises on first fire.

Use notify_only when learning

For rules you're unsure about (new metric, new threshold): start with notify_only action. Validate matches are correct over 1-2 weeks. Then switch to actual action (pause / scale).

Conservative cooldowns

For destructive actions (pause, decrease_budget_pct): cooldown ≥ 360 min default. Prevents thrashing on noisy metrics.

FAQ

How often does Wevion's Rules Engine evaluate my rules?

Wevion evaluates every active rule every 15 minutes, via a cron job with a 2-minute offset, then acts on matching campaigns, ad sets, or ads through SQS workers. This 15-minute cadence is the minimum; sub-15-minute evaluation is not supported by design, which protects against runaway loops and respects platform rate limits.

What can I automate with the Wevion Rules Engine?

The Rules Engine handles repetitive ad-management actions so you focus on strategy. Common use cases: pause losers automatically, scale winners, protect daily spend, and get alerted on anomalies. It's the companion to Ads Manager — Ads Manager monitors, the Rules Engine acts on matching entities via if-then logic.

Does a new rule start running immediately?

No. In Wevion, every new rule starts with status paused; you toggle it to active when ready. Before activating, use the preview/dry-run to see what would have matched. Status is one of paused or active — if the circuit breaker trips, the rule is set back to paused. Start narrow and watch the execution history before expanding scope.

What are the parts of a Wevion rule?

A rule has five parts: Scope (which accounts and entity level), Conditions (one or more metric/operator/value/time_range tuples combined with AND/OR), Actions (pause, activate, budget changes, relaunch, or notify_only), Schedule (interval, daily-at-time, or day-parting), and Protections (cooldown and max executions per day; budget-change cap fields are also accepted). Together they define the complete if-then automation.

Where do I find the Rules Engine in Wevion?

The Rules Engine lives at the /rules route, with a Rules entry in the sidebar. Pages include the List (all rules with status and next fire time), the Builder (/rules/new and /rules/:id/edit), the Detail view (execution history and metric snapshots), and Templates (/rules/templates) with pre-built rules to fork.

FAQ

How often does Wevion's Rules Engine evaluate my rules?

Wevion evaluates every active rule every 15 minutes, via a cron job with a 2-minute offset, then acts on matching campaigns, ad sets, or ads through SQS workers. This 15-minute cadence is the minimum; sub-15-minute evaluation is not supported by design, which protects against runaway loops and respects platform rate limits.

What can I automate with the Wevion Rules Engine?

The Rules Engine handles repetitive ad-management actions so you focus on strategy. Common use cases: pause losers automatically, scale winners, protect daily spend, and get alerted on anomalies. It's the companion to Ads Manager — Ads Manager monitors, the Rules Engine acts on matching entities via if-then logic.

Does a new rule start running immediately?

No. In Wevion, every new rule starts with status paused; you toggle it to active when ready. Before activating, use the preview/dry-run to see what would have matched. Status is one of paused or active — if the circuit breaker trips, the rule is set back to paused. Start narrow and watch the execution history before expanding scope.

What are the parts of a Wevion rule?

A rule has five parts: Scope (which accounts and entity level), Conditions (one or more metric/operator/value/timerange tuples combined with AND/OR), Actions (pause, activate, budget changes, relaunch, or notifyonly), Schedule (interval, daily-at-time, or day-parting), and Protections (cooldown and max executions per day; budget-change cap fields are also accepted). Together they define the complete if-then automation.

Where do I find the Rules Engine in Wevion?

The Rules Engine lives at the /rules route, with a Rules entry in the sidebar. Pages include the List (all rules with status and next fire time), the Builder (/rules/new and /rules/:id/edit), the Detail view (execution history and metric snapshots), and Templates (/rules/templates) with pre-built rules to fork.

Last updated: 2026-05-17