Skip to content

Templates

File: app/core/models/templates.py

Marketing template designs for direct mail campaigns. Templates store visual content tied to campaigns, rendered via the personalization layer (Figma Plugin, Backup Generator, or legacy Pixelixe).

Key fields

Field Description
template_id Unique identifier
campaign_id Associated campaign
side Front or Back of mailer
provider_id ID from the rendering engine (Figma or Pixelixe)
provider_type Rendering engine identifier stored in json (defaults to "pixelixe")
variables Personalization variables
ignore_personalization Skip variable substitution if true
static_image_url Pre-rendered static image fallback

Lifecycle

  1. Created during campaign setup (methods/autogenerator.py)
  2. Fetched during image generation (methods/generator.py)
  3. Copied between campaigns in A/B testing (methods/experiment_promotion.py)

API

  • POST /v1/templates -- Create with provider_type
  • PATCH /v1/templates/{id} -- Partial update
  • PUT /v1/templates/{id}/backup -- Update backup date (admin-only)
  • DELETE /v1/templates/{id} -- Remove (admin-only)

Key files

  • Model: core/models/templates.py
  • Routes: routes/template_routes.py
  • Generation: methods/generator.py, methods/autogenerator.py