รับอีเมล: จัดระเบียบ
Move
ย้ายข้อความหรือทั้งบทสนทนาระหว่างโฟลเดอร์ เช่น จาก Spam ไป INBOX หรือจาก INBOX ไปเก็บถาวร
https://g.sendcorex.com/v1command: moveเฉพาะ from_folder ที่ถูกแทนด้วย to_folder โฟลเดอร์อื่นของข้อความยังอยู่: คำตอบใน ["Sent","INBOX"] ที่ย้ายไปเก็บถาวรจะเป็น ["Sent","Archive"]
การย้ายข้อความไป Spam จะทำให้ผู้ส่งภายนอกไม่ได้รับความไว้วางใจ และอีเมลต่อไปของเขาเข้า Spam ทันที การย้ายออกจาก Spam ไม่คืนความไว้วางใจ ให้ใช้ set_trust
ตัวเลือก mark_unread, label และ conversation_status ทำงานหลังย้าย และเฉพาะ id ที่ย้าย
อาร์กิวเมนต์
idsstring[]ไม่บังคับid ข้อความสูงสุด 100 รายการ
idstringไม่บังคับid ข้อความเดียว ใช้อันนี้หรือ
idsto_folderstringจำเป็นโฟลเดอร์ปลายทาง (slug หรือชื่อ) ไม่รับ
Snoozedให้ใช้snoozefrom_folderstringไม่บังคับโฟลเดอร์ที่จะย้ายออก ค่าเริ่มต้นคือโฟลเดอร์ของข้อความที่ไม่ใช่
Sentscopestringไม่บังคับthread(ค่าเริ่มต้น) หรือmessagemark_unreadbooleanไม่บังคับหลังย้าย ทำเครื่องหมายทั้งบทสนทนาว่ายังไม่อ่าน
labelstringไม่บังคับหลังย้าย เพิ่มป้ายกำกับนี้ (สูงสุด 50 ตัวอักษร)
conversation_statusstringไม่บังคับหลังย้าย ตั้งสถานะบทสนทนา:
open,waitingหรือresolved
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "move",
args: {
id: "Vj0xQUJDMTIz",
from_folder: "INBOX",
to_folder: "Archive"
}
}
]
},
{ 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": "move",
"id": "0",
"type": "SUCCESS",
"data": {
"items": [
{
"id": "Vj0xQUJDMTIz",
"ok": true,
"data": {
"from_folder": "INBOX",
"to_folder": "Archive",
"moved": 2
}
}
],
"ok_count": 1,
"failed_count": 0
}
}
]
}ฟิลด์การตอบกลับ
items[].data.from_folder / to_folderโฟลเดอร์ที่เกี่ยวข้อง
items[].data.movedจำนวนข้อความที่ย้าย
items[].data.trust_statusเฉพาะเมื่อย้ายไป Spam: สถานะความไว้วางใจใหม่ของผู้ส่ง
items[].data.sender / is_trustedเฉพาะเมื่อย้ายจาก Spam ไปโฟลเดอร์ปกติ (ไม่ใช่ถังขยะ): ผู้ส่งภายนอก พร้อม
trust_statusและis_trustedafterเฉพาะเมื่อส่งตัวเลือก: สิ่งที่ใช้หลังย้าย
ย้ายออกจาก Spam พร้อมตัวเลือก
แต่ละรายการส่งกลับผู้ส่งภายนอก ส่งผู้ส่งให้ set_trust ด้วย emails เพื่อไว้วางใจในคำสั่งเดียว
Request · Response
{
"commands": [
{
"command": "move",
"args": {
"ids": [
"Vj0xQUJDMTIz",
"Vj0xREVGNDU2"
],
"from_folder": "Spam",
"to_folder": "INBOX",
"mark_unread": true,
"label": "Leads",
"conversation_status": "waiting"
}
}
]
}
{
"items": [
{
"id": "Vj0xQUJDMTIz",
"ok": true,
"data": {
"from_folder": "Spam",
"to_folder": "INBOX",
"moved": 1,
"sender": "john@acme.com",
"trust_status": "default",
"is_trusted": false
}
},
{
"id": "Vj0xREVGNDU2",
"ok": true,
"data": {
"from_folder": "Spam",
"to_folder": "INBOX",
"moved": 2,
"sender": "ana@foo.io",
"trust_status": "default",
"is_trusted": false
}
}
],
"ok_count": 2,
"failed_count": 0,
"after": {
"marked_unread": 3,
"label": "Leads",
"labeled": 3,
"conversation_status": "waiting",
"conversations_updated": 2
}
}กู้บทสนทนาจาก Spam
ส่งทั้งสองคำสั่งในคำขอเดียว ทำงานตามลำดับ
body ของคำขอ
{
"commands": [
{
"command": "move",
"args": {
"id": "Vj0xQUJDMTIz",
"from_folder": "Spam",
"to_folder": "INBOX",
"scope": "thread"
}
},
{
"command": "set_flags",
"args": {
"id": "Vj0xQUJDMTIz",
"is_read": true,
"scope": "thread"
}
}
]
}ข้อผิดพลาด
ข้อผิดพลาดระดับ 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ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์