查詢聯絡人列表
開發者可透過 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?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)' \
此代碼塊在浮窗中顯示
請求 Headers
| Field | Type | Description |
|---|---|---|
| Authorization | string | 使用 Authorization: Basic base64(API Key:API Secret) 進行身分驗證。請前往 API Key 頁面取得 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": [ // 當 include_contact_inboxes=true 時回傳
{
"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": [ // 當 include_contact_inboxes=true 時回傳
{
"source_id": "src_001",
"inbox":
{
"id": 10,
"name": "客服渠道",
"channel_type": "Channel::Api"
}
}
]
}
]
}
此代碼塊在浮窗中顯示
回應參數
| Field | Type | Required | Description |
|---|---|---|---|
| meta | Object | No | 中繼資料物件。 |
| 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 | 使用者識別碼。 |
| thumbnail | String | No | 縮圖。 |
| custom_attributes | Object | No | 客戶屬性。 |
| created_at | String | No | 建立時間戳。 |
| last_activity_at | String | No | 最後活動時間戳。 |
| created_at | String | No | 此聯絡人的建立時間。 |
| contact_inboxes | array | 關聯渠道資訊,僅在 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 | 未授權,Token 無效或缺失 |
| 403 | 權限不足 |










