สร้างรายชื่อติดต่อ

นักพัฒนาสามารถสร้างรายชื่อติดต่อผ่าน API ได้

วิธีการส่งคำขอ

POST

URL สำหรับส่งคำขอ

https://livedesk-api.engagelab.com/api/v2/accounts/contacts

การตรวจสอบสิทธิ์

สำหรับรายละเอียด โปรดดูคำแนะนำเกี่ยวกับการตรวจสอบสิทธิ์ในภาพรวม API

คำขอ

ตัวอย่างการสร้างรายชื่อติดต่อ

curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/contacts' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic base64(api_key:api_secret)' \ -d '{ "inbox_id": 407, "name": "Test", "email": "alice@acme.inc", "phone_number": "+123456789", "avatar_url": "https://example.com/avatar.png", "identifier": "1234567890" }'
              
              curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/contacts' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Basic base64(api_key:api_secret)' \
  -d '{
    "inbox_id": 407,
    "name": "Test",
    "email": "alice@acme.inc",
    "phone_number": "+123456789",
    "avatar_url": "https://example.com/avatar.png",
    "identifier": "1234567890"
  }'

            
โค้ดนี้โชว์เป็นหน้าต่างลอย

ส่วนหัวคำขอ

Field Type Description
Authorization string ใช้สำหรับการตรวจสอบสิทธิ์ในรูปแบบ Authorization: Basic base64(API Key:API Secret) ไปที่หน้าคีย์ API เพื่อรับ API Key และ API Secret จากนั้นเชื่อมทั้งสองค่าด้วยเครื่องหมายโคลอน (:) และเข้ารหัสผลลัพธ์ด้วย Base64
Content-Type application/json ประเภทข้อมูล โดยใช้ application/json สำหรับข้อมูลข้อความทั่วไป

พารามิเตอร์เนื้อหาคำขอ

Field Type Required Description
inbox_id String Yes ID ของช่องทาง ซึ่งสอดคล้องกับ Channel ID ใน Project Settings > Channels > Specific Channel > Settings
name String No ชื่อผู้ติดต่อ
email String No ที่อยู่อีเมล
phone_number String No ข้อมูลติดต่อ
avatar_url String No ลิงก์ไฟล์แนบ
identifier String No ตัวระบุผู้ใช้

การตอบกลับ

ตัวอย่างการตอบกลับ

{ "payload": { "contact": { "additional_attributes": {}, "availability_status": "offline", "email": null, "id": 2219259, "name": "Test", "phone_number": null, "blocked": false, "identifier": null, "thumbnail": "", "custom_attributes": {}, "created_at": 1766571703, "contact_inboxes": [] }, "contact_inbox": { "inbox": null, "source_id": null } } }
              
              {
  "payload": {
    "contact": {
      "additional_attributes": {},
      "availability_status": "offline",
      "email": null,
      "id": 2219259,
      "name": "Test",
      "phone_number": null,
      "blocked": false,
      "identifier": null,
      "thumbnail": "",
      "custom_attributes": {},
      "created_at": 1766571703,
      "contact_inboxes": []
    },
    "contact_inbox": {
      "inbox": null,
      "source_id": null
    }
  }
}

            
โค้ดนี้โชว์เป็นหน้าต่างลอย

พารามิเตอร์การตอบกลับ

Field Type Required Description
additional_attributes Object No แอตทริบิวต์เพิ่มเติม
availability_status String No สถานะออนไลน์ โดยค่าเริ่มต้นคือ offline
email String No ที่อยู่อีเมล
id String No ID ผู้ติดต่อ
name String No ชื่อ
phone_number String No หมายเลขโทรศัพท์
blocked String No ระบุว่าผู้ติดต่อถูกบล็อกหรือไม่ โดยค่าเริ่มต้นคือ false
identifier String No ตัวระบุผู้ใช้
thumbnail String No รูปภาพขนาดย่อ
custom_attributes String No แอตทริบิวต์ลูกค้า
created_at String No เวลาที่สร้าง
contact_inboxes Array No รายการกล่องข้อความของผู้ติดต่อ
inbox String No ช่องทาง
source_id String No ID แหล่งที่มา
Icon Solid Transparent White Qiyu
ติดต่อฝ่ายขาย