[TOC]
代理API
一、API认证方式
1. 查看认证Token
-
查看个人信息
-
生成Token
-
复制Token【注意Token只出现一次,再次获取会变化】
2. 统一请求格式
-
请求域名
-
请求参数
Content-Type:application/json
-
请求响应的结果为json格式
-
编码:
UTF-8
-
HTTP头信息,需要在每次调用的时候在您的Headers里面带上生成的Token,参数例如
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyOTdkYTdhYmVkNTVkMDIyNzhhMmRhYmVhMWY1OTY3OTNlN2Y4ZDNkYjBhOTU5OGQ1NjFiZTkzYzhlNjRkMWYw
Bearer + 空格 + Token
-
最高并发:
60次 / 分钟
二、API接口
用户相关
1.用户列表
-
接口:
/users
-
请求方式:
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
-
返回示例:
{ "code": 200, "status": "success", "message": "查看用户列表成功", "data": [ { "id": "1a5ab9a6-83ea-4339-a913-34305e7133a7", "name": "演示账号", "phone": "18741014741", "email": "yanshizhanghu@qq.com", "created_at": "2020-04-10 15:11:08", "updated_at": "2020-06-15 15:39:21" } ], "meta": { "has_pages": false, "total": 2, "last_page": 1, "current_page": 1, "per_page": 15 } }
2.注册账户
-
接口:
/users
-
请求方式:
POST
-
发送内容示例:
{ "name":"xun", "email":"xun@qq.com", "phone":"13696524111", "password":"123456", "password_confirmation":"123456" }
-
返回内容示例:
{ "code": 200, "status": "success", "message": "添加用户成功", "data": { "id": "491e0ee2-5215544fgnf-9-c282a7d64cac", "name": "xun", "email": "xun@qq.com", "phone": "13696524111" } }
3.编辑用户
-
接口:
/users/{id}/edit
-
请求方式:
GET
-
返回内容示例:
{ "code": 200, "status": "success", "message": "查看用户信息", "data": { "id": "5832d184-dd53-42a0-8ace-0bf8d660f4cc", "email": "xun@qq.com", "name": "xun", "phone": "13696524111" } }
4.编辑保存用户
-
接口:
/users/{id}
-
请求方式:
PUT
-
发送内容示例:
{ "name":"new-name", "email": "150528522@qq.com", "phone": "18661258541", "password":"1234567", "password_confirmation":"1234567" }
-
返回内容示例:
{ "code": 200, "status": "success", "message": "更新成功", "data": "" }
5.删除用户
-
接口:
/users/{id}
-
请求方式:
DELETE
-
返回内容示例:
{ "status": "success", "code": 200, "message": "删除成功" }
6.生成授权后的客户端url(登录)
-
接口:
/user/{id}/authorize
-
请求方式:
POST
-
返回内容
{ "code": 200, "status": "success", "message": "生成成功", "data": { "url": "http://www.saas.local.com/quick-login?token=NmFlMTUzMzQtY2YwNy00NTMzLTg4OTAtNDY1NzZmZTNmNzZi" } }
- message中的url为登录地址,如果有OEM解析到非saas.telrobot.top这个域名,请自行将token取出,拼接成
{domain}/quick-login?token=token
的形式登录; - 此token有效期为1分钟
- message中的url为登录地址,如果有OEM解析到非saas.telrobot.top这个域名,请自行将token取出,拼接成
任务相关
1.创建任务初始化
-
接口:
/agent-api/user/{user_id}/task/create
-
请求方式:
GET
-
返回结果:
{ "code": 200, "status": "success", "message": "返回任务初始化信息成功", "data": { "enum_disable_dial_timegroup": [ { "uuid": "8ae402ae-4af9-4c2a-914c-efae399e", "name": "默认禁止呼叫时间:00:00:00-08:00:00,21:00:00-23:59:59" } ], "caller_line_list": [ { "name": "成都平安小许-2020050701", "value": "a62bdf07-df18-46c7-960b411df4b6e", "residue": 7, "call_line": 13, "available_at": "2020-07-01 00:00:00", "call_number": null } ], "max_recycle_limit": 50, "outbound_group": [ { "id": 5, "name": "话术分组11.22", "user_id": "f00c8abc-433f-4666-a9479605ced1", "debug": true, "deleted_at": null, "created_at": "2019-11-22 17:22:54", "updated_at": "2020-03-06 16:18:09", "check_status": 0, "link_word_group_id": null, "tag_scene_id": null, "default": false } ], "customer_service": [ { "id": 2, "user_id": "f00c8abc-433f-4666-a979605ced1", "name": "0507", "caller_line_id": "3", "status": 1, "created_at": "2020-05-06 14:37:59", "updated_at": "2020-05-06 14:37:59" } ], "auto_recycle_rules": [ { "id": 4, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "测试自动重呼", "remark": "测试自动重呼", "status": true, "created_at": "2020-01-14 14:00:09", "updated_at": "2020-01-14 14:00:09", "is_default": null, "type": 1, "configs": null } ] } }
- 字段解释:
- enum_disable_dial_timegroup 禁呼时间组
- caller_line_list线路列表
- max_recycle_limit 最大重呼限制
- outbound_group 话术组
- customer_service 客服组
- auto_recycle_rules 自动重呼规则
2.任务创建
-
接口
/agent-api/user/{user_id}/task
-
请求方式
POST
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
caller_line_id | string | 37d73edf-4628-4cf1-8beb-758433fd0aab | 使用线路列表caller_line_list的value | yes |
customer_service_id | int | 1 | 使用客服组的id | no |
destination_extension | int | 297 | 使用话术分组的id | yes |
disable_dial_timegroup | string | 146979fe-3864-4817-ad76-13b37f43bb1c | 禁用呼叫时间的uuid | yes |
maximumcall | int | 1 | 并发数(不得超过选用线路的residue) | yes |
name | string | 测试任务 | 任务名称 | yes |
random_assignment_number | int | 0 | 固定为0 | yes |
recycle_limit | int | 1 | 呼叫失败最大重拨次数[弃用,有且只能为0] | yes |
remark | string | 第一个任务 | 任务描述 | no |
_originate_timeout | int | 60 | 拨号超时 | yes |
call_pause_second | int | 10 | 每通电话的呼叫间隔,单并发的建议间隔10秒,多并发可选择0秒 | yes |
auto_recycle_rule_id | int | 1 | 重呼规则id | yes |
- 返回参数
{
"code": 200,
"status": "success",
"message": "创建任务成功",
"data": {
"id": "ba4d5b07-c4c0-49dd-888f-d038457fc08a"
}
}
3.任务编辑
-
接口
/agent-api/user/{user_id}/task/{task_id}/edit
-
请求方式
GET
-
返回参数
{ "code": 200, "status": "success", "message": "返回任务初始化信息成功", "data": { "start": 0, "maximumcall": 1, "recycle_limit": 1, "name": "api创建任务", "remark": null, "destination_extension": 1612, "disable_dial_timegroup": "146979fe-3864-4817-ad76-13b37f43bb1c", "call_pause_second": 0, "random_assignment_number": 0, "_originate_timeout": 60, "caller_line_id": "ed5aaaad-f074-4f18-9ca2-362c622dc559", "customer_service_id": null, "auto_recycle_rule_id": 1 } }
4.任务修改
-
请求接口:
/agent-api/user/{user_id}/task/{task_id}
-
请求方式
PUT
-
请求参数
{ "auto_recycle_rule_id": 4, "call_pause_second": 10, "caller_line_id": "a62bdf07-df18-46c7-960f-07b411df4b6e", "customer_service_id": 21, "destination_extension": 5, "disable_dial_timegroup": "8ae402ae-4af9-4c2a-914c-96e1efae399e", "maximumcall": 1, "name": "052929", "random_assignment_number": 0, "recycle_limit": 0, "remark": "", "_originate_timeout": 60 }
-
返回参数
{ "code": 200, "status": "success", "message": "修改成功" }
5.任务列表
-
请求接口
/agent-api/user/{user_id}/task
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
- 返回参数
{ "code": 200, "status": "success", "message": "返回任务列表信息", "data": [ { "uuid": "0a1fd4ea-3bb6-4511-8-1c7931a22d55", "name": "0616", "create_datetime": "2020-06-16 16:33:28", "alter_datetime": null, "start": 0, "maximumcall": 1, "call_per_second": 10, "recycle_limit": 0, "random_assignment_number": 0, "disable_dial_timegroup": "8ae402ae-4af9-4c2a-914c-e1efae399e", "destination_extension": 5, "destination_dialplan": "XML", "destination_context": "default", "scheduling_policy_ratio": null, "scheduling_queue": null, "dial_format": "{origination_caller_id_number701}sofia/gateway/20050701/%s", "domain": null, "remark": null, "sort": 0, "originate_variables": "{execute_on_ia=start_da2}", "_originate_timeout": 60, "_origination_caller_id_number": "", "user_id": "f00c8abc-433f-466-70479605ced1", "caller_line_id": "a62bdf07-df18-0f-07b411df4b6e", "customer_service_id": 21, "auto_recycle_rule_id": 4, "call_notify_url": "http://127.0.0.1/apgup_ntify", "call_notify_type": 2, "call_pause_second": 10, "deleted_at": null, "caller_line": { "id": "a62bdf07-d960f-07b411df4b6e", "name": "成都平安小020050701", "user_id": "f00c8abc-433f-4479605ced1", "description": null, "deadline_at": "2020-07-01 00:00:00", "available_time": 31536000, "begin_at": "2020-05-07 09:28:57", "call_line": 13, "call_line_used": 6, "call_number_prefix": "", "is_call_number_enable": 1, "is_call_number_prefix_editable": 0, "dial_string": "{origination_caller_id_number=20701}sofia/0701/%s", "dial_string_mode": 2, "db_public_id": 1, "db_private_id": null, "node_ip": "59.111.104.142", "node_status": "1", "created_at": "2020-05-07 09:31:03", "updated_at": "2020-06-10 13:37:14", "feature": 7 }, "auto_recycle_rule": { "id": 4, "user_id": "f00c8abc-433666-a9d6-70479605ced1", "name": "测试自动重呼", "remark": "测试自动重呼", "status": true, "created_at": "2020-01-14 14:00:09", "updated_at": "2020-01-14 14:00:09", "is_default": null, "type": 1, "configs": null }, "disable_time_group": { "uuid": "8ae402ae-4af9-4c2ac-96e1efae399e", "name": "默认禁止呼叫时间:00:00:00-08:00:00,21:00:00-23:59:59", "domain": "", "user_id": "4d99d91c-f5d9-49da-8-758977cc58a9", "created_at": null, "updated_at": null } } ], "meta": { "has_pages": false, "total": 3, "last_page": 1, "current_page": 1, "per_page": 15 } }
6.任务删除
-
请求接口
/agent-api/user/{user_id}/task/{task_id}
-
请求方式
DELETE
-
返回结果
{ "code": 200, "status": "success", "message": "删除成功" }
7. 任务开启
-
请求接口
/agent-api/task_start/{task_id}
-
请求方式
GET
-
返回参数
{ "status": "success", "code": 200, "message": "启动任务成功" }
8.任务停止
-
请求接口
agent-api/task_stop/{task_id}
-
请求方式
GET
-
返回参数
{ "status": "success", "code": 200, "message": "停止任务成功" }
9.任务拨打进度
-
请求接口
/agent-api/task_progress/{task_id}
-
请求方式
GET
-
返回结果
{ "code": 200, "status": "success", "message": "获取任务进度成功", "data": { "task_id": "2d731938-03af-4949-b318-9348217f1df3", "progress": { "total": 10, "progress": 3, "percent": 30 } } }
10.根据任务获取获取标签场景,标签分组,标签
-
请求接口
/agent-api/task/{task_id}/tag
-
请求方式
GET
-
返回结果
{ "code": 200, "status": "success", "message": "获取标签信息成功", "data": { "tag_scene": { "id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e", "name": "标签场景2", "description": "我是描述2" }, "tag_groups": [ { "id": "1", "name": "标签组1" } ], "tags": [ { "id": "102b14cc-b080-4361-bd94-1640d0d5211b", "name": "样板房", "description": "样板房" }, { "id": "581dad6e-f647-48e9-85a2-5f853a081684", "name": "户型面积", "description": "户型面积" } ] } }
线路相关
1.线路列表
-
请求接口
/agent-api/callerline/{user_id}
-
请求方式
GET
-
返回结果
{ "code": 200, "status": "success", "message": "查看线路列表成功", "data": [ { "id": "smdow1515441wvbw3", "name": "线路4", "description": "1111", "begin_at": "2020-04-30 11:16:19", "available_at": "2021-04-30 11:16:19", "call_line": 1, "call_line_used": 2, "call_number": null, "feature_arr": null } ] }
话术相关
1.话术分组
-
请求接口
/agent-api/group/{user_id}
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
- 返回结果
{ "code": 200, "status": "success", "message": "查看话术分组列表成功", "data": [ { "id": 41, "name": "0611", "user_id": "f00c8abc-433f-4666-a9d79605ced1", "debug": true, "deleted_at": null, "created_at": "2020-06-11 14:28:50", "updated_at": "2020-06-11 14:28:50", "check_status": 0, "link_word_group_id": null, "tag_scene_id": "c74ffa32-373d-46b1-b9d9cadc224", "default": false } ], "meta": { "has_pages": false, "total": 4, "last_page": 1, "current_page": 1, "per_page": 15 } }
代理商线路操作
1. 线路列表
-
请求接口
/agent-api/callerline
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
user_id | string | ascnjwnvc1561 | 用户id,不填时查询所有线路,填写时查询已分配到该用户下的所有线路 | no |
unused | boolean | true | 不填时查询所有线路,true时查询所有未被分配的线路 | no |
示例
{
"user_id":"f00c8abc-433f-4666-a9d6-70479605ced1",
"unused":true
}
- 返回结果
{ "code": 200, "status": "success", "message": "查看线路成功", "data": [ { "id": "a62bdf07-df18-46c7-960f-07b411df4b6e", "name": "成都平安小许-2020050701", "user": { "name": "1121", "email": "147147147@qq.com", "phone": "18361206976", "type_note": "客户" }, "call_line": 2, "deadline_at": "2020-06-09 00:00:00", "available_time": 31536000, "begin_at": "2020-05-07 09:28:57", "available_at": "2021-05-07 09:28:57", "caller_number": "niha333", "client": "fgh", "created_at": "2020-05-07 09:28:05", "updated_at": "2020-05-07 09:28:57", "description_server": null, "qr_code": null } ], "meta": { "has_pages": false, "total": 1, "last_page": 1, "current_page": 1, "per_page": 15 } }
2.分配线路
-
请求接口
agent-api/callerline/line_assign
-
请求方式
POST
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
user | string | ascnjwnvc1561 | 用户 | yes |
lines | array | [{"id":"8d5772a9-04d7-4d5e-a9a9-b8d922fbd490","available_time":"31536000"}] | 分配的线路,id为线路id,available_time为可用时间 | yes |
示例
{
"user":"f00c8abc-433f-4666-a9d6-70479605ced1",
"lines":[{"id":"8d5772a9-04d7-4d5e-a9a9-b8d922fbd490","available_time":"31536000"}]
}
返回结果
{
"code": 200,
"status": "success",
"message": "分配线路成功"
}
3.取消分配线路
-
请求接口
/agent-api/callerline/line_unassign
-
请求方式
DELETE
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
lines | array | ["8d5772a9-04d7-4d5e-a9a9-b8d922fbd490"] | 取消分配的线路 | yes |
示例
{
"lines":["8d5772a9-04d7-4d5e-a9a9-b8d922fbd490"]
}
- 返回结果
{ "code": 200, "status": "success", "message": "取消线路成功" }
其他
1.获取已配置的评分等级
-
请求接口
/agent-api/settings/{user_id}/record_level
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
- 返回结果
{ "code": 200, "status": "success", "message": "查看评分等级成功", "data": [ { "id": "60d50570-a5d2-451d-9ed2-88c17ef51b73", "name": "S级", "alias": "默认评分S级登记", "color": "#000", "score_min": 900, "score_max": 10000, "status": true, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "created_at": "2020-01-13 14:22:53", "updated_at": "2020-01-13 14:22:53" }, { "id": "dcdb31e0-cf20-45f1-91bb-4e142855b8d0", "name": "B级", "alias": "默认评分B级登记", "color": "#000", "score_min": 700, "score_max": 800, "status": true, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "created_at": "2020-01-13 14:22:53", "updated_at": "2020-01-13 14:22:53" } ], "meta": { "has_pages": false, "total": 5, "last_page": 1, "current_page": 1, "per_page": 15 } }
2.获取可用的标签
-
请求接口
/agent-api/tag/{user_id}/usable_tags
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
- 返回结果
{ "code": 200, "status": "success", "message": "查看可以的标签列表成功", "data": [ { "id": "a2dfab68-3861-4baa-994e-6fd3276ad1a0", "name": "在忙", "description": "在忙", "color": "#d52b79", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "status": 1, "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19", "tag_groups": [ { "id": "cf70ada2-fc8b-428f-bf44-d006be3c53bb", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "否定", "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19", "tag_scene_id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e", "pivot": { "tag_id": "a2dfab68-3861-4baa-994e-6fd3276ad1a0", "tag_group_id": "cf70ada2-fc8b-428f-bf44-d006be3c53bb", "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19" }, "tag_scene": { "id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e", "name": "标签场景2", "description": "我是描述2", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "created_at": "2020-03-03 10:36:33", "updated_at": "2020-03-03 10:36:33" } } ] }, { "id": "2e491e98-c4cd-491a-95b0-850ceaf4adba", "name": "有意向", "description": "有意向", "color": "#c142ef", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "status": 1, "created_at": "2020-05-15 10:38:18", "updated_at": "2020-05-15 10:38:18", "tag_groups": [ { "id": "5d9ea816-f04b-4c23-b9db-18d92e26b9a8", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "肯定", "created_at": "2020-05-15 10:38:18", "updated_at": "2020-05-15 10:38:18", "tag_scene_id": "c74ffa32-373d-46b1-b972-209d9cadc224", "pivot": { "tag_id": "2e491e98-c4cd-491a-95b0-850ceaf4adba", "tag_group_id": "5d9ea816-f04b-4c23-b9db-18d92e26b9a8", "created_at": "2020-05-15 10:38:18", "updated_at": "2020-05-15 10:38:18" }, "tag_scene": { "id": "c74ffa32-373d-46b1-b972-209d9cadc224", "name": "通用", "description": "通用", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "created_at": "2020-05-15 10:38:18", "updated_at": "2020-05-15 10:38:18" } } ] } ], "meta": { "has_pages": true, "total": 31, "last_page": 3, "current_page": 1, "per_page": 15 } }
3.客服组列表
-
请求接口
/agent-api/customer/{user_id}/service
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
- 返回结果
{ "code": 200, "status": "success", "message": "查看客服组成功", "data": [ { "id": 2, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "0507", "caller_line_id": "3", "status": 1, "created_at": "2020-05-06 14:37:59", "updated_at": "2020-05-06 14:37:59" }, { "id": 1, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "0506", "caller_line_id": "3", "status": 1, "created_at": "2020-05-06 13:24:34", "updated_at": "2020-05-06 13:24:34" } ] }
客户公海
1.公海创建模板
-
请求接口
agent-api/user/{user_id}/customer/create
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户id | yes |
- 返回结果
{ "code": 200, "status": "success", "message": "查看公海创建模板成功", "data": [ { "id": "91a4ff5d-3d14-4b85-a062-a3468e48f4be", // 公海组件id "name": "姓名", // 公海组件名称 "type": "text", // 公海组件类型 "sort": 0, // 公海组件排序 "validate": [ // 公海组件验证规则,有required必填,integer整数,date日期,sometimes存在时则验证 "required" ] }, { "id": "c87d8629-7cfd-4980-bb3a-7827bff4b72c", "name": "数字", "type": "number", "sort": 1, "validate": [ "integer" ] }, { "id": "44560536-46b5-4e38-852e-949fd12c1ee6", "name": "日期", "type": "date", "sort": 2, "validate": [ "date", "sometimes" ] } ] }
2.批量导入客户公海
-
请求接口
agent-api/user/{user_id}/customer
-
请求方式
POST
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
data | array | [] | 客户公海数据 | yes |
-
请求案例
{ "data":[ { "phone": "13012121211", // 电话号码 "sort": 0, // 暂时没用,都填0 "components": [ { "id": "2a87347c-6dd5-4e22-97fe-9b8001dbcd17", // 组件id "value": "小牛" // 组件值 }, { "id": "3535fa11-d1fc-468b-943c-8850c4e5514e", "value": "17" } ] }, { "phone": "13012121212", "sort": 0, "components": [ { "id": "2a87347c-6dd5-4e22-97fe-9b8001dbcd17", "value": "小张" } ] } ] }
-
请求说明
-
components中的id为公海创建模板中输出的对应组件的id值,value则为对应的要存储的公海的值
-
每次最多导入30条数据
-
返回
{ "code": 200, "status": "success", "message": "号码导入客户公海成功", "data": { "crmCustomerCount": 3 // 导入成功条数 } }
号码相关
1.号码列表
-
请求接口
agent-api/user/{user_id}/task/{task_id}/number
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 分页 | yes |
user_id | string | fwevweve251 | 用户id | yes |
task_id | string | 1254685jjuq | 任务id | yes |
- 返回数据
{ "code": 200, "status": "success", "message": "查看号码列表成功", "data": [ { "number": null, "city": "邢台", "pro": "河北", "mobile_type": "联通", "area_code": "0319", "post_code": "054000", "id": 258, "status_str": "等待呼叫", "callid": null, "calldate": null, "bill": null, "duration": null, "hangupcause": null, "hangupdate": null, "answerdate": null, "is_blacklist": null, "status": 0, "customer_id": "ab4490e6-0174-47c1-b155-0040fd4c6b7a", "created_at": "2020-07-28 14:37:30" } ], "meta": { "has_pages": true, "total": 1, "last_page": 1, "current_page": 1, "per_page": 15 } }
2.号码详情
-
请求接口
agent-api/user/{user_id}/task/{task_id}/number/detail/{phone}
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户id | yes |
task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务id | yes |
phone | string | 18651683344 | 手机号码 | yes |
- 返回数据
{ "code": 200, "status": "success", "message": "查看号码详情成功", "data": { "id": 241, "number": "18651683344", "status_str": "等待呼叫", "callid": null, "calldate": null, "bill": null, "duration": null, "hangupcause": null, "answerdate": null, "status": 0, "is_blacklist": false, "city": "", "pro": "", "mobile_type": null, "area_code": null, "post_code": null } }
3.批量添加号码
-
请求接口
agent-api/user/{user_id}/task/{task_id}/number
-
请求方式
POST
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
phone | string | 13012121211 | 号码 | yes |
sort | int | 0 | 排序 | yes |
components | array | [] | 组件数据 | no |
-
请求数据案例
{ "data":[ { "phone": "13012121211", "sort": 0, "components": [ { "id": "2a87347c-6dd5-4e22-97fe-9b8001dbcd17", "value": "小牛" }, { "id": "3535fa11-d1fc-468b-943c-8850c4e5514e", "value": "17" } ] }, { "phone": "13012121212", "sort": 0, "components": [ { "id": "2a87347c-6dd5-4e22-97fe-9b8001dbcd17", "value": "小张" } ] }, { "phone": "13012121213", "sort": 0 } ] }
-
写入任务的号码会先写入公海中,所以此接口会先导入CRM公海,然后再导入对应任务中
-
components中的id为组件的id,value为对应的值,id的值可以去创建公海模板的接口中获取
-
每次最多导入30条数据
-
不可导入重复号码
-
返回结果
{ "code": 200, "status": "success", "message": "号码导入任务成功", "data": { "taskNumberCount": 1, "crmCustomerCount": 1 } }
-
taskNumberCount 表示成功写入任务的号码数量,如果任务中号码已存在,则此处不会写入
-
crmCustomerCount表示成功写入CRM公海的号码数量,如果公海中号码已存在,则此处不会写入
4.批量重置号码状态
-
请求接口
agent-api/user/{user_id}/task/{task_id}/number-batch-reset
-
请求方式
PUT
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户id | yes |
task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务id | yes |
keyword | string | 18365474148 | 号码 | no |
start_at | string | 2020-07-28 | 创建开始时间 | no |
end_at | string | 2020-07-28 | 创建开结束时间 | no |
status | int | 1 | 筛选你所需要重置的号码的状态 | no |
- 返回数据
{ "code": 200, "status": "success", "message": "批量重置号码成功" }
5.批量删除号码
-
请求接口
agent-api/user/{user_id}/task/{task_id}/number-batch-delete
-
请求方式
DELETE
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
user_id | string | 4d99d91c-f5d9-49da-88da-758977cc58a9 | 用户id | yes |
task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务id | yes |
customer_info_list | array | [] | 号码 | yes |
-
请求案例
{ "customer_info_list":[ {"phone": "18361201206"}, {"phone": "18361201208"} ] }
-
返回数据
{ "code": 200, "status": "success", "message": "批量删除号码成功" }
通话相关
1.通话列表
-
请求接口
agent-api/task/{task_id}/record
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
page | int | 1 | 页码 | yes |
levels | array | [ [300, 500] ] | 评分区间 | no |
keyword | string | 1874125147 | 被叫号码 | no |
start_at | string | 2020-08-02 | 开始时间 | no |
end_at | string | 2020-08-03 | 结束时间 | no |
- 返回数据
{ "code": 200, "status": "success", "message": "查看通话记录列表成功", "data": [ { "tags": [],, "tag_groups": [], "operator_name": "", "id": "30", "task_id": "289b4a84-5648-4c92-8173-6addd8359d70", "group_id": 1, "callid": "1", "score": 600, "callee": "18361254130", "caller_number": "18361254125", "duration": 0, "error_code": 0, "gender": null, "level_id": "07f4e30f-eb8d-4ab1-bdee-495815569936", "calldate": "2019-11-29 08:47:08", "bill": 35599, "hangupcause": "1", "hangupdate": "2019-09-04 17:54:15", "answerdate": "2019-09-04 17:54:24", "recordfile": "/home/vagrant/code/recordings/2019-09-04/18361254125.1.wav", "bridge_callid": "1", "bridge_number": "18361206976", "bridge_calldate": "2019-09-04 17:54:45", "bridge_answerdate": "2019-09-04 17:54:53", "hangup_disposition": 2, "created_at": "2020-04-03 11:55:07", "updated_at": "2020-07-28 15:38:29", "rounds": 0, "level_name": "我是等级", "read_at": "2020-07-28 15:38:29", "province_id": 0, "city_id": 0, "operator": 0, "customer_id": "", "level": null, "gender_str": "未知", "hangup_disposition_str": "客户", "details": [ { "id": "40", "record_id": "30", "task_id": "289b4a84-5648-4c92-8173-6addd8359d70", "notify": "asrprogress_notify", "callid": "1", "error_code": 1, "asrtype": null, "callee": "18361254125", "gender": 1, "asr_elapse": 1, "record_ms": 1, "volume_gain": 1, "question": "1", "question_index": 11, "speak_ms": 0, "play_ms": 0, "keyword": "收到v你,mo3,g3", "answer_id": "b27b40db-2668-4331-9685-768c719d0092", "answer_text": null, "answer_content": null, "word_class": null, "score": 0, "sequence": 0, "created_at": "2019-12-19 10:42:41", "updated_at": null, "bridge_status": null, "tags": [] } ], "province": null, "city": null } ], "meta": { "has_pages": false, "total": 1, "last_page": 1, "current_page": 1, "per_page": 15 } }
2.通话详情
-
请求接口
agent-api/task/{task_id}/detail/{record_id}
-
请求方式
GET
-
请求参数
参数 | 类型 | 示例 | 解释 | required |
---|---|---|---|---|
task_id | string | b15b7392-a83f-4e0e-9570-31dd2ec8f85c | 任务id | yes |
record_id | string | 17364fcc-45a8-4f0c-88d8-83ee57e1341b | 通话id | yes |
- 返回数据
{ "code": 200, "status": "success", "message": "查看通话记录详情成功", "data": { "records": [ { "id": "40", "record_id": "30", "task_id": "289b4a84-5648-4c92-8173-6addd8359d70", "notify": "asrprogress_notify", "callid": "1", "error_code": 1, "asrtype": null, "callee": "18361254125", "gender": 1, "asr_elapse": 1, "record_ms": 1, "volume_gain": 1, "question": "1", "question_index": 11, "speak_ms": 0, "play_ms": 0, "keyword": "收到v你,mo3,g3", "answer_id": "b27b40db-2668-4331-9685-768c719d0092", "answer_text": null, "answer_content": null, "word_class": null, "score": 0, "sequence": 0, "created_at": "2019-12-19 10:42:41", "updated_at": null, "bridge_status": null, "contents": [ { "id": "f6e08158-afeb-467b-8398-ec51269fdbb5", "file_id": "029a24e8-68df-4672-904f-90889e17f022", "sort": 0, "status": true, "translate_text": "你好,欢迎使用智能语音应答平台", "wav_second": 43.508875 } ], "tags": [ { "id": "955b8398-e7b6-42dd-88fe-7ddfade63f67", "name": "无意向", "description": "无意向", "color": "#abce34", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "status": 1, "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19", "pivot": { "taggable_id": "40", "tag_id": "955b8398-e7b6-42dd-88fe-7ddfade63f67", "taggable_type": "App\\Models\\AutoDialer\\CallRecordDetail", "created_at": null, "updated_at": null }, "tag_groups": [ { "id": "cf70ada2-fc8b-428f-bf44-d006be3c53bb", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "name": "否定", "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19", "tag_scene_id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e", "pivot": { "tag_id": "955b8398-e7b6-42dd-88fe-7ddfade63f67", "tag_group_id": "cf70ada2-fc8b-428f-bf44-d006be3c53bb", "created_at": "2020-05-15 10:38:19", "updated_at": "2020-05-15 10:38:19" } } ] } ] } ], "is_intervene_bridge": false, "is_intervene_hangup": false, "intervene_number": [], "is_crm_exists": false, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "info": { "record": { "id": "30", "task_id": "289b4a84-5648-4c92-8173-6addd8359d70", "group_id": 1, "callid": "1", "score": 600, "callee": "18361254130", "caller_number": "18361254125", "duration": 0, "error_code": 0, "gender": null, "level_id": "07f4e30f-eb8d-4ab1-bdee-495815569936", "calldate": "2019-11-29 08:47:08", "bill": 35599, "hangupcause": "1", "hangupdate": "2019-09-04 17:54:15", "answerdate": "2019-09-04 17:54:24", "recordfile": "/home/vagrant/code/recordings/2019-09-04/18361254125.1.wav", "bridge_callid": "1", "bridge_number": "18361206976", "bridge_calldate": "2019-09-04 17:54:45", "bridge_answerdate": "2019-09-04 17:54:53", "hangup_disposition": 2, "created_at": "2020-04-03 11:55:07", "updated_at": "2020-07-28 15:38:29", "rounds": 0, "level_name": "我是等级", "read_at": "2020-07-28 15:38:29", "province_id": 0, "city_id": 0, "operator": 0, "customer_id": "", "level": null, "bridge_user": [ "1121下的子账户" ], "gender_str": "未知", "hangup_disposition_str": "客户", "crm_number": null }, "task": { "uuid": "289b4a84-5648-4c92-8173-6addd8359d70", "name": "任务1", "create_datetime": "2019-11-22 17:33:21", "alter_datetime": "2020-06-16 16:55:54", "start": 0, "maximumcall": 1, "call_per_second": 10, "recycle_limit": 1, "random_assignment_number": 0, "disable_dial_timegroup": null, "destination_extension": 39, "destination_dialplan": "XML", "destination_context": "default", "scheduling_policy_ratio": null, "scheduling_queue": null, "dial_format": "1", "domain": null, "remark": "111", "sort": 0, "originate_variables": "{execute_on_media=start_da2,background=/home/vagrant/code/saas/storage/app/bridge_bg_3min.wav}", "_originate_timeout": 60, "_origination_caller_id_number": "1234", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "caller_line_id": "a62bdf07-df18-46c7-960f-07b411df4b6e", "customer_service_id": null, "auto_recycle_rule_id": null, "call_notify_url": "http://127.0.0.1/api/hangup_notify", "call_notify_type": 2, "call_pause_second": 10, "deleted_at": null, "group": { "id": 39, "name": "演示话术分组", "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "debug": true, "deleted_at": null, "created_at": "2020-01-21 14:34:47", "updated_at": "2020-01-21 14:34:47", "check_status": 0, "link_word_group_id": null, "tag_scene_id": "0e62b98f-a5b9-46f8-ad95-dd18e0bb062e", "default": false } } }, "callee": null, "mobile_info": { "mobile_type": "移动", "province": "江苏", "city": "徐州" }, "utterances": [ { "id": "b27b40db-2668-4331-9685-768c719d0092", "name": "欢迎", "description": "你好,我是描述的内容", "group_id": 39, "user_id": "f00c8abc-433f-4666-a9d6-70479605ced1", "context_id": null, "priority": 10, "action": null, "word_class": 16, "wait": 3000, "retry": 0, "max_retry": 0, "score": 0, "play_ms": 2000, "enquire": true, "customer_service_id": null, "identify_type": 4, "is_node": 0, "node_label_id": null, "root_word_class": 0, "depth": 1, "deleted_at": null, "created_at": "2020-01-21 14:34:48", "updated_at": "2020-03-19 14:45:54", "background_file_id": null, "record_next_text": null, "block_asr": 0, "is_regular": 0, "top": null, "left": null, "hide": false, "allow_keyword_interrupt": true, "break_category_id": 0, "word_class_str": "主流程", "action_str": "" } ] } }
三、代理回调
1.配置回调地址
-
查看代理回调地址
-
任务结束回调:当代理下的用户的某一任务结束时,会给相应的地址发送数据。
-
通话完成回调:当代理下的用户的某一任务下的某一通电话结束时,会给相应的地址发送数据。
2.任务结束回调数据
{
"task_data": {
"task_name": "bank",
"created_at": "2020-05-28 16:41:45",
"task_id": "b15b739e0e-9570-31d5c",
"callerline": "南京-云蝠智能",
"callerline_id": "6c48047947-b958-2fe0fc",
"outbond_group": "测试话术",
"number_count": 10
},
"number_status": [{
"status": 0,
"status_str": "等待呼叫",
"count": 0
}, {
"status": 1,
"status_str": "呼叫成功",
"count": 1
}, {
"status": 2,
"status_str": "线路故障",
"count": 0
}, {
"status": 3,
"status_str": "拒接",
"count": 0
}, {
"status": 4,
"status_str": "无应答、无人接听",
"count": 0
}, {
"status": 5,
"status_str": "空号",
"count": 0
}, {
"status": 6,
"status_str": "关机",
"count": 0
}, {
"status": 7,
"status_str": "停机",
"count": 0
}, {
"status": 8,
"status_str": "占线、用户正忙",
"count": 0
}, {
"status": 9,
"status_str": "呼入限制",
"count": 0
}, {
"status": 10,
"status_str": "欠费",
"count": 0
}, {
"status": 11,
"status_str": "黑名单",
"count": 0
}, {
"status": 12,
"status_str": "呼损",
"count": 0
}],
"answer_rate": {
"answered": 73,
"noAnswer": 0
},
"user_data": {
"user_id": "f00c8abc-433f-4666-a9d6-70479605ced1",
"user_name": "1121"
}
}
- task_data: task_name是任务名称,task_id是任务id,callerline_id是线路id,callerline是线路名称,outbond_group是话术,number_count是任务下的号码总数。
- number_status: 代表的是任务中号码的不同呼叫情况
- answer_rate : answered是接通数量,noAnswer是未接通数量(可用来计算接通率)
- user_data : 用户信息
3.通话完成回调数据
{
"calldate": "2020-08-06 12:00:07",
"task_name": "bank",
"original_number": "15472155875",
"keyword": "不需要",
"level_name": null,
"bill": 9,
"user_id": "f00c8ab-433f-a9d6-704791",
"username": "用户名称"
}
- calldate 呼叫时间
- task_name 任务名称
- original_number 呼叫号码
- keyword 关键词
- level_name 评分等级
- bill 通话时长
- user_id 用户id
- username 用户名称