ผู้ติดต่อ: กลุ่ม
ดูกลุ่ม
กลุ่มที่บันทึกไว้หนึ่งกลุ่ม: ชื่อ where และ sort หากต้องการผู้ติดต่อในกลุ่ม ใช้ Run Segment
https://g.sendcorex.com/v1/contactscommand: get_segmentต้องมีขอบเขต contact:read บน API key ของคุณ
อาร์กิวเมนต์
segment_idstringจำเป็นid ของกลุ่ม
เช่น
"engaged-vips"
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/contacts',
{
commands: [
{
command: "get_segment",
args: {
segment_id: "engaged-vips"
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
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_segment",
"id": "0",
"type": "SUCCESS",
"took_ms": 14,
"data": {
"segment_id": "engaged-vips",
"name": "Engaged VIPs",
"where": {
"tags": {
"has": "vip"
},
"last_open_at": {
"within_days": 30
}
},
"sort": {
"field": "open_rate"
},
"created_at": "2026-10-10T12:00:00.000Z",
"updated_at": "2026-10-10T12:00:00.000Z"
}
}
]
}ฟิลด์การตอบกลับ
(segment)segment_id,name,where,sortและวันที่
ข้อผิดพลาด
ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200
- 401
INVALID_API_KEYAPI key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด
- 429
RATE_LIMITEDเกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD
MISSING_SCOPEAPI key ไม่มีขอบเขตที่คำสั่งนี้ต้องการ คำสั่งอื่นในคำขอยังทำงาน
- CMD
INVALID_ARGSอาร์กิวเมนต์ที่จำเป็นหายไปหรือไม่ถูกต้อง: อีเมล ค่าฟิลด์ ตัวเลือก enum คีย์ where id รายชื่อ…
- CMD
NOT_FOUNDไม่มีผู้ติดต่อ รายชื่อ ฟิลด์ หรือกลุ่มนี้
- CMD
INTERNALข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์