Rule templates — pre-built automations
Last updated: May 19, 2026
Rule templates — pre-built automations
/rules/templates. Backed by GET /api/v1/rules/templates (verified). Templates are pre-configured rules (conditions + actions + schedule + cooldown) you can fork to skip the empty-form blank-page problem. The frontend rule-template-gallery component renders the catalog. Cross-platform templates (6 pre-built in cross-platform-rule-templates.ts) sit behind the ENABLE_CROSS_PLATFORM_RULES flag.
Who is this for
First-time rule builders. Anyone porting common recipes (kill losers, scale winners, frequency cap) without writing them from scratch.
How to use
Step 1: Open the gallery
/rules → From template button. Or /rules/templates directly.
Step 2: Browse + filter
Templates are grouped by category:
Kill losers — pause underperforming entities
Scale winners — increase budget on top performers
Protect spend — alert / cap when budget pace is wrong
Frequency cap — pause on creative fatigue
Cross-platform (if flag on) — multi-platform performance rules
Each card shows: name, description, applicable entity level, default schedule.
Step 3: Pick a template
Click a card → preview modal: full condition logic + actions + parameters defaults.
Step 4: Customize parameters
Templates declare parameters (e.g. ROAS threshold = 1.5 default). Edit per your workspace's typical performance.
Step 5: Set scope
Templates ship without scope (would be wrong for your workspace). Pick:
Ad accounts
Entity filter (name pattern + status)
Platforms (cross-platform only)
Step 6: Save (paused)
POST /api/v1/rules writes a normal automation_rule row with template_id set (for traceability).
Status starts paused. Preview + activate per the normal workflow.
Cross-platform templates (6 pre-built)
Behind ENABLE_CROSS_PLATFORM_RULES. Defined in apps/backend/src/services/cross-platform-rule-templates.ts. Use DSL-based conditions and span Meta + Google + TikTok + LinkedIn + Taboola.
Categories include: kill losers, scale winners, frequency cap, spend pacing, cross-platform ROAS comparison.
POST /api/v1/analytics/rules/from-template instantiates a cross-platform rule from a template.
What's stored in a template
automation_rule_template schema fields:
name,description(en + it for i18n)category(kill / scale / protect / frequency)iconentity_levelcondition_logic+conditions[]actions[]schedule_type+interval_minutescooldown_minutesparameters[]— declared customizable parameters (e.g. ROAS threshold)popularity(rank in gallery)is_active(admin can hide deprecated templates)
Endpoint
GET /api/v1/rules/templates (verified apps/backend/src/routes/api/rules.route.ts).
Query params:
category— filter by categoryentity_level— only matching templatesplatforms[]— for cross-platform filtering
Returns array of template objects. UI renders via rule-template-gallery component.
Customizing a template after creation
A rule created from a template is a normal rule — edit anything: scope, conditions, actions, schedule, protections. No link back to the template (template_id is metadata only). Edits to the template later don't propagate to existing rules.
When templates don't fit
If your scenario isn't covered: build from scratch via /rules/new. Or build once, then save as workspace template if your admin enables that flow.
Best practices
Start with template, then customize
Faster than blank rule. Preview, adjust thresholds, validate vs your performance.
Template as documentation
Reading a template's conditions teaches you good patterns (e.g. always pair ROAS with spend guard). Even if you don't use the template, the structure is reference.
Customize parameters per workspace
A "scale winners" template default ROAS threshold = 2.0 may be wrong for your business. Adjust to your reality (some workspaces target ROAS 1.2, others 4.0).
Same template, multiple scopes
You can create N rules from the same template, each with different scope. E.g. "Kill losers" template instantiated per-client.
Common mistakes
Activating a template without changing parameters: defaults rarely fit your workspace
Forgetting to set scope: rule scope must be set per workspace; templates ship without
Cross-platform template without flag enabled: rule creation will fail; ask admin to enable
ENABLE_CROSS_PLATFORM_RULESExpecting template edits to update existing rules: they don't propagate; treat templates as starting points only
Related
Create your first rule — manual alternative
Extensions — cross-platform + trend operators
Best practices — recipes