智营销机器人接口

接口文档

对接概述

接口描述

简要描述:

  • 本接口描述机器人外呼平台接口的使用方法和协议规范。通过本文档的接口内容,实现机器人外呼,查询结果等功能。

请求域名:

  • http://vs1.wei-fu.cn

接口说明:

  • 接口采用 json + http 模式,请求和响应数据均为 utf-8 编码的 json 格式
  • 请求内容包含:请求消息体
  • 响应内容为 json 字符串
  • 请求示例:
Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "token": "xxx"
}

获取token

获取token

请求URL:

POST/zyx_api/openapi/getToken.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
passwd string 公司密码

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "passwd": "xxx"
}

返回示例:

正确时返回:

{
    "info": "获取成功",
    "code": 0,
    "data": {
        "access_token": "xxxxxxxxxxxxxxxx",
        "expires_in": "2019-10-19 12:45:23"
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集
∟ access_token string toekn
∟ expires_in int token失效时间

备注:

  • 更多返回错误代码请看首页的错误代码描述

对接验证

获取token

请求URL:

POST/zyx_api/openapi/checkActai.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
passwd string 公司密码
token string 调用秘钥

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "passwd": "xxx"
	"token": "xxxxxx"
}

返回示例:

正确时返回:

{
    "info": "验证通过",
    "code": 0,
    "data": {
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集

备注:

  • 更多返回错误代码请看首页的错误代码描述

获取机器人

获取机器人模板

请求URL:

POST/zyx_api/openapi/showRobot.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 分配的唯一调用秘钥

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "token": "xxx"
}

返回示例:

正确时返回:

{
    "info": "请求成功!",
    "code": 0,
    "data": {
        "robot": [
            {
                "id": "120",
                "pro_name": "58金融催收1"
            },
            {
                "id": "125",
                "pro_name": "58金融催收多回应版"
            }
        ]
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集
∟ robot string 机器人列表
∟ ∟ id string 机器人id
∟ ∟ pro_name string 机器人名称

备注:

  • 更多返回错误代码请看首页的错误代码描述

机器人初始化

获取机器人模板

请求URL:

POST/zyx_api/openapi/initRobot.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 分配的唯一调用秘钥
robotid string 机器人id

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "token": "xxx",
	"robotid":"xx"
}

返回示例:

正确时返回:

{
    "info": "请求成功!",
    "code": 0,
    "data": {
        "initid":"1"
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集
∟ initid string 初始化id

备注:

  • 更多返回错误代码请看首页的错误代码描述

获取机器人状态

获取机器人模板

请求URL:

POST/zyx_api/openapi/getRobotState.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 分配的唯一调用秘钥
robotid string 机器人id

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "token": "xxx",
	"robotid":"xx"
}

返回示例:

正确时返回:

{
    "info": "请求成功!",
    "code": 0,
    "data": {
        "robotState":"pause"
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集
∟ robotState string run 运行中,pause 暂停中

备注:

  • 更多返回错误代码请看首页的错误代码描述

机器人状态操作

获取机器人模板

请求URL:

POST/zyx_api/openapi/robotAct.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 分配的唯一调用秘钥
robotid string 机器人id
robotState string 执行操作,取值 run 运行中,pause 暂停中

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxx",
    "token": "xxx",
	"robotid":"xx",
	"robotState":"run"
}

返回示例:

正确时返回:

{
    "info": "操作成功!",
    "code": 0,
    "data": {
    }
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集

备注:

  • 更多返回错误代码请看首页的错误代码描述

添加号码

添加外呼号码

请求URL:

POST/zyx_api/openapi/addPhones.php

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 唯一调用秘钥
robotid string 机器人id
phones array 号码集合,每次请求最多传递 2000 个号码
∟ phone string 外呼的手机号码
∟ busines string 业务区分标识,如果没有可为空

请求示例:

Accept: application/json
Content-Type: application/josn;charset=utf-8
{
    "account": "xxxx",
    "token": "xxxxx",
    "robotid": "xxx",
    "phones": [
     {
        "phone": "13800138000",
        "busines":"bc_101",
    },
    {
        "phone": "13800138002",
        "busines":"bc_102",
    }
    ]
}

返回示例:

正确时返回:

{
    "info": "号码提交保存成功",
    "code": 0,
    "data": [
        "phones": [
            {
                "phone": "13800138000",
                "busines":"bc_101"
            },
            {
                "phone": "13800138002",
                "busines":"bc_102"
            }
        ]
    ],
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data object 返回的数据集,注:号码添加成功后才有返回,失败无返回
∟ phone string 外呼号码原样返回 注:号码添加成功后才有返回,失败无返回
∟ busines string 业务标识 注:号码添加成功后才有返回,失败无返回

备注:

  • 更多返回错误代码请看首页的错误代码描述

呼叫结果回调

呼叫结果回调

说明:

1) 配置回调地址,我们将呼叫结果以每分钟推送形式将数据推送至配置好的地址,

2) 该地址接收到数据后须返回接收成功,否则将再次推送,具体返回数据见下方说明。

3) 推送采用 post+json 形式

参数:

参数名 是否必须 类型 说明
call_time string 呼叫时间 例:2019-10-21 10:02:56
robot string 机器人ID
phone string 手机号码
call_billsec string 通话时长 单位 秒
call_status string 呼叫状态 2成功, 3失败
call_session string 呼叫唯一标识
classification string 分类 例 A
hangup_cause string 挂机说明
hangup_time string 挂机时间 例:2019-10-21 10:02:56
anwser_time string 接听时间 例:2019-10-21 10:03:05
task_flag string 匹配标签
task_flag_value string 匹配标签的值
busines string 透传字段,添加号码时所传内容,原样返回
call_monitor string 录音地址,在接收到的值前加上接口请求域名或ip,即得到录音真实地址,例 http://vs1.wei-fu.cn/monitor/2019/10/21/xxxxxx.wav

请求示例:

{
    "call_time": "2019-08-23 01:07:13",
    "robot": "120",
    "phone": "18681418681",
    "call_billsec": "90",
    "call_status": "2",
    "call_session": "b71eb783338da29b6f1086ca4a9b0175",
    "classification": "AA",
    "hangup_cause": "",
    "hangup_time": "2019-08-23 01:08:51",
    "anwser_time": "2019-08-23 01:07:21",
    "task_flag": "",
    "task_flag_value": "",
    "busines": "xxxxxx",
    "call_monitor": "monitor/2019/08/23/xxxxx.wav"
}

返回示例:

正确时返回:

{
    "code": "0",
    "info": "成功!"
}

错误时返回:

{
    "code": "1",
    "info": "错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明

备注:

  • 更多返回错误代码请看首页的错误代码描述

对话详情

获取对话内容

请求URL:

GET/zyx_api/openapi/dialogue.php

注:该接口为get请求

参数:

参数名 是否必须 类型 说明
account string 公司账号
token string 分配的唯一调用秘钥
robotid string 机器人id
call_session string 会话标识 --任务详情有返回
call_time string 呼叫时间 --任务详情有返回
view_type string 视图类型 web、json 默认web

请求示例:

web页面方式:

web页面展示,可以设置ifrmae的 【src】 为
http://host/zyx_api/openapi/sessionDialogue.php?access=xxx&token=xxx&task_id=xxx&call_session=xxx&call_time=2019-09-10 10:21:23

json数据方式:

http://host/zyx_api/openapi/sessionDialogue.php?access=xxx&token=xxx&task_id=xxx&call_session=xxx&call_time=2019-09-10 10:21:23&view_type=json

返回示例:

web正确时页面:

json正确时返回:

{
	"code": 0,
	"data": {
		"list": [{
			"ui_type": "asr",
			"weiqi_type": null,
			"text": "你好",
			"create_time": "2019-08-22 18:02:24",
			"responsetime": "334ms",
			"weiqiresponsetime": "",
			"recordfile": "\/ai_record\/speak\/19\/08\/22\/e6270c660f66f0e6fc3a2d532cc6bd25_1566468142_18219103020.wav"
		}, {
			"ui_type": "nlp",
			"record_file": null,
			"weiqi_type": "jrcs_1-01",
			"text": "您好,我是坐席代表,请问您是女士吗。",
			"create_time": "2019-08-22 18:02:26",
			"responsetime": "",
			"weiqiresponsetime": "2240ms"
		}],
		"tag": {
			"task_mark": null,
			"classification": "A"
		},
		"file_path": "\/monitor\/2019\/08\/22\/e6270c660f66f0e6fc3a2d532cc6bd25_18219103020.wav"
	}
}

错误时返回:

{
    "code": "1",
    "info": "公司账号错误"
}

返回参数说明:

参数名 类型 说明
code string 返回码,0为正常,非0为请求失败
info string 接口请求中文说明
data array 返回的数据集
∟file_path string 任务号码录音文件
∟tag string 标记
∟ ∟ classification string 分类 AA A B C D
∟list array 数据列表
∟ ∟ui_type string 对话的类型 nlp、 asr
∟ ∟recordfile string 对话录音
∟ ∟create_time string 对话时间
∟ ∟text string 转换的文本
∟ ∟responsetime string asr处理时长
∟ ∟weiqiresponsetime string nlp处理时长

备注:

  • 更多返回错误代码请看首页的错误代码描述