参数 | 说明 | 是否必填 | 类型 |
---|---|---|---|
appId | 应用id | 是 | String |
name | 任务名称 | 是 | String |
dialogFlowId | 话术id | 是 | Int |
mode | 任务启动方式,共有两种方式, MANUAL为手动启动,需要调用启动任务接口或者在界面上手动启动任务, AUTO为自动启动,需要在建立任务时设定任务开始时间(startTime)以自动启动。 | 是 | String |
startDateTime | 任务自动启动日期,该字段仅在任务启动方式(mode)为自动启动(AUTO)时必传,其他时候非必传且无效。 如:"2021-12-22 00:00:00" | 否 | String |
dailyStartDateTime | 可拨打开始时间,如09:00,默认不可以早于9点 | 是 | String |
dailyEndDateTime | 可拨打结束时间,如20:00,默认不可以晚于20点 | 是 | String |
robotCount | 任务使用的AI并发数 | 是 | Int |
jobPhoneNumberId | 线路id | 是 | Int |
endDateTime | 外呼结束时间,如 2022-02-07 10:00:00 | 否 | String |
inactiveTimeList | 不可拨打时间段,每日该时间段内任务会被挂起,最多可以设置三个不可拨打时间段,如: [{"startTime":"12:00", "endTime":"13:00"},{"startTime":"14:00", "endTime":"15:00"},{"startTime":"16:00", "endTime":"17:00"}] | 否 | Array |
inactiveDateList | 不可拨打日期,最多可以设置三个不可拨打日期段,如: [{"startDate":"2022-02-05","endDate":"2022-02-07"},{"startDate":"2022-02-08","endDate":"2022-02-09"},{"startDate":"2022-02-10","endDate":"2022-02-11"}] | 否 | Array |
daysOfWeek | 周可拨打时间段,如["MONDAY","TUESDAY"] | 否 | Array |
redial | 是否重播 | 是 | Boolean |
redialCondition | 重播规则。此参数用于设定自动重播同时规定自动重播条件,仅符合此条件的客户会进行自动重播,可重播条件分为: ( CALL_LOSS,“呼损客户” ), ( NO_ANSWER,“无应答” ), ( BUSY,“忙线中” ), ( REFUSED,“拒接” ), ( POWER_OFF,“关机” ), ( OUT_OF_SERVICE,“停机” ), ( CAN_NOT_CONNECT,“无法接通“ ), ( FROM_PHONE_ERROR,“主叫欠费” ), ( SYSTEM_ERROR,“外呼失败” ), ( VACANT_NUMBER, “空号” )。 例如:["CALL_LOSS","NO_ANSWER"] | 否 | Array |
redialInterval | 重播间隔,单位分钟,最大值为1440 | 否 | Int |
redialTimes | 重播次数(1~3)区间 | 否 | Int |
Request URL:
https://api.itniotech.com/aivoice/taskAdd
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bD8JFiq9
Request Body:
{
"appId": "epp4kNge",
"name": "11112",
"dialogFlowId": 8663,
"mode": "AUTO",
"dailyStartDateTime": "09:00",
"dailyEndDateTime": "20:00",
"robotCount": 1,
"jobPhoneNumberId": 2959,
"redial": false,
"startDateTime": "2022-09-16 08:00:00",
"endDateTime": "2023-02-07 10:00:00",
"inactiveTimeList": [
{
"startTime": "12:00",
"endTime": "13:00"
}, {
"startTime": "14:00",
"endTime": "15:00"
}, {
"startTime": "16:00",
"endTime": "17:00"
}
],
"inactiveDateList": [
{
"startDate": "2022-02-05",
"endDate": "2022-02-07"
}, {
"startDate": "2022-02-08",
"endDate": "2022-02-09"
}, {
"startDate": "2022-02-10",
"endDate": "2022-02-11"
}
],
"daysOfWeek": ["MONDAY"]
}
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见响应状态码说明 | String |
reason | 失败原因说明 | String |
data | 创建的任务ID | Long |
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 账号认证异常 |
-3 | 余额不足 |
-4 | 时间戳过期 |
-5 | 系统异常 |
-6 | ip限制 |
-27 | 参数校验异常 |
-28 | 自动模式,任务启动时间不能为空 |
-29 | 重播规则参数异常 |
-30 | 重播间隔参数异常 |
-31 | 重播次数参数异常 |
-33 | 外呼任务名称已存在 |
-37 | 应用不存在 |
-38 | 当前任务状态不可暂停 |
-39 | 当前任务状态不可启动 |
-41 | 话术ID参数异常 |
-45 | 未导入客户,不能启动 |
-46 | 网络异常或参数错误 |
-48 | 创建任务每日拨号时间段需在9:00-20:00之间 |
-49 | 账号未认证 |
-51 | 该客户自定义属性不完整 |
-52 | 并发数超出账户最大值 |
-57 | 签名不能为空 |
-58 | 时间戳不能为空 |
-59 | apikey不能为空 |
-60 | 意向标签组不存在 |
Java
PHP
REQUEST
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public void taskAdd() {
final String baseUrl = "https://api.itniotech.com/aivoice";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final String appId = "your appid";
final String name = "task Name"; //Task name
final Integer dialogFlowId = 8553; //Script ID
final String mode = "AUTO"; //Task start method
final String startDateTime = "2023-09-19 11:00:00"; //Task autostart date
final String dailyStartDateTime = "09:00"; //Available dialed start time
final String dailyEndDateTime = "19:00"; //Available dialed end time
final Integer robotCount = 1; //AI concurrency used by tasks
final Integer jobPhoneNumberId = 3126; //Line ID
final Boolean redial = false; //Whether to redial
final String url = baseUrl.concat("/taskAdd");
HttpRequest request = HttpRequest.post(url);
// currentTime
final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
// generate md5 key
final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
request.header(Header.CONNECTION, "Keep-Alive")
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.header("Sign", sign) //Signature with encryption
.header("Timestamp", datetime) //Current system time stamp (second)
.header("Api-Key", apiKey); //API KEY(Home-Developer options)
final String params = JSONUtil.createObj()
.set("appId", appId)
.set("name", name)
.set("dialogFlowId", dialogFlowId)
.set("mode", mode)
.set("dailyStartDateTime", dailyStartDateTime)
.set("dailyEndDateTime", dailyEndDateTime)
.set("robotCount", robotCount)
.set("jobPhoneNumberId", jobPhoneNumberId)
.set("redial", redial)
.set("startDateTime", startDateTime)
.toString();
HttpResponse response = request.body(params).execute();
if (response.isOk()) {
String result = response.body();
System.out.println(result);
}
}
REQUEST
header('content-type:text/html;charset=utf8');
$apiKey = "your api key";
$apiSecret = "your api secret";
$appId = "your appid";
$url = "https://api.itniotech.com/aivoice/taskAdd";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr["appId"] = $appId;
$dataArr["name"] = "task Name";
$dataArr["dialogFlowId"] = 8553;
$dataArr["mode"] = "AUTO";
$dataArr["dailyStartDateTime"] = "09:00";
$dataArr["dailyEndDateTime"] = "19:00";
$dataArr["robotCount"] = 1;
$dataArr["jobPhoneNumberId"] = "3126";
$dataArr["redial"] = false;
$dataArr["startDateTime"] = "2023-09-19 11:00:00";
$data = json_encode($dataArr);
$headers = array('Content-Type:application/json;charset=UTF-8',"Sign:$sign","Timestamp:$timeStamp","Api-Key:$apiKey");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_POSTFIELDS , $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$output = curl_exec($ch);
curl_close($ch);
var_dump($output);
RESPONSEEXAMPLE
{
"status": "0",
"reason": "success",
"data": 10912
}