Modify AI Outbound Task

POST

https://api.itniotech.com/aivoice/taskEdit

Modify AI outbound task.
Request Parameters
Parameters Description Required Type
appId Application id Yes String
name Task name Yes String
jobId Task ID Yes Long
dialogFlowId Script ID Yes Int
mode There are two ways to start a task. MANUAL is manual startup, which requires calling the startup task interface or manually starting a task on the interface. AUTO is automatic startup, which requires setting the task start time (startTime) to automatically start when creating a task. Yes String
startDateTime Task auto-start date. This field is required only when the task start mode is AUTO. It is not required and is invalid in other periods. For example, "2021-12-22 00:00:00" No String
endDateTime Outbound call end time, such as "2022-02-07 10:00:00" No String
dailyStartDateTime The dialed start time, such as "09:00", which cannot be earlier than 9:00 by default Yes String
dailyEndDateTime The dialed end time, such as "20:00", which can be no later than 20:00 by default Yes String
robotCount AI concurrency used by tasks Yes Int
jobPhoneNumberId Line ID Yes Int
inactiveTimeList Inactive time period, such as: [{"startTime":"12:00", "endTime":"13:00"}, {"startTime":"14:00", "endTime":"15:00"}, {"startTime":"16:00", "endTime":"17:00"}] No Array
inactiveDateList Inactive dial date, such as: [{"startDate":"2022-02-05","endDate":"2022-02-07"}, {"startDate":"2022-02-08","endDate":"2022-02-09"}, {"startDate":"2022-02-10","endDate":"2022-02-11"}] No Array
daysOfWeek Weekly dial time, such as: ["MONDAY","TUESDAY"] No Array
redial Whether to redial Yes Boolean
redialCondition Redial rules. This parameter is used to set automatic Redial and specify automatic Redial conditions. Only customers meeting this condition will perform automatic Redial. Redial conditions can be divided into: ( CALL_LOSS, "Call Loss Customer" ), ( NO_ANSWER, "No Answer" ), ( BUSY, "Busy Line" ), ( REFUSED, "Rejected" ), ( POWER_OFF, "Shutdown" ), ( OUT_OF_SERVICE, "Shutdown" ), ( CAN_NOT_CONNECT, "Cannot Connect" ), ( FROM_PHONE_ERROR, "Caller Arrears" ), ( SYSTEM_ERROR, "outbound call failed" ), ( VACANT_NUMBER, "empty number ") For example: ["CALL_LOSS", "NO_ANSWER"] No Array
redialInterval Redial interval, in minutes, the maximum value is 1440 No Int
redialTimes Redial times (1~3) interval No Int
Request Sample
Request URL:
    https://api.itniotech.com/aivoice/taskEdit
Request Method:
    POST
Request Headers:
    Content-Type: application/json;charset=UTF-8
    Sign: 05d7a50893e22a5c4bb3216ae3396c7c
    Timestamp: 1630468800
    Api-Key: bD8JFiq9
Request Body:
{
    "appId":"LILIN888",
    "jobId":123,
    "name":"lilinname2",
    "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"
}
Response Parameters
Parameters Description Type
status "0"means successful, others than 0 means failure, seeing Status code description String
reason Failure Reason Description String
data Task id Long
Response Status Code
status Description
0 Success
-1 Authentication error
-3 The customer's balance is insufficient
-4 Timestamp expires
-5 Port program unusual
-6 Restricted IP access
-27 Abnormal parameter verification
-28 Automatic mode, the task start time cannot be empty
-29 Replay rule parameters abnormality
-30 Replay abnormal interval parameters
-31 Abnormal replayed on parameters
-33 Outbound task name already exists
-37 Application does not exist
-38 The current task cannot be paused
-39 The current task cannot be started
-41 ID parameter abnormal
-45 Not import customer,Can't start
-46 Network exception or parameter error
-48 Create a daily dial-up task between 9:00-20:00
-49 Account not authenticated
-51 Customer custom property is incomplete
-52 The number of concurrent requests exceeds the upper limit
-57 The Sign cannot be empty
-58 The Timestamp cannot be empty
-59 The Api-Key cannot be empty
-60 Intent level tag not found

language

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 taskEdit() {
    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 = "your task name"; //Task name
    final Integer jobId = 1000; //Job ID
    final Integer dialogFlowId = 8553; //Script ID
    final String mode = "AUTO"; //Task start method
    final String startDateTime = "2023-09-16 00: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("/taskEdit");
    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("jobId", jobId)
            .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/taskEdit";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);

$dataArr['appId'] = $appId;
$dataArr["jobId"] = 1000;
$dataArr["name"] = "your 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-16 00: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": null
}