การอ้างอิงเพย์โหลดอีเมล
การอ้างอิงสำหรับข้อความ EmailPayload ที่ใช้โดย Notify เมื่อส่งอีเมล
EmailPayload
Anchor link tosubject(map<string, string>): บรรทัดหัวเรื่องที่กำหนดโดย locale เช่น{"en": "Hello!", "es": "¡Hola!"}body(string): เนื้อหา HTML ของอีเมล สำหรับเนื้อหา HTML ตามแต่ละ locale ให้ใช้email_templateกับ Email Template ที่กำหนดค่าไว้ใน Control Panelattachments(array ofAttachment): ไฟล์แนบlist_unsubscribe(string): URL ที่กำหนดเองสำหรับเฮดเดอร์List-Unsubscribefrom(Address): แทนที่ค่าFromเริ่มต้นที่กำหนดค่าไว้ในการตั้งค่าอีเมลของแอปreply_to(Address): แทนที่ค่าReply-Toเริ่มต้นที่กำหนดค่าไว้ในการตั้งค่าอีเมลของแอปemail_template(string): รหัสของ Email Template ที่จะใช้แทนbodyแบบอินไลน์
Attachment
Anchor link to{ "name": "invoice.pdf", "content": "<base64-encoded bytes>"}| ฟิลด์ | ประเภท | คำอธิบาย |
|---|---|---|
name | string | ชื่อไฟล์ตามที่ผู้รับเห็น |
content | string | เนื้อหาไฟล์ที่เข้ารหัสแบบ Base64 |
Address
Anchor link to{ "name": "Pushwoosh", "email": "support@example.com"}ทั้งสองฟิลด์เป็นทางเลือก
หากไม่ระบุ name ผู้รับจะเห็นที่อยู่อีเมลโดยตรง
ตัวอย่าง: ส่งอีเมลไปยัง segment
Anchor link tocurl -X POST https://api.pushwoosh.com/messaging/v2/notify \ -H "Authorization: Token YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "segment": { "application": "XXXXX-XXXXX", "platforms": ["EMAIL"], "code": "newsletter_subscribers", "email_payload": { "subject": { "en": "Our May updates", "es": "Novedades de mayo" }, "email_template": "may-digest-2026", "from": { "name": "Pushwoosh Team", "email": "news@example.com" }, "reply_to": { "email": "replies@example.com" } }, "schedule": { "at": "2026-05-01T09:00:00Z" }, "message_type": "MESSAGE_TYPE_MARKETING" } }'ตัวอย่าง: อีเมลธุรกรรมพร้อมไฟล์แนบ
Anchor link tocurl -X POST https://api.pushwoosh.com/messaging/v2/notify \ -H "Authorization: Token YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "transactional": { "application": "XXXXX-XXXXX", "platforms": ["EMAIL"], "users": { "list": ["customer-42"] }, "email_payload": { "subject": { "en": "Your invoice" }, "body": "<p>Please find your invoice attached.</p>", "attachments": [ { "name": "invoice.pdf", "content": "JVBERi0xLjQKJe..." } ] }, "schedule": { "at": "2026-05-01T12:00:00Z" }, "message_type": "MESSAGE_TYPE_TRANSACTIONAL" } }'