รับรายการผู้ติดต่อ
นักพัฒนาสามารถใช้ API นี้เพื่อดึงรายการผู้ติดต่อภายใต้บัญชีได้
วิธีการส่งคำขอ
GET
Endpoint
https://livedesk-api.engagelab.com/api/v2/accounts/contacts
การยืนยันตัวตน
สำหรับรายละเอียด โปรดดูคำแนะนำการยืนยันตัวตนใน ภาพรวม API
คำขอ
ตัวอย่างคำขอ
curl -X GET 'https://livedesk-api.engagelab.com/api/v2/accounts/contacts?include_contact_inboxes=false&page=1&sort=last_activity_at&page_size=10' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)'
curl -X GET 'https://livedesk-api.engagelab.com/api/v2/accounts/contacts?include_contact_inboxes=false&page=1&sort=last_activity_at&page_size=10' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)'
โค้ดนี้โชว์เป็นหน้าต่างลอย
ส่วนหัวของคำขอ
| Field | Type | Description |
|---|---|---|
| Authorization | string | ยืนยันตัวตนด้วย Authorization: Basic base64(API Key:API Secret) ไปที่หน้าคีย์ API เพื่อรับ API Key และ API Secret จากนั้นเชื่อมทั้งสองค่าด้วยเครื่องหมายโคลอนและเข้ารหัสเป็น Base64 |
| Content-Type | application/json | ประเภทข้อมูล โดยใช้ application/json สำหรับข้อความทั่วไป |
พารามิเตอร์ Query
| Field | Type | Required | Description |
|---|---|---|---|
| page | integer | No | หมายเลขหน้า ค่าเริ่มต้นคือ 1 โดยแสดง 15 รายการต่อหน้า |
| labels | string / string[] | No | กรองตามป้ายกำกับ รองรับหลายป้ายกำกับ และจะส่งคืนผู้ติดต่อที่ตรงกับป้ายกำกับใดป้ายกำกับหนึ่ง |
| include_contact_inboxes | boolean | No | กำหนดว่าจะส่งคืน contact_inboxes หรือไม่ ค่าเริ่มต้นคือ true |
| sort | string | No | ฟิลด์ที่ใช้เรียงลำดับ ค่าที่ใช้ได้: email, name, phone_number, last_activity_at, created_at, company``, cityและcountry` |
| direction | string | No | ทิศทางการเรียงลำดับ: asc หรือ desc |
การตอบกลับเมื่อสำเร็จ
ตัวอย่างการตอบกลับ
{
"meta": {
"count": 1,
"current_page": "1"
},
"payload": [
{
"additional_attributes": {
"city": "",
"country": "",
"telegram": "",
"description": "",
"company_name": "",
"country_code": "",
"social_profiles": {
"github": "",
"twitter": "",
"facebook": "",
"linkedin": "",
"instagram": ""
}
},
"availability_status": "offline",
"email": "support@jiguang.cn",
"id": 318763,
"name": "support",
"phone_number": null,
"blocked": false,
"identifier": "4444",
"thumbnail": "",
"custom_attributes": {},
"last_activity_at": 1765441908,
"created_at": 1765441895,
"contact_inboxes": [
{
"source_id": "src_001",
"inbox": {
"id": 10,
"name": "ช่องทางบริการลูกค้า",
"channel_type": "Channel::Api"
}
}
]
}
]
}
{
"meta": {
"count": 1,
"current_page": "1"
},
"payload": [
{
"additional_attributes": {
"city": "",
"country": "",
"telegram": "",
"description": "",
"company_name": "",
"country_code": "",
"social_profiles": {
"github": "",
"twitter": "",
"facebook": "",
"linkedin": "",
"instagram": ""
}
},
"availability_status": "offline",
"email": "support@jiguang.cn",
"id": 318763,
"name": "support",
"phone_number": null,
"blocked": false,
"identifier": "4444",
"thumbnail": "",
"custom_attributes": {},
"last_activity_at": 1765441908,
"created_at": 1765441895,
"contact_inboxes": [
{
"source_id": "src_001",
"inbox": {
"id": 10,
"name": "ช่องทางบริการลูกค้า",
"channel_type": "Channel::Api"
}
}
]
}
]
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
ระบบจะส่งคืน contact_inboxes เมื่อ include_contact_inboxes=true
พารามิเตอร์การตอบกลับ
| Field | Type | Required | Description |
|---|---|---|---|
| meta | Object | No | อ็อบเจ็กต์ข้อมูลเมตา |
| count | Integer | No | จำนวนผลลัพธ์การค้นหา |
| current_page | Integer | No | หมายเลขหน้าปัจจุบันของผลลัพธ์การค้นหา |
| payload | Object | No | ข้อมูลคุณลักษณะของผู้ติดต่อ |
| additional_attributes | Object | No | คุณลักษณะเพิ่มเติม |
| availability_status | String | No | สถานะออนไลน์ ค่าเริ่มต้นคือ offline |
| String | No | ที่อยู่อีเมล | |
| id | Integer | No | ID ผู้ติดต่อ |
| name | String | No | ชื่อ |
| phone_number | String | No | หมายเลขโทรศัพท์ |
| blocked | Boolean | No | ผู้ติดต่อนี้ถูกบล็อกหรือไม่ ค่าเริ่มต้นคือ false |
| identifier | String | No | ตัวระบุผู้ใช้ |
| thumbnail | String | No | รูปขนาดย่อของผู้ใช้ |
| custom_attributes | Object | No | คุณลักษณะที่กำหนดเอง |
| created_at | String | No | การประทับเวลาที่สร้างผู้ติดต่อ |
| last_activity_at | String | No | การประทับเวลาของกิจกรรมล่าสุด |
| contact_inboxes | Array | No | ข้อมูลช่องทางติดต่อของผู้ติดต่อ โดยจะส่งคืนเฉพาะเมื่อ include_contact_inboxes=true |
| source_id | String | No | ID แหล่งที่มา |
| inbox | Object | No | ข้อมูลกล่องข้อความเข้า |
| id | Integer | No | ID กล่องข้อความเข้า |
| name | String | No | ชื่อกล่องข้อความเข้า |
| channel_type | String | No | ประเภทช่องทาง |
การตอบกลับข้อผิดพลาด
พารามิเตอร์การตอบกลับ
| HTTP Status Code | Description |
|---|---|
| 401 | ไม่ได้รับอนุญาต โทเค็นไม่ถูกต้องหรือไม่มีโทเค็น |
| 403 | สิทธิ์ไม่เพียงพอ |










