短信
语音
智能OTP
邮件
智能语音
向任务中导入客户
参数 | 说明 | 是否必填 | 类型 |
---|---|---|---|
appId | 应用id | 是 | String |
jobId | 任务id | 是 | Long |
callRecordDup | 是否已呼列表去重,默认false | 否 | Boolean |
customerPersons | 导入客户列表,最多支持导入100条 | 是 | Array |
name | 客户名称 | 是 | String |
phoneNumber | 客户电话,如果是加密场景传加密id即可,长度不超过32个字符,如13000000001 | 是 | String |
gender | 性别,MALE:男 FEMALE:女,空值传null,不要传空字符串 | 否 | String |
properties | 自定义变量,可以在此处加上调用方的业务信息,在回调时会完整回传,该字段在话术或者短信中存在变量时必填,其他时候非必填。 如:{ "姓名":"张三","证件后4位":"0235" } | 否 | Map |
Request URL:
https://api.itniotech.com/aivoice/importCustomer
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bD8JFiq9
Request Body:
{
"appId":"LILIN888",
"jobId":9,
"customerPersons":[
{
"name":"starai",
"phoneNumber":"91856321412",
"properties": {
"证件后4位":"0235",
"与本人关系":"朋友",
"工作名称":"a",
"住所地址":"abc",
}
},
{
"name":"starai2",
"phoneNumber":"91856321413",
"properties": {
"证件后4位":"0235",
"与本人关系":"朋友",
"工作名称":"a",
"住所地址":"abc",
}
}
]
}
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见状态码说明 | String |
reason | 失败原因说明 | String |
data | 导入失败的数据 | Array |
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 账号认证异常 |
-4 | 时间戳过期 |
-6 | ip限制 |
-27 | 参数校验异常 |
-32 | 外呼任务不存在 |
-35 | 客户信息导入失败 |
-37 | 应用不存在 |
-43 | 费率不存在 |
-49 | 账号未认证 |
-55 | 话术解绑不允许此类操作 |
-56 | 超出导入限制,最多支持导入100条用户 |
-57 | 签名不能为空 |
-58 | 时间戳不能为空 |
-59 | apikey不能为空 |
意见反馈
文档内容是否对您有帮助?
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 importCustomer() {
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 Integer jobId = 1000; //Your job ID
//Custom variable
final Map properties = new HashMap();
properties.put("income", 3000);
properties.put("IDCard", "1234");
properties.put("relation", "friend");
properties.put("name", "Jack");
HashMap customerPersons = new HashMap<>();
customerPersons.put("name","Jack"); //Customer Name
customerPersons.put("phoneNumber","13000000000"); //Dial phone number
customerPersons.put("properties",properties); //Custom variable
final String url = baseUrl.concat("/importCustomer");
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("customerPersons", Arrays.asList(customerPersons))
.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/importCustomer";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$dataArr["appId"] = $appId;
$dataArr["jobId"] = 1000;
$dataArr["customerPersons"] = array(
array(
"name" => "Jack",
"phoneNumber" => "13000000000",
"properties" => array(
"income" => "3000",
"IDCard" => "1234",
"relation" => "friend",
"name" => "Jack"
)
)
);
$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": [
"The customer already exists in this task,Phone Number:13612345678",
"The customer already exists in this task,Phone Number:13512345678",
"Customer custom property is incomplete,Phone Number:13412345678"
]
}