Skip to content

任务修改

请求信息

  • 接口: /agent-api/new/user/{user_id}/task/{task_id}
  • 请求方式: PUT

路由参数

参数类型示例解释必填
user_idstring5832d184-dd53-42a0-8ace-0bf8d660f4cc用户 id(主账号)
task_idstringf232d184-dd54-42a0-8ace-0bf8d660f4cc任务 id

新版任务2.0

请求示例

cURL
curl -X PUT "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "name": "测试api接口创建-222",
    "group_type": "group",
    "destination_extension": 123,
    "is_group_switch": 1,
    "group_switch_rule": [
        {
            "switch_start": "09:00",
            "switch_end": "12:00",
            "group_id": 13037,
            "default_group_id": 123
        }
    ],
    "maximumcall": 2,
    "dial_time_id": 123,
    "background_id": 123,
    "task_extras": {
        "start_time": "2024-12-23 19:00:00",
        "stop_time": "2025-12-25 23:59:59",
        "line": [
            {
                "id": "d47c3599-f166-4cd0-999c-f60e46814d26",
                "limit": 2
            }
        ],
        "destination_extension_list": [
            {
                "begin": "09:00",
                "end": "12:00",
                "destination_extension": 123
            }
        ],
        "destination_extension_with_variable_list": [
            {
                "mode": 1,
                "values": ["男", "男的"],
                "destination_extension": 11,
                "sort": 1
            },
            {
                "mode": 0,
                "values": ["女", "女性"],
                "destination_extension": 12,
                "sort": 0
            },
            {
                "mode": 0,
                "values": ["未知"],
                "destination_extension": 10,
                "sort": 4
            }
        ],
        "holiday": [],
        "work_hour": [],
        "work_week": [],
        "pop_mode": 1,
        "redial_enabled": 0,
        "redial_new_number_policy": 0,
        "redial_interval": 3,
        "redial_max_times": 3,
        "redial_conditions": {
            "da_status": [2, 3, 4, 6, 8, 9, 12]
        }
    },
    "task_type": 7,
    "llm_intention_id": 123,
    "score_scheme_id": 123
}'
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/f232d184-dd54-42a0-8ace-0bf8d660f4cc"

    payload := map[string]interface{}{
        "name":                  "测试api接口创建-222",
        "group_type":            "group",
        "destination_extension": 123,
        "is_group_switch":       1,
        "maximumcall":           2,
        "dial_time_id":          123,
        "background_id":         123,
        "task_type":             7,
        "llm_intention_id":      123,
        "score_scheme_id":       123,
        "task_extras": map[string]interface{}{
            "start_time": "2024-12-23 19:00:00",
            "stop_time":  "2025-12-25 23:59:59",
            "line": []map[string]interface{}{
                {
                    "id":    "d47c3599-f166-4cd0-999c-f60e46814d26",
                    "limit": 2,
                },
            },
            "destination_extension_list": []map[string]interface{}{
                {
                    "begin":                "09:00",
                    "end":                  "12:00",
                    "destination_extension": 123,
                },
            },
            "destination_extension_with_variable_list": []map[string]interface{}{
                {
                    "mode":                 1,
                    "values":               []string{"男", "男的"},
                    "destination_extension": 11,
                    "sort":                 1,
                },
            },
            "holiday":                 []interface{}{},
            "work_hour":               []interface{}{},
            "work_week":               []interface{}{},
            "pop_mode":                1,
            "redial_enabled":          0,
            "redial_new_number_policy": 0,
            "redial_interval":         3,
            "redial_max_times":        3,
            "redial_conditions": map[string]interface{}{
                "da_status": []int{2, 3, 4, 6, 8, 9, 12},
            },
        },
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("PUT", 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',
    group_type: 'group',
    destination_extension: 123,
    is_group_switch: 1,
    maximumcall: 2,
    dial_time_id: 123,
    background_id: 123,
    task_type: 7,
    llm_intention_id: 123,
    score_scheme_id: 123,
    task_extras: {
        start_time: '2024-12-23 19:00:00',
        stop_time: '2025-12-25 23:59:59',
        line: [
            {
                id: 'd47c3599-f166-4cd0-999c-f60e46814d26',
                limit: 2
            }
        ],
        destination_extension_list: [
            {
                begin: '09:00',
                end: '12:00',
                destination_extension: 123
            }
        ],
        destination_extension_with_variable_list: [
            {
                mode: 1,
                values: ['男', '男的'],
                destination_extension: 11,
                sort: 1
            }
        ],
        holiday: [],
        work_hour: [],
        work_week: [],
        pop_mode: 1,
        redial_enabled: 0,
        redial_new_number_policy: 0,
        redial_interval: 3,
        redial_max_times: 3,
        redial_conditions: {
            da_status: [2, 3, 4, 6, 8, 9, 12]
        }
    }
};

axios.put('https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc', 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/f232d184-dd54-42a0-8ace-0bf8d660f4cc";
        String json = """
            {
                "name": "测试api接口创建-222",
                "group_type": "group",
                "destination_extension": 123,
                "is_group_switch": 1,
                "maximumcall": 2,
                "dial_time_id": 123,
                "background_id": 123,
                "task_type": 7,
                "llm_intention_id": 123,
                "score_scheme_id": 123,
                "task_extras": {
                    "start_time": "2024-12-23 19:00:00",
                    "stop_time": "2025-12-25 23:59:59",
                    "line": [{"id": "d47c3599-f166-4cd0-999c-f60e46814d26", "limit": 2}],
                    "destination_extension_list": [{"begin": "09:00", "end": "12:00", "destination_extension": 123}],
                    "holiday": [],
                    "pop_mode": 1,
                    "redial_enabled": 0,
                    "redial_new_number_policy": 0,
                    "redial_interval": 3,
                    "redial_max_times": 3,
                    "redial_conditions": {"da_status": [2, 3, 4, 6, 8, 9, 12]}
                }
            }
            """;

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer YOUR_TOKEN")
                .PUT(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/f232d184-dd54-42a0-8ace-0bf8d660f4cc';

$data = [
    'name' => '测试api接口创建-222',
    'group_type' => 'group',
    'destination_extension' => 123,
    'is_group_switch' => 1,
    'maximumcall' => 2,
    'dial_time_id' => 123,
    'background_id' => 123,
    'task_type' => 7,
    'llm_intention_id' => 123,
    'score_scheme_id' => 123,
    'task_extras' => [
        'start_time' => '2024-12-23 19:00:00',
        'stop_time' => '2025-12-25 23:59:59',
        'line' => [
            ['id' => 'd47c3599-f166-4cd0-999c-f60e46814d26', 'limit' => 2]
        ],
        'destination_extension_list' => [
            ['begin' => '09:00', 'end' => '12:00', 'destination_extension' => 123]
        ],
        'holiday' => [],
        'pop_mode' => 1,
        'redial_enabled' => 0,
        'redial_new_number_policy' => 0,
        'redial_interval' => 3,
        'redial_max_times' => 3,
        'redial_conditions' => [
            'da_status' => [2, 3, 4, 6, 8, 9, 12]
        ]
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
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/f232d184-dd54-42a0-8ace-0bf8d660f4cc'

data = {
    'name': '测试api接口创建-222',
    'group_type': 'group',
    'destination_extension': 123,
    'is_group_switch': 1,
    'maximumcall': 2,
    'dial_time_id': 123,
    'background_id': 123,
    'task_type': 7,
    'llm_intention_id': 123,
    'score_scheme_id': 123,
    'task_extras': {
        'start_time': '2024-12-23 19:00:00',
        'stop_time': '2025-12-25 23:59:59',
        'line': [
            {'id': 'd47c3599-f166-4cd0-999c-f60e46814d26', 'limit': 2}
        ],
        'destination_extension_list': [
            {'begin': '09:00', 'end': '12:00', 'destination_extension': 123}
        ],
        'holiday': [],
        'pop_mode': 1,
        'redial_enabled': 0,
        'redial_new_number_policy': 0,
        'redial_interval': 3,
        'redial_max_times': 3,
        'redial_conditions': {
            'da_status': [2, 3, 4, 6, 8, 9, 12]
        }
    }
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.put(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",
            "group_type": "group",
            "destination_extension": 123,
            "is_group_switch": 1,
            "maximumcall": 2,
            "dial_time_id": 123,
            "background_id": 123,
            "task_type": 7,
            "llm_intention_id": 123,
            "score_scheme_id": 123,
            "task_extras": {
                "start_time": "2024-12-23 19:00:00",
                "stop_time": "2025-12-25 23:59:59",
                "line": [{"id": "d47c3599-f166-4cd0-999c-f60e46814d26", "limit": 2}],
                "holiday": [],
                "pop_mode": 1,
                "redial_enabled": 0,
                "redial_new_number_policy": 0,
                "redial_interval": 3,
                "redial_max_times": 3,
                "redial_conditions": {"da_status": [2, 3, 4, 6, 8, 9, 12]}
            }
        })";

        curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
        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;
}

请求参数

json
{
    "name": "测试api接口创建-222",
    "group_type":"group",
    "destination_extension": 123, // 话术分组id
    "is_group_switch": 1,   // 话术配置类型 0-统一配置 1-按时间配置 2-变量分组配置 3-多项外呼话术组配置
    "maximumcall": 2, // 并发总数 (线路总并发)
    "dial_time_id": 123, // 呼叫时间组
    "background_id": 123, // 背景音id 需要提供背景音列表等接口
    "task_extras": {
        "start_time": "2024-12-23 19:00:00", // 开始时间  (必填)
        "stop_time": "2025-12-25 23:59:59", // 结束时间
        "line": [ // 新版2.0-任务线路参数,无数据也需传递空数组
            {
                "id": "d47c3599-f166-4cd0-999c-f60e46814d26", // 线路id
                "limit": 2, // 最大并发
            }
        ],
        "destination_extension_list": [ // 新版2.0-AI对话模型-按时间配置
            {
                "begin": "09:00",  // 开始时间
                "end": "12:00",  // 结束时间
                "destination_extension": 123,  // 该时间段内话术
            }
        ],
        "destination_extension_with_variable_list": [ 
            // is_switch_group为2(按号码变量配置)时必填
            // 变量话术组,可不配置,当号码中携带符合变量话术组配置时,会自动选择该话术组 (最多配置100个)
            // 以下配置说明号码变量包含男,使用话术组ID:11
            // 号码变量包含女,使用话术组12
            // 号码变量其余值或者空,使用兜底话术组10
            {
                "mode": 1, // 模式 0-包含任一关键词、1-等于任一关键词
                "values": [ // 关键词,最多10个,且不能有重复
                    "男",
                    "男的"
                ],
                "destination_extension": 11, // 使用话术组
                "sort": 1, // 排序,排序越大优先级越低
            },
            {
                "mode": 0, // 模式 0-包含任一关键词、1-等于任一关键词
                "values": [ // 关键词,最多10个,且不能有重复
                    "女",
                    "女性"
                ],
                "destination_extension": 12, // 使用话术组
                "sort": 0
            },
            {
                "mode": 0, // 模式 0-包含任一关键词、1-等于任一关键词
                "values": [ // 关键词,最多10个,且不能有重复
                    "未知"
                ],
                "destination_extension": 10, // 使用话术组
                "sort": 4
            }
        ],
        "destination_extension_multi_config": { // 多项外呼话术组配置
            "dial_mode": 0, // 拨打模式,0:轮询 1:随机
            "list": [
                {
                    "destination_extension": "13601", // 话术组
                    "sort": 1 // 排序参数必须传递,当dial_mode为0时,sort字段是轮询的依据
                },
                {
                    "destination_extension": "13716", // 话术组
                    "sort": 2
                }
            ]
        },
        "holiday": [],  // 休息日
        "work_hour": [], // 工作时间
        "work_week": [], // 工作周
        "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    // 2=运营商拦截 3=拒接 4=无应答、无人接听 5=空号 6=关机 7=停机 8=占线、用户在忙 9=呼入限制 10=欠费 11=黑名单 12=用户屏蔽
            ]
        ]
    },
    "llm_intention_id": 123, // 大模型质检id
    "score_scheme_id": 123 // 打分方案id
}

参数说明

参数类型示例解释必填
sub_user_idstring5b55bcca-d653-4a58-8f9a-437fb0601f8e子账户 id
(传递此参数则是对子账户操作)
bridge_group_idint1使用转接组的 id
不传这个键,则表示为空
传了则必填
destination_extensionint297使用话术分组的 id
dial_time_idint5呼叫时间组 ID
maximumcallint1线路并发数
namestring测试任务任务名称
remarkstring第一个任务任务描述
auto_recycle_rule_idint1重呼规则 id
elasticity_typeboolFALSE动态坐席
end_actionint1任务结束动作
此动作不能与动态坐席同时开启
background_idint25背景音 id
llm_intention_idint1大模型质检配置 id
task_extrasarray-2.0 任务配置信息
task_extras.start_timestring2024/11/1 13:25任务开始时间
task_extras.stop_timestring2025/11/1 13:25任务结束时间
task_extras.holidayarray[{"start":"2024-11-01 13:25",
"end":"2024-11-03 13:25"}]
停止工作时间
(注意不传也需要传空数组值)
linearray[{"id":"xxx","limit":2}]线路配置
(注意不传也需要传空数组值)
interval_timeint0呼叫时间间隔
(默认为 0)
task_extras.destination_extension_listarray[{"begin":"09:00",
"end":"12:00",
"destination_extension":
"215870475195883520"}]
AI 对话模型 - 按时间配置
task_extras.destination_extension_with_variable_listarray[{"mode":1,
"values":["男","男的"],
"destination_extension":11,
"sort":1}]
AI 对话模型 - 按号码变量配置
(is_group_switch 为 2 时必填)
task_extras.redial_enabledbool1重呼配置
task_extras.redial_new_number_policybool1首次外呼优先
task_extras.redial_intervalint3重呼间隔
最多 60 分钟
task_extras.redial_max_timesint3重呼次数
最多 3 次
task_extras.da_statusarray[2,3,4,6,8,9,12]重呼状态
2=运营商拦截 3=拒接
4=无应答、无人接听 5=空号
6=关机 7=停机 8=占线、用户在忙
9=呼入限制 10=欠费 12=用户屏蔽
task_extras.pop_modeint0弹出模式
0=随机 1=顺序 2=倒序

旧版任务2.0

请求示例

cURL
curl -X PUT "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "name": "测试api接口创建-222",
    "destination_extension": 102,
    "maximumcall": 1,
    "dial_time_id": 5,
    "background_id": 52,
    "task_extras": {
        "start_time": "2024-11-01 13:25:26",
        "stop_time": "2025-11-01 13:25:26",
        "line": [],
        "holiday": [
            {
                "begin": "2024-11-01 13:25",
                "end": "2024-11-03 13:25"
            }
        ]
    }
}'
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/f232d184-dd54-42a0-8ace-0bf8d660f4cc"

    payload := map[string]interface{}{
        "name":                  "测试api接口创建-222",
        "destination_extension": 102,
        "maximumcall":           1,
        "dial_time_id":          5,
        "background_id":         52,
        "task_extras": map[string]interface{}{
            "start_time": "2024-11-01 13:25:26",
            "stop_time":  "2025-11-01 13:25:26",
            "line":       []interface{}{},
            "holiday": []map[string]string{
                {
                    "begin": "2024-11-01 13:25",
                    "end":   "2024-11-03 13:25",
                },
            },
        },
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("PUT", 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: 102,
    maximumcall: 1,
    dial_time_id: 5,
    background_id: 52,
    task_extras: {
        start_time: '2024-11-01 13:25:26',
        stop_time: '2025-11-01 13:25:26',
        line: [],
        holiday: [
            {
                begin: '2024-11-01 13:25',
                end: '2024-11-03 13:25'
            }
        ]
    }
};

axios.put('https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc', 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/f232d184-dd54-42a0-8ace-0bf8d660f4cc";
        String json = """
            {
                "name": "测试api接口创建-222",
                "destination_extension": 102,
                "maximumcall": 1,
                "dial_time_id": 5,
                "background_id": 52,
                "task_extras": {
                    "start_time": "2024-11-01 13:25:26",
                    "stop_time": "2025-11-01 13:25:26",
                    "line": [],
                    "holiday": [
                        {
                            "begin": "2024-11-01 13:25",
                            "end": "2024-11-03 13:25"
                        }
                    ]
                }
            }
            """;

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Bearer YOUR_TOKEN")
                .PUT(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/f232d184-dd54-42a0-8ace-0bf8d660f4cc';

$data = [
    'name' => '测试api接口创建-222',
    'destination_extension' => 102,
    'maximumcall' => 1,
    'dial_time_id' => 5,
    'background_id' => 52,
    'task_extras' => [
        'start_time' => '2024-11-01 13:25:26',
        'stop_time' => '2025-11-01 13:25:26',
        'line' => [],
        'holiday' => [
            [
                'begin' => '2024-11-01 13:25',
                'end' => '2024-11-03 13:25'
            ]
        ]
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
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/f232d184-dd54-42a0-8ace-0bf8d660f4cc'

data = {
    'name': '测试api接口创建-222',
    'destination_extension': 102,
    'maximumcall': 1,
    'dial_time_id': 5,
    'background_id': 52,
    'task_extras': {
        'start_time': '2024-11-01 13:25:26',
        'stop_time': '2025-11-01 13:25:26',
        'line': [],
        'holiday': [
            {
                'begin': '2024-11-01 13:25',
                'end': '2024-11-03 13:25'
            }
        ]
    }
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.put(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": 102,
            "maximumcall": 1,
            "dial_time_id": 5,
            "background_id": 52,
            "task_extras": {
                "start_time": "2024-11-01 13:25:26",
                "stop_time": "2025-11-01 13:25:26",
                "line": [],
                "holiday": [
                    {
                        "begin": "2024-11-01 13:25",
                        "end": "2024-11-03 13:25"
                    }
                ]
            }
        })";

        curl_easy_setopt(curl, CURLOPT_URL, "https://ai.api.longlonglong.cn/agent-api/new/user/5832d184-dd53-42a0-8ace-0bf8d660f4cc/task/f232d184-dd54-42a0-8ace-0bf8d660f4cc");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
        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;
}

请求参数

json
{
    "name": "测试api接口创建-222",
    "destination_extension": 102, // 话术分组id
    "maximumcall": 1, // 并发总数 (线路总并发)
    "dial_time_id": 5, // 呼叫时间组
    "background_id": 52, // 背景音id 需要提供背景音列表等接口
    "task_extras": {
        "start_time": "2024-11-01 13:25:26", // 开始时间  (必填)
        "stop_time": "2025-11-01 13:25:26", // 结束时间
        "line": [],  //line参数除外,不传线路,也需传递空数组
        "holiday": [ // 假期时间 (选填)可设置多个  (不传,也需传递空数组)
            {
                "begin": "2024-11-01 13:25",
                "end": "2024-11-03 13:25"
            }
        ]
    },
  "group_switch_rule": [ // 2.0-AI对话模型-按时间配置(新版2.0AI对话模型配置在task_extras.destination_extension_list)
    {
      "switch_start": "09:00", // 开始时间
      "switch_end": "12:00", // 结束时间
      "group_id": 13037, // 时间段话术
      "default_group_id": 123, // 默认配置话术
    }
  ]
}

参数说明

参数类型示例解释必填
sub_user_idstring5b55bcca-d653-4a58-8f9a-437fb0601f8e子账户id(传递此参数则是对子账户操作)
bridge_group_idint1使用转接组的id 不传这个键,则表示为空。传了则必填
destination_extensionint297使用话术分组的id
dial_time_idint5呼叫时间组ID
maximumcallint1线路并发数
namestring测试任务任务名称
remarkstring第一个任务任务描述
auto_recycle_rule_idint1重呼规则id
elasticity_typeboolFALSE动态坐席
end_actionint1任务结束动作 此动作不能与动态坐席同时开启
background_idint25背景音id
llm_intention_idint1大模型质检配置id
task_extrasarray2.0 任务配置信息
task_extras.start_timestring2024/11/1 13:25任务开始时间
task_extras.stop_timestring2025/11/1 13:25任务结束时间
task_extras.holidayarray[{"start": "2024-11-01 13:25","end": "2024-11-03 13:25"}]停止工作时间 (注意不传也需要传空数组值)
task_extras.linearray["29c39ec4-b292-4af9-a88b-922d61866sub"]线路id (注意不传也需要传空数组值)
task_extras.interval_timeint0呼叫时间间隔(默认为0)
new_call_rulesarray2.0任务重呼配置信息
new_call_rules.*.re_call_timedate10:00:00重呼执行时间 (时间范围10-11 13-22)
new_call_rules.*.call_intervalint60呼叫间隔时间 (单位:分钟)
new_call_rules.*.rule_idint15486重呼规则id

注意事项

请特别注意

  1. 除了必填以外,不用的参数可以不传(line&holiday参数除外,不传线路信息也需传递空数组)
  2. 请特别注意,为了方便2.0外呼任务,可使用旧时间组(dial_time_id),进行创建或更新2.0任务操作,但时间组中工作时间的更新,目前并未与使用其的任务同步
  3. 2.0 任务更新需要暂停任务才可进行更新。
  4. 如果使用2.0 任务,需暂停任务才可以修改 否则会出现以下报错。
    {"code": 6007,"status": "error","message": "2.0任务启动中,请先停止任务","data": []}
  5. maximumcall 为所选线路的总并发数之和,每条所选线路使用的并发数为平均并发数,即设置总并发数,必须为设置线路数量整除。平均并发数不得超过选用线路的 residue 值

返回参数

json
{
    "code": 200,
    "status": "success",
    "message": "修改成功",
    "data": ""
}

基于 MIT 许可发布