AM
ES
Comenzar gratis
Menú
Tipos

Plantilla de Email

Plantilla de email reutilizable con marcadores de variables para contenido personalizado.

emailtemplatepersonalizationvariables

Plantilla de Email

Una Plantilla de Email define contenido reutilizable con marcadores de variables ({{variable}}) para personalización dinámica.

Schema

interface EmailTemplate {
  id: string; // "emt_..." - Unique identifier
  account_id: string; // Owning account
  name: string; // Template name
  event_type: string; // Business event (e.g., "user_welcome")
  editor: "grapesjs_mjml"; // Template editor
  editor_state: string; // Serialized editor state
  mjml: string; // MJML source
  subject_template: string; // Subject with variables
  body_text_template: string; // Plain text with variables
  body_html_template: string; // HTML with variables
  archived_at: string | null; // Archived timestamp
}

Propiedades

Propiedad Tipo Descripción
id string KSUID con prefijo emt_
account_id string Cuenta propietaria de la plantilla
name string Nombre legible para humanos
event_type string Nombre del evento disparador
editor string Tipo de editor
editor_state string Estado serializado del editor
mjml string Fuente MJML
subject_template string Plantilla de la línea de asunto
body_text_template string Plantilla del cuerpo en texto plano
body_html_template string Plantilla del cuerpo en HTML
archived_at string? Fecha de archivado

Sintaxis de variables

Usa {{variable_name}} para sustitución:

Subject: Welcome, {{name}}!

Dear {{name}},

Your account {{account_name}} is ready.

Best regards,
The {{company}} Team

Uso

Enviar con plantilla:

{
  "template_id": "emt_...",
  "to": [{ "email": "user@example.com" }],
  "variables": {
    "name": "Jane",
    "account_name": "Acme Corp",
    "company": "Example Inc"
  }
}

Ejemplo

{
  "id": "emt_2kHfPZcN9xW4mE8RtY7vB",
  "account_id": "acc_1jGePYbM8wV3lD7QsX6uA",
  "name": "welcome",
  "event_type": "user_welcome",
  "editor": "grapesjs_mjml",
  "editor_state": "{}",
  "mjml": "<mjml><mj-body></mj-body></mjml>",
  "subject_template": "Welcome to {{company}}, {{name}}!",
  "body_text_template": "Hi {{name}},\n\nWelcome to {{company}}...",
  "body_html_template": "<h1>Welcome, {{name}}!</h1>...",
  "archived_at": null
}

Relacionado