ค้นหาผู้ติดต่อ
นักพัฒนาสามารถใช้ LiveDesk API เพื่อเรียกดูรายชื่อผู้ติดต่อในบัญชี และค้นหาผู้ติดต่อด้วยอีเมล หมายเลขโทรศัพท์ ชื่อ หรือตัวระบุ
วิธีการส่งคำขอ
GET
URL คำขอ
https://livedesk-api.engagelab.com/api/v2/accounts/contacts
การตรวจสอบสิทธิ์
ดูรายละเอียดได้ที่คำแนะนำเกี่ยวกับการตรวจสอบสิทธิ์ใน ภาพรวม API
คำขอ
ตัวอย่างคำขอสำหรับค้นหาผู้ติดต่อ
curl -X GET 'https://livedesk-api.engagelab.com/api/v2/accounts/contacts?q=support@engagelab.com' \
-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?q=support@engagelab.com' \
-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 Keys เพื่อรับ API key และ API secret จากนั้นเชื่อมค่าทั้งสองด้วยเครื่องหมายโคลอน (:) แล้วเข้ารหัสเป็น Base64 |
| Content-Type | application/json | ประเภทข้อมูล โดยใช้ application/json สำหรับคำขอนี้ |
พารามิเตอร์ Query
| Field | Type | Required | Description |
|---|---|---|---|
| q | string | No | พารามิเตอร์สำหรับการค้นหา ฟิลด์แอตทริบิวต์ของผู้ติดต่อประกอบด้วย email, phone_number, name และ identifier |
| 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": {
"source_id": "email:ed5c8362-425c-4589-8adb-61a033d8c5fb.support@engagelab.com"
},
"availability_status": "offline",
"email": "support@engagelab.com",
"id": 64464046,
"name": "support",
"phone_number": null,
"blocked": false,
"identifier": null,
"thumbnail": "",
"custom_attributes": {},
"last_activity_at": 1778572024,
"created_at": 1778570103,
"contact_inboxes": [
{
"source_id": "support@engagelab.com",
"inbox": {
"id": 985,
"channel_id": 107,
"name": "Email",
"channel_type": "Channel::Email",
"provider": null
}
}
]
}
]
}
{
"meta": {
"count": 1,
"current_page": 1
},
"payload": [
{
"additional_attributes": {
"source_id": "email:ed5c8362-425c-4589-8adb-61a033d8c5fb.support@engagelab.com"
},
"availability_status": "offline",
"email": "support@engagelab.com",
"id": 64464046,
"name": "support",
"phone_number": null,
"blocked": false,
"identifier": null,
"thumbnail": "",
"custom_attributes": {},
"last_activity_at": 1778572024,
"created_at": 1778570103,
"contact_inboxes": [
{
"source_id": "support@engagelab.com",
"inbox": {
"id": 985,
"channel_id": 107,
"name": "Email",
"channel_type": "Channel::Email",
"provider": null
}
}
]
}
]
}
โค้ดนี้โชว์เป็นหน้าต่างลอย
พารามิเตอร์การตอบกลับ
| Field | Type | Required | Description |
|---|---|---|---|
| count | Int | No | จำนวนผลลัพธ์การค้นหา |
| current_page | Int | No | หมายเลขหน้าของผลลัพธ์การค้นหา |
| payload | Object | No | โครงสร้างข้อมูลผลลัพธ์ |
| additional_attributes | Object | No | แอตทริบิวต์เพิ่มเติม |
| availability_status | String | No | สถานะออนไลน์ ค่าเริ่มต้นคือ offline |
| String | No | ที่อยู่อีเมล | |
| id | String | No | ID ของผู้ติดต่อ |
| name | String | No | ชื่อ |
| phone_number | String | No | หมายเลขโทรศัพท์ |
| blocked | String | No | ระบุว่าผู้ติดต่อถูกบล็อกหรือไม่ ค่าเริ่มต้นคือ false |
| identifier | String | No | ตัวระบุภายนอกแบบเฉพาะของผู้ติดต่อ ซึ่งสอดคล้องกับ User ID ที่แสดงในอินเทอร์เฟซ |
| thumbnail | String | No | URL ของรูปโปรไฟล์ |
| custom_attributes | String | 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 | String | No | ID ของแชนเนล |
| name | String | No | ชื่อแชนเนล |
| channel_type | String | No | ประเภทแชนเนล |
| provider | String | No | ผู้ให้บริการ ตัวอย่างเช่น เมื่อแชนเนลเป็น WhatsApp ค่าจะเป็น whatsapp_cloud, engagelab_whatsapp หรือ twilio สำหรับแชนเนลที่ไม่มีผู้ให้บริการเฉพาะ ค่าจะเป็น null |










