Skip to content

Combo Templates

Combo templates prescribe future creative tests. Each combo template defines a combo type, product line, audience, and optional Canva design link. Combo templates feed into the suggestion generation and combo report workflows.

Goal: Maintain a library of combo templates that standardize how new creative tests are defined.

Combo templates are stored as macrodata_artifact rows with kind=combo_template. Both low-level and workflow APIs apply:

MethodPathSpecDescription
GET/macrodata-catalogs/{catalog_id}/artifacts?kind=combo_templatemacrodata.yamlList combo templates in a catalog
GET/macrodata-artifacts?kind=combo_templatemacrodata.yamlList combo templates across catalogs
POST/macrodata-artifactsmacrodata.yamlCreate combo template artifact
GET/macrodata-artifacts/{artifact_id}macrodata.yamlGet combo template detail
PUT/macrodata-artifacts/{artifact_id}macrodata.yamlUpdate combo template
DELETE/macrodata-artifacts/{artifact_id}macrodata.yamlArchive combo template
TableRole
macrodata_catalogCatalog/namespace grouping combo template artifacts
macrodata_artifactStores combo templates (kind=combo_template)
link_product_macrodata_artifactLinks products to combo template artifacts
ResourcePurpose
Internal Worker (CF Worker)Serves CRUD endpoints behind CF Access
PlanetScale (Postgres via Hyperdrive)Primary data store
ActorRole
Staff user (Creative)Creates, browses, and deletes combo templates
Dashboard API WorkerServes CRUD endpoints
PlanetScaleData store for combo templates

Combo template identifiers follow the same structured format as combo report identifiers:

{type}-{productCodes}-{productCount}-{audience}-{sequenceNumber}

Examples:

  • SP-IPH-2-WOMEN-001 — first static post combo template, 2 iPhone products, women audience
  • CT-IPH+SAM-3-MEN-002 — second carousel combo template, 3 mixed products, men audience
CodeProduct line
IPHiPhone cases
SAMSamsung cases
GRIPZGrip cases
AIRAirPod cases
AIRMAXAirPod Max cases

When multiple product lines are selected, codes are sorted alphabetically and joined with + (e.g., AIR+IPH).

CodeType
SPStatic Post
CTCarousel Template
NTNew Template
UGCUser-Generated Content
STStory Template

The sequence number is auto-generated by querying existing combo templates with the same prefix and incrementing the highest found number (3-digit padded: 001, 002, etc.).

interface CreateComboTemplate {
label: string | null; // optional human-readable name
type: "SP" | "CT" | "NT" | "UGC" | "ST";
product_count: number; // number of products in the combo
audience: "WOMEN" | "MEN";
canva_url: string | null; // link to Canva design asset
product_codes: string[]; // e.g. ["IPH", "SAM"]
}

The combo template identifier is auto-generated server-side from the type, product codes, count, audience, and next available sequence number.

The underlying macrodata_artifact row uses these columns:

ColumnTypeDescription
idUUIDPrimary key
nameVARCHAR(255)Combo template display name
configJSONBTemplate configuration and design specifications
temporal_originTIMESTAMPTZCreation timestamp
last_modified_atTIMESTAMPTZLast update timestamp

The current system accesses combo_templates directly via the Supabase client from the frontend (no Express route). In the rewrite, this becomes a proper API route in the Dashboard API Worker, following the same pattern as combo reports.

  • Combo template identifier is correctly auto-generated following the convention
  • Multiple product codes are sorted and joined with +
  • Sequence numbers increment correctly and avoid collisions
  • Combo templates can be listed, created, and deleted
  • Deleting a combo template does not affect combo reports that reference its identifier