ผู้ติดต่อ: รายชื่อ

อัปเดตรายชื่อ

เปลี่ยนชื่อ คำอธิบาย แหล่งที่มา หรือข้อมูลกำหนดเองของรายชื่อ เปลี่ยนเฉพาะที่ส่งมา

POSThttps://g.sendcorex.com/v1/contactscommand: update_list

ต้องมีขอบเขต contact:update บน API key ของคุณ

อาร์กิวเมนต์

  • list_idstringจำเป็น

    รายชื่อที่จะเปลี่ยน เปลี่ยนตัว id ไม่ได้

    เช่น "customers"

  • namestringไม่บังคับ

    ชื่อใหม่ null จะล้าง

  • descriptionstringไม่บังคับ

    คำอธิบายใหม่ null จะล้าง

  • sourcestringไม่บังคับ

    แหล่งที่มาใหม่ null จะล้าง

  • customobjectไม่บังคับ

    รวมเข้ากับข้อมูลกำหนดเองปัจจุบัน คีย์ที่ส่งเป็น null จะถูกลบ

    เช่น { "year": null, "owner": "sales" }

เริ่มต้นอย่างรวดเร็ว

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/contacts',
  {
    commands: [
      {
        command: "update_list",
        args: {
          list_id: "customers",
          name: "Customers (VIP)",
          custom: {
            year: null,
            owner: "sales"
          }
        }
      }
    ]
  },
  { 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": "update_list",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 14,
      "data": {
        "list_id": "customers",
        "name": "Customers (VIP)",
        "description": "Everyone who bought at least once",
        "source": "checkout",
        "status": "ready",
        "custom": {
          "origin": "checkout",
          "owner": "sales"
        },
        "created_at": "2026-10-01T10:00:00.000Z",
        "updated_at": "2026-10-12T15:22:41.000Z",
        "stats": {
          "total": 1834,
          "ok": 1790,
          "opened": 912,
          "clicked": 233
        }
      }
    }
  ]
}

ฟิลด์การตอบกลับ

  • (list)

    รายชื่อหลังเปลี่ยน พร้อม stats

ข้อผิดพลาด

ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200

  • 401INVALID_API_KEY

    API key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด

  • 429RATE_LIMITED

    เกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After

  • CMDMISSING_SCOPE

    API key ไม่มีขอบเขตที่คำสั่งนี้ต้องการ คำสั่งอื่นในคำขอยังทำงาน

  • CMDINVALID_ARGS

    อาร์กิวเมนต์ที่จำเป็นหายไปหรือไม่ถูกต้อง: อีเมล ค่าฟิลด์ ตัวเลือก enum คีย์ where id รายชื่อ…

  • CMDNOT_FOUND

    ไม่มีผู้ติดต่อ รายชื่อ ฟิลด์ หรือกลุ่มนี้

  • CMDINTERNAL

    ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์