รับอีเมล: การอ่าน
Get Thread
เปิดทั้งบทสนทนา: สรุปและทุกข้อความตามลำดับเวลา เลือกให้มีเนื้อหาได้
https://g.sendcorex.com/v1command: get_threadอาร์กิวเมนต์
thread_idstringไม่บังคับid ของบทสนทนา
idstringไม่บังคับid ของข้อความใดก็ได้ในบทสนทนา ใช้อันนี้หรือ
thread_idinclude_bodybooleanไม่บังคับtrueเพิ่มbody(htmlและtext) ให้ทุกข้อความ
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "get_thread",
args: {
id: "Vj0xQUJDMTIz",
include_body: true
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);การตอบกลับ
{
"type": "SUCCESS",
"results": [
{
"command": "get_thread",
"id": "0",
"type": "SUCCESS",
"data": {
"thread": {
"thread_id": "thr_9a1c4e72",
"subject": "Invoice for September",
"participants": [
"ana@client.com",
"you@yourdomain.com"
],
"last_senders": [
"ana@client.com"
],
"message_count": 2,
"unread_count": 1,
"folders": [
"INBOX",
"Sent"
]
},
"messages": [
{
"message_uid": "Vj0xQUJDMDA5",
"message_id": "<4c1d…@mail.client.com>",
"in_reply_to": null,
"parent_uid": null,
"depth": 0,
"folders": [
"INBOX"
],
"from_name": "Ana Costa",
"from_email": "ana@client.com",
"direction": "inbound",
"to": [
{
"email": "you@yourdomain.com"
}
],
"reply_to": [],
"subject": "Invoice for September",
"preview": "Hi, attached is the invoice for September…",
"is_read": true,
"is_starred": false,
"is_important": false,
"has_attachments": false,
"received_at": "2026-10-09T09:02:41Z",
"body": {
"html": "<p>Hi, attached is the invoice for September.</p>",
"text": "Hi, attached is the invoice for September."
}
}
]
}
}
]
}ฟิลด์การตอบกลับ
threadสรุปบทสนทนา:
thread_id,subject,participants,last_senders,message_count,unread_countและfoldersmessages[]ข้อความตามลำดับเวลา
messages[].message_uid / message_idid ในกล่องจดหมายและ Message-ID ของ SMTP
messages[].in_reply_to / parent_uid / depthตำแหน่งของข้อความในแผนผังการตอบ
messages[].directioninboundหรือoutboundmessages[].from_name / from_email / to / reply_toข้อมูลซอง
messages[].subject / previewหัวเรื่องและตัวอย่าง
messages[].is_read / is_starred / is_important / has_attachmentsสถานะข้อความ
messages[].received_atเวลาที่ได้รับหรือส่งข้อความ
messages[].bodyเฉพาะเมื่อใช้
include_body: true:{ html, text }
ข้อผิดพลาด
ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200
- 401
TOKEN_EXPIREDaccess token หมดอายุแล้ว เรียก Refresh Token แล้วส่งคำขอซ้ำ
- 401
INVALID_TOKENโทเค็นผิดรูปแบบ ไม่รู้จัก หรือถูกเพิกถอน
- 429
RATE_LIMITEDเกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + กล่องจดหมายเดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD
INVALID_ARGSอาร์กิวเมนต์ที่จำเป็นหายไปหรือไม่ถูกต้อง
- CMD
NOT_FOUNDไม่มีข้อความ เธรด หรือโฟลเดอร์นี้สำหรับโทเค็นนี้
- CMD
INTERNALข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์