获取联系人列表
开发者可以通过 API 查询账号下的联系人列表。
请求方式
GET
调用地址
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)' \
此代码块在浮窗中显示
请求头
| 字段 | 类型 | 描述 |
|---|---|---|
| Authorization | string | 使用 Authorization: Basic base64(API Key:API Secret) 进行身份验证。请前往 API 密钥页面 获取 API Key 和 API Secret,并将两者以冒号连接后进行 Base64 编码。 |
| Content-Type | application/json | 数据类型,普通文字消息使用 application/json。 |
查询参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| page | integer | 否 | 页码,默认 1,每页 15 条 |
| labels | string / string[] | 否 | 按标签过滤,支持多个标签(any 匹配) |
| include_contact_inboxes | boolean | 否 | 是否返回 contact_inboxes,默认 true |
| sort | string | 否 | 排序字段,可选值:email、name、phone_number、last_activity_at、created_at、company、city、country |
| direction | string | 否 | 排序方向,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"
}
}
]
}
]
}
此代码块在浮窗中显示
响应参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| meta | Object | 否 | 元数据对象。 |
| count | Int | 否 | 查询结果计数。 |
| current_page | Int | 否 | 当前查询结果页数。 |
| payload | Object | 否 | 属性。 |
| additional_attributes | Object | 否 | 附件属性。 |
| availability_status | String | 否 | 在线状态,默认为offline。 |
| String | 否 | 邮件地址。 | |
| id | String | 否 | 联系人ID。 |
| name | String | 否 | 名称 |
| phone_number | String | 否 | 手机号码。 |
| blocked | String | 否 | 是否锁定,默认falese。 |
| identifier | String | 否 | 用户标识。 |
| thumbnail | String | 否 | 用户标识。 |
| custom_attributes | Object | 否 | 客户属性。 |
| created_at | String | 否 | 创建时间戳。 |
| last_activity_at | String | 否 | 最后一次活跃的时间戳。 |
| created_at | String | 否 | 该联系人创建的时间戳。 |
| contact_inboxes | array | 关联的渠道信息,仅在 include_contact_inboxes=true 时返回 |
|
| source_id | String | No | Source ID. |
| inbox | Object | No | Inbox information. |
| id | Integer | No | Inbox ID. |
| name | String | No | Inbox name. |
| channel_type | String | No | Channel type. |
错误响应
响应参数
| HTTP 状态码 | 说明 |
|---|---|
| 401 | 未授权,Token 无效或缺失 |
| 403 | 权限不足 |
