AM
ZH-TW
免費開始
選單
類型

Email Template

使用變數佔位符產生個人化內容的可重用郵件模板。

email template personalization variables

Email Template

Email Template 定義可重複使用的郵件內容,並透過變數佔位符({{variable}})進行動態個人化。

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
}

屬性

屬性型別說明
idstring帶有 emt_ 前綴的 KSUID
account_idstring擁有此模板的帳戶
namestring人類可讀名稱
event_typestring事件觸發名稱
editorstring編輯器類型
editor_statestring序列化後編輯器狀態
mjmlstringMJML 原始碼
subject_templatestring主旨模板
body_text_templatestring純文字內容模板
body_html_templatestringHTML 內容模板
archived_atstring?封存時間

變數語法

{{variable_name}} 進行替換:

Subject: Welcome, {{name}}!

Dear {{name}},

Your account {{account_name}} is ready.

Best regards,
The {{company}} Team

用法

以模板寄送:

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

範例

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

相關