create_automation_rule
Create an automation rule for an ad account: when a metric crosses a threshold over a lookback window, take an action (alert, pause, or scale budget). New rules default to alert-only unless you set a different action. Works at campaign, ad set, or ad level.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | A short name for the rule. | |
| action | No | What to do when it triggers. Defaults to alert. | |
| metric | Yes | Metric to evaluate. | |
| operator | Yes | gt=greater than, lt=less than, etc. | |
| frequency | No | How often to check. Default daily. | |
| threshold | Yes | The number the metric is compared to. | |
| entity_type | No | What the rule watches. Default campaign. | |
| action_value | No | For scale_budget: percent step (e.g. 20 = +20%). For set_budget: absolute daily budget in major units. | |
| lookback_days | No | Window the metric is measured over, 1-90. Default 3. | |
| cooldown_hours | No | Min hours between actions on the same campaign. Default 24. | |
| meta_account_id | Yes | REQUIRED — the ad account the rule watches. | |
| result_action_type | No | For cpa/results rules that pause or scale: the Meta result to count (e.g. lead, offsite_conversion.fb_pixel_purchase). Required to let a cpa/results rule take a money action. |