创建联系人
开发者可以通过 API 创建联系人。
请求方式
POST
调用地址
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)' \
{
"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)' \
{
"inbox_id": 407,
"name": "Test", // 选填
"email": "alice@acme.inc",
"phone_number": "+123456789",
"avatar_url": "https://example.com/avatar.png",
"identifier": "1234567890",
}
此代码块在浮窗中显示
请求头
| 字段 | 类型 | 描述 |
|---|---|---|
| Authorization | string | 使用 Authorization: Basic base64(API Key:API Secret) 进行身份验证。请前往 API 密钥页面 获取 API Key 和 API Secret,并将两者以冒号连接后进行 Base64 编码。 |
| Content-Type | application/json | 数据类型,普通文字消息使用 application/json。 |
请求体参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| inbox_id | String | 是 | channel ID.对应「项目设置-Channels-具体channel-设置」里面的Channel ID. |
| name | String | 否 | 联系人名称。 |
| String | 否 | 邮件地址。 | |
| phone_number | String | 否 | 联系方式。 |
| avatar_url | String | 否 | 附件链接。 |
| identifier | String | 否 | 用户标识。 |
响应
响应示例
{
"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
}
}
}
此代码块在浮窗中显示
响应参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
| 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 | String | 否 | 客户属性。 |
| created_at | String | 否 | 创建时间戳。 |
| contact_inboxes | Array | 否 | 用户标识。 |
| inbox | String | 否 | channel通道。 |
| source_id | String | 否 | 来源ID。 |
