Email Template
Email Template は、変数プレースホルダー({{variable}})を使って動的にパーソナライズできる再利用可能メールコンテンツを定義します。
スキーマ
interface EmailTemplate {
id: string; // "emt_..." - 一意識別子
account_id: string; // 所有アカウント
name: string; // テンプレート名
event_type: string; // ビジネスイベント(例: "user_welcome")
editor: "grapesjs_mjml"; // テンプレートエディタ
editor_state: string; // シリアライズ済みエディタ状態
mjml: string; // MJML ソース
subject_template: string; // 変数付き件名
body_text_template: string; // 変数付きテキスト本文
body_html_template: string; // 変数付き HTML 本文
archived_at: string | null; // アーカイブ日時
}
プロパティ
| Property | Type | Description |
|---|---|---|
id | string | emt_ プレフィックス付き KSUID |
account_id | string | このテンプレートを所有する Account |
name | string | 人間が読める名前 |
event_type | string | イベントトリガー名 |
editor | string | エディタ種別 |
editor_state | string | シリアライズ済みエディタ状態 |
mjml | string | MJML ソース |
subject_template | string | 件名テンプレート |
body_text_template | string | テキスト本文テンプレート |
body_html_template | string | HTML 本文テンプレート |
archived_at | string? | アーカイブ時刻 |
変数構文
置換には {{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
}
関連
- Email Message - 送信メッセージ
- Email - メール基盤