Appearance
任务创建
请求信息
- 接口:
/agent-api/new/user/{user_id}/task - 请求方式:
POST
路由参数
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| user_id | string | 5832d184-dd53-42a0-8ace-0bf8d660f4cc | 用户 id(主账号) | 是 |
新版任务
请求示例(快速对接版)
cURL
curl -X POST "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"name": "新版大模型三点零外呼任务",
"destination_extension": "019d4e76-846a-73b1-8d65-2bcb54131961", // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 24167, // 呼叫时间组
"background_id": 51, // 背景音id
"enable_type": 2, // 任务外呼类型
"group_type": "voice_agent", // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
"task_extras": {
"start_time": "2026-05-01 13:25:26", // 开始时间 (必填)
"stop_time": "2027-05-01 13:25:26", // 结束时间
"line": [
{
"id": "68143ca3-0c09-4785-a9ba-cc4c850255b1", // 线路id
"limit": 1 // 最大并发
}
],
"holiday": [],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0 // 重呼配置(新2.0)
},
"task_type": 7 // 任务类型 6=2.0任务 7=新版2.0任务
}'Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task"
payload := map[string]interface{}{
"name": "新版大模型三点零外呼任务",
"destination_extension": "019d4e76-846a-73b1-8d65-2bcb54131961", // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 24167, // 呼叫时间组
"background_id": 51, // 背景音id
"enable_type": 2, // 任务外呼类型
"group_type": "voice_agent", // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
"task_extras": map[string]interface{}{
"start_time": "2026-05-01 13:25:26", // 开始时间 (必填)
"stop_time": "2027-05-01 13:25:26", // 结束时间
"line": []map[string]interface{}{
{
"id": "68143ca3-0c09-4785-a9ba-cc4c850255b1", // 线路id
"limit": 1, // 最大并发
},
},
"holiday": []map[string]interface{}{},
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0, // 重呼配置(新2.0)
},
"task_type": 7, // 任务类型 6=2.0任务 7=新版2.0任务
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}JavaScript
const axios = require('axios');
const data = {
name: '新版大模型三点零外呼任务',
destination_extension: '019d4e76-846a-73b1-8d65-2bcb54131961', // 话术分组id
maximumcall: 1, // 并发总数 (线路总并发)
dial_time_id: 24167, // 呼叫时间组
background_id: 51, // 背景音id
enable_type: 2, // 任务外呼类型
group_type: 'voice_agent', // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
task_extras: {
start_time: '2026-05-01 13:25:26', // 开始时间 (必填)
stop_time: '2027-05-01 13:25:26', // 结束时间
line: [
{
id: '68143ca3-0c09-4785-a9ba-cc4c850255b1', // 线路id
limit: 1 // 最大并发
}
],
holiday: [],
pop_mode: 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
redial_enabled: 0 // 重呼配置(新2.0)
},
task_type: 7 // 任务类型 6=2.0任务 7=新版2.0任务
};
axios.post('https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task', data, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task";
String json = """
{
"name": "新版大模型三点零外呼任务",
"destination_extension": "019d4e76-846a-73b1-8d65-2bcb54131961", // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 24167, // 呼叫时间组
"background_id": 51, // 背景音id
"enable_type": 2, // 任务外呼类型
"group_type": "voice_agent", // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
"task_extras": {
"start_time": "2026-05-01 13:25:26", // 开始时间 (必填)
"stop_time": "2027-05-01 13:25:26", // 结束时间
"line": [
{
"id": "68143ca3-0c09-4785-a9ba-cc4c850255b1", // 线路id
"limit": 1 // 最大并发
}
],
"holiday": [],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0 // 重呼配置(新2.0)
},
"task_type": 7 // 任务类型 6=2.0任务 7=新版2.0任务
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_TOKEN")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP
<?php
$url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task';
$data = [
'name' => '新版大模型三点零外呼任务',
'destination_extension' => '019d4e76-846a-73b1-8d65-2bcb54131961', // 话术分组id
'maximumcall' => 1, // 并发总数 (线路总并发)
'dial_time_id' => 24167, // 呼叫时间组
'background_id' => 51, // 背景音id
'enable_type' => 2, // 任务外呼类型
'group_type' => 'voice_agent', // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
'task_extras' => [
'start_time' => '2026-05-01 13:25:26', // 开始时间 (必填)
'stop_time' => '2027-05-01 13:25:26', // 结束时间
'line' => [
[
'id' => '68143ca3-0c09-4785-a9ba-cc4c850255b1', // 线路id
'limit' => 1 // 最大并发
]
],
'holiday' => [],
'pop_mode' => 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
'redial_enabled' => 0 // 重呼配置(新2.0)
],
'task_type' => 7 // 任务类型 6=2.0任务 7=新版2.0任务
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task'
data = {
'name': '新版大模型三点零外呼任务',
'destination_extension': '019d4e76-846a-73b1-8d65-2bcb54131961', # 话术分组id
'maximumcall': 1, # 并发总数 (线路总并发)
'dial_time_id': 24167, # 呼叫时间组
'background_id': 51, # 背景音id
'enable_type': 2, # 任务外呼类型
'group_type': 'voice_agent', # 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
'task_extras': {
'start_time': '2026-05-01 13:25:26', # 开始时间 (必填)
'stop_time': '2027-05-01 13:25:26', # 结束时间
'line': [
{
'id': '68143ca3-0c09-4785-a9ba-cc4c850255b1', # 线路id
'limit': 1 # 最大并发
}
],
'holiday': [],
'pop_mode': 1, # (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
'redial_enabled': 0 # 重呼配置(新2.0)
},
'task_type': 7 # 任务类型 6=2.0任务 7=新版2.0任务
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.post(url, json=data, headers=headers)
print(response.json())C++
#include <iostream>
#include <string>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string json_data = R"({
"name": "新版大模型三点零外呼任务",
"destination_extension": "019d4e76-846a-73b1-8d65-2bcb54131961", // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 24167, // 呼叫时间组
"background_id": 51, // 背景音id
"enable_type": 2, // 任务外呼类型
"group_type": "voice_agent", // 绑定外呼话术类型 group(常规NLP话术 大模型话术2.0) robot(常规2.0话术) voice_agent(大模型话术3.0)
"task_extras": {
"start_time": "2026-05-01 13:25:26", // 开始时间 (必填)
"stop_time": "2027-05-01 13:25:26", // 结束时间
"line": [
{
"id": "68143ca3-0c09-4785-a9ba-cc4c850255b1", // 线路id
"limit": 1 // 最大并发
}
],
"holiday": [],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0 // 重呼配置(新2.0)
},
"task_type": 7 // 任务类型 6=2.0任务 7=新版2.0任务
})";
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task");
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}请求示例(完整版)
cURL
curl -X POST "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 2, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_group_switch": 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间
"line": [ // 新版2.0-任务线路参数,无数据也需传递空数组
{
"id": "XXXXX", // 线路id
"limit": 2 // 最大并发
}
],
"destination_extension_list": [ // 新版2.0-AI对话模型-按时间配置
{
"begin": "09:00", // 开始时间
"end": "12:00", // 结束时间
"destination_extension": 123 // 该时间段内话术
}
],
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
"destination_extension_with_variable_list": [
{
"mode": 1, // 模式 0-包含任一关键词、1-等于任一关键词
"values": ["男", "男的"], // 关键词,最多10个,且不能有重复
"destination_extension": 11, // 使用话术组
"sort": 1 // 排序,排序越大优先级越低
},
{
"mode": 0,
"values": ["女", "女性"],
"destination_extension": 12,
"sort": 0
},
{
"mode": 0,
"values": ["未知"],
"destination_extension": 10,
"sort": 4
}
],
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0, // 重呼配置(新2.0)
"redial_new_number_policy": 0, // 首次外呼优先(新2.0)
"redial_interval": 3, // 重呼间隔(新2.0)
"redial_max_times": 3, // 重呼次数(新2.0)
"redial_conditions": { // 重呼条件(新2.0)
"da_status": [2, 3, 4, 6, 8, 9, 12] // 详情见请求参数
}
},
"task_type": 7, // 任务类型 6=2.0任务 7=新版2.0任务
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
}'Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task"
payload := map[string]interface{}{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 2, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_group_switch": 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
"task_extras": map[string]interface{}{
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间
"line": []map[string]interface{}{ // 新版2.0-任务线路参数,无数据也需传递空数组
{
"id": "XXXXX", // 线路id
"limit": 2, // 最大并发
},
},
"destination_extension_list": []map[string]interface{}{ // 新版2.0-AI对话模型-按时间配置
{
"begin": "09:00", // 开始时间
"end": "12:00", // 结束时间
"destination_extension": 123, // 该时间段内话术
},
},
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
"destination_extension_with_variable_list": []map[string]interface{}{
{
"mode": 1, // 模式 0-包含任一关键词、1-等于任一关键词
"values": []string{"男", "男的"}, // 关键词,最多10个,且不能有重复
"destination_extension": 11, // 使用话术组
"sort": 1, // 排序,排序越大优先级越低
},
{
"mode": 0,
"values": []string{"女", "女性"},
"destination_extension": 12,
"sort": 0,
},
{
"mode": 0,
"values": []string{"未知"},
"destination_extension": 10,
"sort": 4,
},
},
"holiday": []map[string]interface{}{ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25", // 结束时间
},
},
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0, // 重呼配置(新2.0)
"redial_new_number_policy": 0, // 首次外呼优先(新2.0)
"redial_interval": 3, // 重呼间隔(新2.0)
"redial_max_times": 3, // 重呼次数(新2.0)
"redial_conditions": map[string]interface{}{ // 重呼条件(新2.0)
"da_status": []int{2, 3, 4, 6, 8, 9, 12}, // 详情见请求参数
},
},
"task_type": 7, // 任务类型 6=2.0任务 7=新版2.0任务
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123, // 打分方案id
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}JavaScript
const axios = require('axios');
const data = {
name: '测试api接口创建-222',
destination_extension: 123, // 话术分组id
maximumcall: 2, // 并发总数 (线路总并发)
dial_time_id: 123, // 呼叫时间组
background_id: 123, // 背景音id 需要提供背景音列表等接口
is_group_switch: 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
task_extras: {
start_time: '2024-11-01 13:25:26', // 开始时间 (必填)
stop_time: '2025-11-01 13:25:26', // 结束时间
line: [ // 新版2.0-任务线路参数,无数据也需传递空数组
{
id: 'XXXXX', // 线路id
limit: 2 // 最大并发
}
],
destination_extension_list: [ // 新版2.0-AI对话模型-按时间配置
{
begin: '09:00', // 开始时间
end: '12:00', // 结束时间
destination_extension: 123 // 该时间段内话术
}
],
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
destination_extension_with_variable_list: [
{
mode: 1, // 模式 0-包含任一关键词、1-等于任一关键词
values: ['男', '男的'], // 关键词,最多10个,且不能有重复
destination_extension: 11, // 使用话术组
sort: 1 // 排序,排序越大优先级越低
},
{
mode: 0,
values: ['女', '女性'],
destination_extension: 12,
sort: 0
},
{
mode: 0,
values: ['未知'],
destination_extension: 10,
sort: 4
}
],
holiday: [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
begin: '2024-11-01 13:25', // 开始时间
end: '2024-11-03 13:25' // 结束时间
}
],
pop_mode: 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
redial_enabled: 0, // 重呼配置(新2.0)
redial_new_number_policy: 0, // 首次外呼优先(新2.0)
redial_interval: 3, // 重呼间隔(新2.0)
redial_max_times: 3, // 重呼次数(新2.0)
redial_conditions: { // 重呼条件(新2.0)
da_status: [2, 3, 4, 6, 8, 9, 12] // 详情见请求参数
}
},
task_type: 7, // 任务类型 6=2.0任务 7=新版2.0任务
llm_intention_id: "123", // 大模型质检id
score_scheme_id: 123 // 打分方案id
};
axios.post('https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task', data, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task";
String json = """
{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 2, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_group_switch": 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间
"line": [ // 新版2.0-任务线路参数,无数据也需传递空数组
{
"id": "XXXXX", // 线路id
"limit": 2 // 最大并发
}
],
"destination_extension_list": [ // 新版2.0-AI对话模型-按时间配置
{
"begin": "09:00", // 开始时间
"end": "12:00", // 结束时间
"destination_extension": 123 // 该时间段内话术
}
],
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
"destination_extension_with_variable_list": [
{
"mode": 1, // 模式 0-包含任一关键词、1-等于任一关键词
"values": ["男", "男的"], // 关键词,最多10个,且不能有重复
"destination_extension": 11, // 使用话术组
"sort": 1 // 排序,排序越大优先级越低
},
{
"mode": 0,
"values": ["女", "女性"],
"destination_extension": 12,
"sort": 0
},
{
"mode": 0,
"values": ["未知"],
"destination_extension": 10,
"sort": 4
}
],
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0, // 重呼配置(新2.0)
"redial_new_number_policy": 0, // 首次外呼优先(新2.0)
"redial_interval": 3, // 重呼间隔(新2.0)
"redial_max_times": 3, // 重呼次数(新2.0)
"redial_conditions": { // 重呼条件(新2.0)
"da_status": [2, 3, 4, 6, 8, 9, 12] // 详情见请求参数
}
},
"task_type": 7, // 任务类型 6=2.0任务 7=新版2.0任务
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_TOKEN")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP
<?php
$url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task';
$data = [
'name' => '测试api接口创建-222',
'destination_extension' => 123, // 话术分组id
'maximumcall' => 2, // 并发总数 (线路总并发)
'dial_time_id' => 123, // 呼叫时间组
'background_id' => 123, // 背景音id 需要提供背景音列表等接口
'is_group_switch' => 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
'task_extras' => [
'start_time' => '2024-11-01 13:25:26', // 开始时间 (必填)
'stop_time' => '2025-11-01 13:25:26', // 结束时间
'line' => [ // 新版2.0-任务线路参数,无数据也需传递空数组
[
'id' => 'XXXXX', // 线路id
'limit' => 2 // 最大并发
]
],
'destination_extension_list' => [ // 新版2.0-AI对话模型-按时间配置
[
'begin' => '09:00', // 开始时间
'end' => '12:00', // 结束时间
'destination_extension' => 123 // 该时间段内话术
]
],
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
'destination_extension_with_variable_list' => [
[
'mode' => 1, // 模式 0-包含任一关键词、1-等于任一关键词
'values' => ['男', '男的'], // 关键词,最多10个,且不能有重复
'destination_extension' => 11, // 使用话术组
'sort' => 1 // 排序,排序越大优先级越低
],
[
'mode' => 0,
'values' => ['女', '女性'],
'destination_extension' => 12,
'sort' => 0
],
[
'mode' => 0,
'values' => ['未知'],
'destination_extension' => 10,
'sort' => 4
]
],
'holiday' => [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
[
'begin' => '2024-11-01 13:25', // 开始时间
'end' => '2024-11-03 13:25' // 结束时间
]
],
'pop_mode' => 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
'redial_enabled' => 0, // 重呼配置(新2.0)
'redial_new_number_policy' => 0, // 首次外呼优先(新2.0)
'redial_interval' => 3, // 重呼间隔(新2.0)
'redial_max_times' => 3, // 重呼次数(新2.0)
'redial_conditions' => [ // 重呼条件(新2.0)
'da_status' => [2, 3, 4, 6, 8, 9, 12] // 详情见请求参数
]
],
'task_type' => 7, // 任务类型 6=2.0任务 7=新版2.0任务
'llm_intention_id' => "123", // 大模型质检id
'score_scheme_id' => 123 // 打分方案id
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task'
data = {
'name': '测试api接口创建-222',
'destination_extension': 123, # 话术分组id
'maximumcall': 2, # 并发总数 (线路总并发)
'dial_time_id': 123, # 呼叫时间组
'background_id': 123, # 背景音id 需要提供背景音列表等接口
'is_group_switch': 2, # 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
'task_extras': {
'start_time': '2024-11-01 13:25:26', # 开始时间 (必填)
'stop_time': '2025-11-01 13:25:26', # 结束时间
'line': [ # 新版2.0-任务线路参数,无数据也需传递空数组
{
'id': 'XXXXX', # 线路id
'limit': 2 # 最大并发
}
],
'destination_extension_list': [ # 新版2.0-AI对话模型-按时间配置
{
'begin': '09:00', # 开始时间
'end': '12:00', # 结束时间
'destination_extension': 123 # 该时间段内话术
}
],
# 变量话术组,is_group_switch为2(按号码变量配置)时必填
# 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
# 以下配置说明号码变量包含男,使用话术组ID:11
# 号码变量包含女,使用话术组12
# 号码变量其余值或者空,使用兜底话术组10
'destination_extension_with_variable_list': [
{
'mode': 1, # 模式 0-包含任一关键词、1-等于任一关键词
'values': ['男', '男的'], # 关键词,最多10个,且不能有重复
'destination_extension': 11, # 使用话术组
'sort': 1 # 排序,排序越大优先级越低
},
{
'mode': 0,
'values': ['女', '女性'],
'destination_extension': 12,
'sort': 0
},
{
'mode': 0,
'values': ['未知'],
'destination_extension': 10,
'sort': 4
}
],
'holiday': [ # 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
'begin': '2024-11-01 13:25', # 开始时间
'end': '2024-11-03 13:25' # 结束时间
}
],
'pop_mode': 1, # (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
'redial_enabled': 0, # 重呼配置(新2.0)
'redial_new_number_policy': 0, # 首次外呼优先(新2.0)
'redial_interval': 3, # 重呼间隔(新2.0)
'redial_max_times': 3, # 重呼次数(新2.0)
'redial_conditions': { # 重呼条件(新2.0)
'da_status': [2, 3, 4, 6, 8, 9, 12] # 详情见请求参数
}
},
'task_type': 7, # 任务类型 6=2.0任务 7=新版2.0任务
'llm_intention_id': "123", # 大模型质检id
'score_scheme_id': 123 # 打分方案id
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.post(url, json=data, headers=headers)
print(response.json())C++
#include <iostream>
#include <string>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string json_data = R"({
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 2, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_group_switch": 2, // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间
"line": [ // 新版2.0-任务线路参数,无数据也需传递空数组
{
"id": "XXXXX", // 线路id
"limit": 2 // 最大并发
}
],
"destination_extension_list": [ // 新版2.0-AI对话模型-按时间配置
{
"begin": "09:00", // 开始时间
"end": "12:00", // 结束时间
"destination_extension": 123 // 该时间段内话术
}
],
// 变量话术组,is_group_switch为2(按号码变量配置)时必填
// 可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
// 以下配置说明号码变量包含男,使用话术组ID:11
// 号码变量包含女,使用话术组12
// 号码变量其余值或者空,使用兜底话术组10
"destination_extension_with_variable_list": [
{
"mode": 1, // 模式 0-包含任一关键词、1-等于任一关键词
"values": ["男", "男的"], // 关键词,最多10个,且不能有重复
"destination_extension": 11, // 使用话术组
"sort": 1 // 排序,排序越大优先级越低
},
{
"mode": 0,
"values": ["女", "女性"],
"destination_extension": 12,
"sort": 0
},
{
"mode": 0,
"values": ["未知"],
"destination_extension": 10,
"sort": 4
}
],
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"pop_mode": 1, // (新2.0必填)弹出模式 0-随机弹出(默认) 1-顺序弹出 2-倒序弹出
"redial_enabled": 0, // 重呼配置(新2.0)
"redial_new_number_policy": 0, // 首次外呼优先(新2.0)
"redial_interval": 3, // 重呼间隔(新2.0)
"redial_max_times": 3, // 重呼次数(新2.0)
"redial_conditions": { // 重呼条件(新2.0)
"da_status": [2, 3, 4, 6, 8, 9, 12] // 详情见请求参数
}
},
"task_type": 7, // 任务类型 6=2.0任务 7=新版2.0任务
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
})";
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task");
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}参数说明
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| sub_user_id | string | 5b55bcca-d653-4a58-8f9a-437fb0601f8e | 子账户id (传递此参数则是对子账户操作) | 否 |
| bridge_group_id | int | 1 | 使用转接组的id 不传这个键,则表示为空。传了则必填 | 否 |
| destination_extension | int/string | 297 或 "019d4e76-846a-73b1-8d65-2bcb54131961" | 话术分组id(大模型3.0可使用UUID格式) | 是 |
| is_group_switch | int | 1 | 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置 | 否 |
| dial_time_id | int | 5 | 呼叫时间组ID | 是 |
| maximumcall | int | 1 | 并发总数(线路总并发) | 是 |
| name | string | 测试任务 | 任务名称 | 是 |
| enable_type | int | 2 | 任务外呼类型 0:常规 1:大模型 2:大模型3.0 | 否 |
| group_type | string | group | 任务绑定话术组类型(默认group) group:常规NLP话术/大模型话术2.0 robot:常规2.0话术 voice_agent:大模型话术3.0 | 否 |
| task_type | int | 7 | 创建任务类型 6:2.0任务(默认) 7:新版2.0任务 | 否 |
| is_call_in | int | 0 | 任务呼入开关(默认为0) 0:外呼 1:呼入 | 否 |
| remark | string | 测试任务描述 | 任务描述 | 否 |
| end_action | int | 1 | 任务结束动作 0:无操作 1:暂停任务释放并发 | 否 |
| background_id | int | 25 | 背景音id | 否 |
| llm_intention_id | string | "1" | 大模型质检id | 否 |
| score_scheme_id | int | 1 | 打分方案id | 否 |
| new_call_rules | array | 2.0任务重呼配置信息 | 否 | |
| new_call_rules.*.re_call_time | date | 10:00:00 | 重呼执行时间 (时间范围10-11 13-22) | 否 |
| new_call_rules.*.call_interval | int | 60 | 呼叫间隔时间(单位:分钟) | 否 |
| new_call_rules.*.rule_id | int | 15486 | 重呼规则id | 否 |
| task_extras. | array | 2.0 任务配置信息 | 是 | |
| task_extras.start_time | string | 2024/11/1 13:25 | 任务开始时间 | 是 |
| task_extras.stop_time | string | 2025/11/1 13:25 | 任务结束时间 | 是 |
| task_extras.holiday | array | [{"start": "2024-11-01 13:25","end": "2024-11-03 13:25"}] | 任务假期休息时间,不传也需要传空数组值 | 否 |
| task_extras.line | array | [{"id": "29c39ec4-b292-4af9-a88b-922d61866sub", "limit": 1}] | 线路配置(任务初始化接口获取),line参数除外,不传线路也需传递空数组 | 是 |
| task_extras.interval_time | int | 0 | 呼叫时间间隔(默认为0) | 否 |
| task_extras.destination_extension_list | array | [{"begin": "09:00","end":"12:00","destination_extension": "215870475195883520"}] | AI对话模型-按时间配置 | 否 |
| task_extras.destination_extension_with_variable_list | array | [{"mode":1,"values":["男","男的"],"destination_extension":11,"sort":1}] | AI对话模型-按号码变量配置,is_group_switch为2时必填 | 否 |
| task_extras.destination_extension_multi_config | object | {"dial_mode": 0,"list": [{"destination_extension": "13601","sort": 1},{"destination_extension": "13716","sort": 2}]} | AI对话模型-多项外呼话术组配置,is_group_switch为3时必填 | 否 |
| task_extras.pop_mode | int | 0 | 弹出模式:0=随机 1=顺序 2=倒序 | 是 |
| task_extras.redial_enabled | bool | 1 | 重呼配置 | 是 |
| task_extras.redial_new_number_policy | bool | 1 | 首次外呼优先(开启则外呼过程中始终优先外呼自动重拨次数为0的号码) | 否 |
| task_extras.redial_interval | int | 3 | 重呼间隔,最多60分钟 | 否 |
| task_extras.redial_max_times | int | 3 | 重呼次数,最多3次 | 否 |
| task_extras.redial_conditions.da_status | array | [2, 3, 4, 6, 8, 9, 12] | 重呼状态:2=运营商拦截 3=拒接 4=无应答、无人接听 5=空号 6=关机 7=停机 8=占线、用户在忙 9=呼入限制 10=欠费 12=用户屏蔽 | 否 |
| task_extras.redial_conditions.pop_mode | int | 0 | 弹出模式:0=随机 1=顺序 2=倒序 | 是 |
旧版任务
请求示例
cURL
curl -X POST "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_call_in": 0, // 呼出呼入开关
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间 (必填)
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"line": ["xxxx"], // line参数除外,不传线路,也需传递空数组
"interval_time": 0 // 呼叫间隔 (选填,默认为 0)
},
"new_call_rules": [ // 任务重呼配置信息
{
"re_call_time": "10:00:00", // 重呼执行时间
"call_interval": 60, // 呼叫间隔时间(单位:分钟)
"rule_id": 123 // 重呼规则id
},
{
"re_call_time": "11:00:00",
"call_interval": 60,
"rule_id": 123
}
],
"group_switch_rule": [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
"switch_start": "09:00", // 开始时间
"switch_end": "12:00", // 结束时间
"group_id": 123, // 时间段话术
"default_group_id": 123 // 默认配置话术
}
],
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
}'Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task"
payload := map[string]interface{}{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_call_in": 0, // 呼出呼入开关
"task_extras": map[string]interface{}{
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间 (必填)
"holiday": []map[string]interface{}{ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25", // 结束时间
},
},
"line": []string{"xxxx"}, // line参数除外,不传线路,也需传递空数组
"interval_time": 0, // 呼叫间隔 (选填,默认为 0)
},
"new_call_rules": []map[string]interface{}{ // 任务重呼配置信息
{
"re_call_time": "10:00:00", // 重呼执行时间
"call_interval": 60, // 呼叫间隔时间(单位:分钟)
"rule_id": 123, // 重呼规则id
},
{
"re_call_time": "11:00:00",
"call_interval": 60,
"rule_id": 123,
},
},
"group_switch_rule": []map[string]interface{}{ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
"switch_start": "09:00", // 开始时间
"switch_end": "12:00", // 结束时间
"group_id": 123, // 时间段话术
"default_group_id": 123, // 默认配置话术
},
},
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123, // 打分方案id
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}JavaScript
const axios = require('axios');
const data = {
name: '测试api接口创建-222',
destination_extension: 123, // 话术分组id
maximumcall: 1, // 并发总数 (线路总并发)
dial_time_id: 123, // 呼叫时间组
background_id: 123, // 背景音id 需要提供背景音列表等接口
is_call_in: 0, // 呼出呼入开关
task_extras: {
start_time: '2024-11-01 13:25:26', // 开始时间 (必填)
stop_time: '2025-11-01 13:25:26', // 结束时间 (必填)
holiday: [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
begin: '2024-11-01 13:25', // 开始时间
end: '2024-11-03 13:25' // 结束时间
}
],
line: ['xxxx'], // line参数除外,不传线路,也需传递空数组
interval_time: 0 // 呼叫间隔 (选填,默认为 0)
},
new_call_rules: [ // 任务重呼配置信息
{
re_call_time: '10:00:00', // 重呼执行时间
call_interval: 60, // 呼叫间隔时间(单位:分钟)
rule_id: 123 // 重呼规则id
},
{
re_call_time: '11:00:00',
call_interval: 60,
rule_id: 123
}
],
group_switch_rule: [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
switch_start: '09:00', // 开始时间
switch_end: '12:00', // 结束时间
group_id: 123, // 时间段话术
default_group_id: 123 // 默认配置话术
}
],
llm_intention_id: "123", // 大模型质检id
score_scheme_id: 123 // 打分方案id
};
axios.post('https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task', data, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task";
String json = """
{
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_call_in": 0, // 呼出呼入开关
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间 (必填)
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"line": ["xxxx"], // line参数除外,不传线路,也需传递空数组
"interval_time": 0 // 呼叫间隔 (选填,默认为 0)
},
"new_call_rules": [ // 任务重呼配置信息
{
"re_call_time": "10:00:00", // 重呼执行时间
"call_interval": 60, // 呼叫间隔时间(单位:分钟)
"rule_id": 123 // 重呼规则id
},
{
"re_call_time": "11:00:00",
"call_interval": 60,
"rule_id": 123
}
],
"group_switch_rule": [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
"switch_start": "09:00", // 开始时间
"switch_end": "12:00", // 结束时间
"group_id": 123, // 时间段话术
"default_group_id": 123 // 默认配置话术
}
],
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_TOKEN")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP
<?php
$url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task';
$data = [
'name' => '测试api接口创建-222',
'destination_extension' => 123, // 话术分组id
'maximumcall' => 1, // 并发总数 (线路总并发)
'dial_time_id' => 123, // 呼叫时间组
'background_id' => 123, // 背景音id 需要提供背景音列表等接口
'is_call_in' => 0, // 呼出呼入开关
'task_extras' => [
'start_time' => '2024-11-01 13:25:26', // 开始时间 (必填)
'stop_time' => '2025-11-01 13:25:26', // 结束时间 (必填)
'holiday' => [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
[
'begin' => '2024-11-01 13:25', // 开始时间
'end' => '2024-11-03 13:25' // 结束时间
]
],
'line' => ['xxxx'], // line参数除外,不传线路,也需传递空数组
'interval_time' => 0 // 呼叫间隔 (选填,默认为 0)
],
'new_call_rules' => [ // 任务重呼配置信息
[
're_call_time' => '10:00:00', // 重呼执行时间
'call_interval' => 60, // 呼叫间隔时间(单位:分钟)
'rule_id' => 123 // 重呼规则id
],
[
're_call_time' => '11:00:00',
'call_interval' => 60,
'rule_id' => 123
]
],
'group_switch_rule' => [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
[
'switch_start' => '09:00', // 开始时间
'switch_end' => '12:00', // 结束时间
'group_id' => 123, // 时间段话术
'default_group_id' => 123 // 默认配置话术
]
],
'llm_intention_id' => "123", // 大模型质检id
'score_scheme_id' => 123 // 打分方案id
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer YOUR_TOKEN'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
url = 'https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task'
data = {
'name': '测试api接口创建-222',
'destination_extension': 123, # 话术分组id
'maximumcall': 1, # 并发总数 (线路总并发)
'dial_time_id': 123, # 呼叫时间组
'background_id': 123, # 背景音id 需要提供背景音列表等接口
'is_call_in': 0, # 呼出呼入开关
'task_extras': {
'start_time': '2024-11-01 13:25:26', # 开始时间 (必填)
'stop_time': '2025-11-01 13:25:26', # 结束时间 (必填)
'holiday': [ # 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
'begin': '2024-11-01 13:25', # 开始时间
'end': '2024-11-03 13:25' # 结束时间
}
],
'line': ['xxxx'], # line参数除外,不传线路,也需传递空数组
'interval_time': 0 # 呼叫间隔 (选填,默认为 0)
},
'new_call_rules': [ # 任务重呼配置信息
{
're_call_time': '10:00:00', # 重呼执行时间
'call_interval': 60, # 呼叫间隔时间(单位:分钟)
'rule_id': 123 # 重呼规则id
},
{
're_call_time': '11:00:00',
'call_interval': 60,
'rule_id': 123
}
],
'group_switch_rule': [ # 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
'switch_start': '09:00', # 开始时间
'switch_end': '12:00', # 结束时间
'group_id': 123, # 时间段话术
'default_group_id': 123 # 默认配置话术
}
],
'llm_intention_id': "123", # 大模型质检id
'score_scheme_id': 123 # 打分方案id
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
response = requests.post(url, json=data, headers=headers)
print(response.json())C++
#include <iostream>
#include <string>
#include <curl/curl.h>
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if(curl) {
std::string json_data = R"({
"name": "测试api接口创建-222",
"destination_extension": 123, // 话术分组id
"maximumcall": 1, // 并发总数 (线路总并发)
"dial_time_id": 123, // 呼叫时间组
"background_id": 123, // 背景音id 需要提供背景音列表等接口
"is_call_in": 0, // 呼出呼入开关
"task_extras": {
"start_time": "2024-11-01 13:25:26", // 开始时间 (必填)
"stop_time": "2025-11-01 13:25:26", // 结束时间 (必填)
"holiday": [ // 假期时间 (选填)可设置多个 (如果不传,也需传递空数组)
{
"begin": "2024-11-01 13:25", // 开始时间
"end": "2024-11-03 13:25" // 结束时间
}
],
"line": ["xxxx"], // line参数除外,不传线路,也需传递空数组
"interval_time": 0 // 呼叫间隔 (选填,默认为 0)
},
"new_call_rules": [ // 任务重呼配置信息
{
"re_call_time": "10:00:00", // 重呼执行时间
"call_interval": 60, // 呼叫间隔时间(单位:分钟)
"rule_id": 123 // 重呼规则id
},
{
"re_call_time": "11:00:00",
"call_interval": 60,
"rule_id": 123
}
],
"group_switch_rule": [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
{
"switch_start": "09:00", // 开始时间
"switch_end": "12:00", // 结束时间
"group_id": 123, // 时间段话术
"default_group_id": 123 // 默认配置话术
}
],
"llm_intention_id": "123", // 大模型质检id
"score_scheme_id": 123 // 打分方案id
})";
curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task");
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_TOKEN");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
std::cout << readBuffer << std::endl;
}
return 0;
}参数说明
| 参数 | 类型 | 示例 | 解释 | 必填 |
|---|---|---|---|---|
| sub_user_id | string | 5b55bcca-d653-4a58-8f9a-437fb0601f8e | 子账户id (传递此参数则是对子账户操作) | 否 |
| bridge_group_id | int | 1 | 使用转接组的id 不传这个键,则表示为空。传了则必填 | 否 |
| destination_extension | int | 297 | 话术分组id | 是 |
| is_group_switch | int | 1 | 话术配置类型 0-统一配置 1-按时间配置 | 否 |
| dial_time_id | int | 5 | 呼叫时间组ID | 是 |
| maximumcall | int | 1 | 并发总数(线路总并发) | 是 |
| name | string | 测试任务 | 任务名称 | 是 |
| enable_type | int | 0 | 任务类型(默认为0) 0:常规 1:大模型 | 否 |
| group_type | string | group | 任务绑定话术组类型(默认group) group:1.0话术 robot:2.0话术 voice_agent:大模型3.0话术 | 否 |
| task_type | int | 6 | 创建任务类型 6:2.0任务(默认) | 否 |
| is_call_in | int | 0 | 任务呼入开关(默认为0) 0:外呼 1:呼入 | 否 |
| remark | string | 测试任务描述 | 任务描述 | 否 |
| end_action | int | 1 | 任务结束动作 0:无操作 1:暂停任务释放并发 | 否 |
| background_id | int | 25 | 背景音id | 否 |
| llm_intention_id | string | "1" | 大模型质检id | 否 |
| score_scheme_id | int | 1 | 打分方案id | 否 |
| new_call_rules | array | 2.0任务重呼配置信息 | 否 | |
| new_call_rules.*.re_call_time | date | 10:00:00 | 重呼执行时间 (时间范围10-11 13-22) | 否 |
| new_call_rules.*.call_interval | int | 60 | 呼叫间隔时间(单位:分钟) | 否 |
| new_call_rules.*.rule_id | int | 15486 | 重呼规则id | 否 |
| task_extras. | array | 2.0 任务配置信息 | 是 | |
| task_extras.start_time | string | 2024/11/1 13:25 | 任务开始时间 | 是 |
| task_extras.stop_time | string | 2025/11/1 13:25 | 任务结束时间 | 是 |
| task_extras.holiday | array | [{"start": "2024-11-01 13:25","end": "2024-11-03 13:25"}] | 任务假期休息时间,不传也需要传空数组值 | 否 |
| task_extras.line | array | ["29c39ec4-b292-4af9-a88b-922d61866sub"] | 线路id(任务初始化接口获取),不传也需要传空数组值 | 是 |
| task_extras.interval_time | int | 0 | 呼叫时间间隔(默认为0) | 否 |
返回参数
json
{
"code": 200,
"status": "success",
"message": "创建任务成功",
"data": {
"id": "ec33b068-4aa1-40da-abe5-8f411b6f88d5"
}
}注意事项
maximumcall为所选线路的总并发数,每条所选线路使用的并发为平均并发数如果
task_extras.line值为空数组,那任务并发参数maximumcall值也需要为0除了必填以外,不用的参数可以不传 (例如:
line和holiday参数除外,不传线路信息也需传递空数组)为了方便2.0外呼任务,可使用旧时间组 (
dial_time_id),进行创建或更新2.0任务操作,但时间组中工作时间的更新,目前并未与使用其的任务同步任务绑定的是1.0话术 (
group_type:group) 时,受线路用途(usage)影响;任务绑定的是2.0话术(group_type:robot)时,暂时不受线路用途(usage)影响,2.0话术 id 需要在初始化接口中的outbound_group_v2中获取。外呼与呼入同理,具体如下:- 绑定的话术组 id 是初始化接口
outbound_group中的主键 id,那么绑定的线路 id 的用途(usage)值可以是1、3、5、7。 - 绑定的话术组 id 是初始化接口
big_model_outbound_group中的主键 id,且端到端开关(llm_end_type)值为0,那么绑定的线路 id 的用途(usage)值应为2、3、6、7。 - 绑定的话术组 id 是初始化接口
big_model_outbound_group中的主键 id,且端到端开关(llm_end_type)值为1,那么绑定的线路 id 的用途(usage)值应为4、5、6、7。
- 绑定的话术组 id 是初始化接口