AM
ID
Mulai Gratis
Menu
Tipe

Templat Email

Templat email yang dapat digunakan kembali dengan placeholder variabel untuk konten yang dipersonalisasi.

email template personalization variables

Templat Email

Templat Email mendefinisikan konten email yang dapat digunakan kembali dengan placeholder variabel ({{variable}}) untuk personalisasi dinamis.

Skema

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
}

Properti

PropertiJenisKeterangan
idstringKSUID dengan awalan emt_
account_idstringAkun yang memiliki template
namestringNama yang bisa dibaca manusia
event_typestringNama pemicu event
editorstringTipe editor
editor_statestringStatus editor berseri
mjmlstringSumber MJML
subject_templatestringTemplat baris subjek
body_text_templatestringTemplat badan teks biasa
body_html_templatestringTemplat badan HTML
archived_atstring?Stempel waktu yang diarsipkan

Sintaks Variabel

Gunakan {{variable_name}} untuk substitusi:

Subject: Welcome, {{name}}!

Dear {{name}},

Your account {{account_name}} is ready.

Best regards,
The {{company}} Team

Penggunaan

Kirim dengan templat:

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

Contoh

{
  "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
}

Terkait