代理状态 API 端点可用于访问代理状态对象。系统会为在 Contact Center AI 平台 (CCAI Platform) 中配置的每个用户创建一个代理对象,这些用户所拥有的角色包含代理权限。
以下是代理状态 API 端点:
代理状态端点可用于修改代理的状态。 它们可将状态从有空更改为任何自定义状态。向系统定义的状态(例如 In-Call)过渡或从系统定义的状态过渡会导致错误。此外,这些端点还支持批量更新,可同时修改整个团队或所选代理群组的状态。
更新代理状态
您可以使用此端点更新代理的状态。下表显示了 JSON 正文中的属性:
| 属性 | 必需 | 数据类型 | 定义 |
|---|---|---|---|
| 状态 | TRUE | 字符串 | 要将代理设置到的状态,例如“可用”。 |
| agent_ids | TRUE | 整数数组 | 代理 ID 的数组。 |
| team_ids | TRUE | 数组整数 | 团队 ID 的数组。 |
端点:
Method: POST
Type: RAW
URL: https://{subdomain}.{domain}/apps/api/v1/agent_statuses
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
{
"status": "Available",
"agent_ids": [
11,
12
],
"team_ids": []
}
请求和响应示例
以下部分提供了向端点发送的请求示例。
成功更改了代理状态
以下示例演示了更改部分代理状态的请求和关联的响应(操作成功)。
请求
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
{
"status": "Available",
"agent_ids": [
11,
12
],
"team_ids": [
1
]
}
回答:
[
{
"agent_id": 11,
"name": "Darth Vader",
"email": "notanakinskywalker@empire.com",
"agent_number": "Agent No.111",
"previous_status": "lunch",
"current_status": "Available"
},
{
"agent_id": 12,
"name": "Craig T",
"email": "craigT@nelson.com",
"agent_number": "Agent No.112",
"previous_status": "In-call",
"current_status": "In-call",
"message": "Agent can't be changed from system status 'In-call'"
},
{
"agent_id": 13,
"name": "Raymond D",
"email": "rayd@nelson.com",
"agent_number": "Agent No.113",
"previous_status": "Offline",
"current_status": "Offline",
"message": "Agent's status can't be changed if they are offline or logged out"
}
]
状态代码: 200
状态不存在
此示例展示了请求和关联的响应,其中提供的状态不存在,因此被视为无效。
请求
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
Body
{
"status": "Napping",
"agent_ids": [
11,
12
],
"team_ids": []
}
响应:错误:状态“Napping”不存在
{
"message": "status 'Napping' does not exist"
}
状态代码:400
状态设置为系统状态
此示例展示了将状态设置为系统状态(在本例中为“通话中”)的请求和响应。无法将客服人员的状态设置为由系统管理的状态。
请求
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
Body
{
"status": "In-call",
"agent_ids": [
11,
12
]
}
响应:错误:无法将智能体更改为系统状态“通话中”
{
"message": "Agent can't be changed to system status 'In-call'"
}
状态代码:400
获取客服人员状态
您可以通过此端点检索代理的状态。下表显示了 JSON 正文中的属性:
| 属性 | 必需 | 数据类型 | 定义 |
|---|---|---|---|
| 状态 | TRUE | 字符串 | 要将代理设置到的状态,例如“可用”。 |
| agent_ids | FALSE | 整数数组 | 代理 ID 的数组。 |
| team_ids | FALSE | 数组整数 | 团队 ID 的数组。 |
端点:
Method: GET
Type: RAW
URL: https://{subdomain}.{domain}/apps/api/v1/agent_statuses
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
{
"agent_ids": [
11,
12
],
"team_ids": [
1
]
}
请求和响应示例
以下部分提供了向端点发送的请求示例。
获取特定客服人员和团队的状态
此示例展示了如何获取 ID 为 11 和 12 的客服人员以及 ID 为 1 的团队中任何客服人员的状态。
请求
标头:
| 键 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json |
正文:
{
"agent_ids": [
11,
12
],
"team_ids": [
1
]
}
响应:所请求代理的状态
[
{
"agent_id": 11,
"name": "Darth Vader",
"email": "notanakinskywalker@empire.com",
"agent_number": "Agent No.111",
"status": "lunch",
"ip_addrs": [
"34.211.11.101"
]
},
{
"agent_id": 12,
"name": "Craig T",
"email": "craigT@nelson.com",
"agent_number": "Agent No.112",
"status": "In-call",
"ip_addrs": [
"34.211.11.102"
]
},
{
"agent_id": 13,
"name": "Raymond D",
"email": "rayd@nelson.com",
"agent_number": "Agent No.113",
"status": "Offline",
"ip_addrs": [
"34.211.11.103"
]
}
]
状态代码: 200