Rule templates — pre-built automations
GET /api/v1/rules/templates. Browse gallery, pick template, form pre-fills, customize scope + parameters, save. 6 cross-platform templates behind flag.
Written By Salvatore Sinigaglia
Last updated About 4 hours ago
GET /api/v1/rules/templates. Browse gallery, pick template, form pre-fills, customize scope + parameters, save. 6 cross-platform templates behind flag.
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 frontendrule-template-gallerycomponent renders the catalog. Cross-platform templates (6 pre-built incross-platform-rule-templates.ts) sit behind theENABLE_CROSS_PLATFORM_RULESflag.
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_RULES - Expecting template edits to update existing rules: they don't propagate; treat templates as starting points only
FAQ
What are Wevion rule templates?
Templates are pre-configured rules — conditions, actions, schedule, and cooldown — that you can fork to avoid the blank-page problem. Browse them at /rules/templates (backed by GET /api/v1/rules/templates), pick one, customize the parameters and scope, then save. Categories include kill losers, scale winners, protect spend, and frequency cap.
Do I need to set scope on a template?
Yes. Templates ship without scope because a default would be wrong for your workspace. After picking a template you must set the ad accounts, entity filter (name pattern and status), and, for cross-platform templates, the platforms. Forgetting to set scope is a common mistake, and the rule saves in paused status.
If I edit a template later, do my existing rules update?
No. A rule created from a template is a normal rule with template_id stored only as metadata for traceability. There's no link back to the template, so later edits to the template don't propagate to existing rules. Treat templates as starting points and edit the created rule directly.
How do I use cross-platform templates?
Wevion ships 6 pre-built cross-platform templates behind the ENABLE_CROSS_PLATFORM_RULES flag, spanning Meta, Google, TikTok, LinkedIn, and Taboola. Instantiate one via POST /api/v1/analytics/rules/from-template. If the flag is off, cross-platform rule creation fails — ask your admin to enable it.
Should I change a template's parameters before activating?
Yes. Templates declare customizable parameters like a ROAS threshold, and the defaults rarely fit your workspace — a "scale winners" default of 2.0 may be wrong when your business targets 1.2 or 4.0. Adjust parameters to your reality, preview, then activate. Activating without changing parameters is a common mistake.