AM
TH
เริ่มต้นฟรี
เมนู
ประเภท

Email Template

เทมเพลตอีเมลที่ใช้ซ้ำได้ พร้อมตัวแปรแทนค่าสำหรับเนื้อหาแบบ personalized

email template personalization variables

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; // สถานะ editor ที่ serialize แล้ว
  mjml: string; // แหล่งที่มา MJML
  subject_template: string; // หัวเรื่องพร้อมตัวแปร
  body_text_template: string; // ข้อความล้วนพร้อมตัวแปร
  body_html_template: string; // HTML พร้อมตัวแปร
  archived_at: string | null; // เวลาที่ archive
}

คุณสมบัติ

PropertyTypeคำอธิบาย
idstringKSUID ที่ขึ้นต้นด้วย emt_
account_idstringบัญชีที่เป็นเจ้าของเทมเพลต
namestringชื่อที่อ่านเข้าใจได้
event_typestringชื่อเหตุการณ์ที่ใช้ทริกเกอร์
editorstringประเภท editor
editor_statestringสถานะ editor ที่ serialize แล้ว
mjmlstringแหล่งที่มา MJML
subject_templatestringเทมเพลตหัวเรื่อง
body_text_templatestringเทมเพลตเนื้อหาแบบข้อความล้วน
body_html_templatestringเทมเพลตเนื้อหาแบบ HTML
archived_atstring?เวลา archive

ไวยากรณ์ตัวแปร

ใช้ {{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 - โครงสร้างพื้นฐานอีเมล