Create outbound task (CreateOutboundTask)
Creates an outbound task. You must associate the task with an approved outbound scenario and an uploaded customer list, and configure parameters such as the date range, daily call time window, and number of concurrent agents for task execution.
Prerequisites
-
The SDK is installed.
-
You have obtained an AccessKey and configured it. For more information, see Obtain an AccessKey and configure it in environment variables.
-
You have obtained the SceneId (scenario ID). You can obtain it from the response parameter Data.SceneId when you call CreateOutboundScene to create an outbound scenario, or by calling QueryOutboundSceneList to query the existing scenario list. The scenario must be approved.
-
You have obtained the CustomerListId (customer list ID). Call QueryCustomerManagementList to query the customer list and obtain it from the response parameter Records[].Id.
Request parameters
|
Name |
Type |
Required |
Description |
Example value |
|
Action |
String |
Yes |
The operation to perform. Set the value to CreateOutboundTask. |
CreateOutboundTask |
|
Version |
String |
Yes |
The API version number. Format: YYYY-MM-DD. Set the value to 2025-11-27. |
Fixed to 2025-11-27 |
|
TaskName |
String |
Yes |
The task name. |
Spring Festival promotion outbound task |
|
TaskDesc |
String |
No |
The task description. |
Spring Festival promotion campaign for VIP customers |
|
TaskBasicConfig |
Object |
Yes |
The basic task configuration. For parameter details, see the table below. |
|
|
TaskBasicConfig.SceneId |
Number |
Yes |
The associated outbound scenario ID. |
91 |
|
TaskBasicConfig.CustomerListId |
Number |
Yes |
The customer list ID (obtain from the console). |
1001 |
|
TaskBasicConfig.CustomerListName |
String |
No |
The customer list name. |
VIP customer list |
|
TaskBasicConfig.CustomerListCount |
Number |
No |
The number of customers in the list. |
500 |
|
TaskBasicConfig.TtsVoiceCode |
String |
No |
The TTS voice code. |
V23C0DDD0 |
|
TaskBasicConfig.TtsVoiceDesc |
String |
No |
The TTS voice description. |
Mengqi |
|
TaskBasicConfig.SceneName |
String |
No |
The scenario name. |
After-sales callback scenario |
|
TaskExecuteConfig |
Object |
Yes |
The task execution configuration. For parameter details, see the table below. |
|
|
TaskExecuteConfig.BeginDate |
String |
Yes |
The task start date (yyyy-MM-dd). |
2024-01-01 |
|
TaskExecuteConfig.EndDate |
String |
Yes |
The task end date (yyyy-MM-dd). |
2024-01-31 |
|
TaskExecuteConfig.BeginTime |
String |
Yes |
The daily start time (HH:mm). |
09:00 |
|
TaskExecuteConfig.EndTime |
String |
Yes |
The daily end time (HH:mm). |
18:00 |
|
TaskExecuteConfig.SeatNum |
Number |
No |
The number of concurrent agents. |
10 |
|
TaskExecuteConfig.IsExcludeHoliday |
Boolean |
No |
Specifies whether to exclude holidays. |
true |
|
TaskExecuteConfig.IsExcludeLunchBreak |
Boolean |
No |
Specifies whether to exclude the lunch break. |
true |
|
TaskExecuteConfig.RetryConfig.Count |
Number |
No |
The number of retries. |
3 |
|
TaskExecuteConfig.RetryConfig.Minute |
Number |
No |
The retry interval (minutes). |
30 |
Response parameters
|
Name |
Type |
Description |
Example value |
|
RequestId |
String |
The request ID. |
xxxx-xxxx-xxxx |
|
Success |
Boolean |
Indicates whether the request was successful. |
True |
|
Code |
String |
The error code. Empty when the request is successful. |
None |
|
Message |
String |
The error message or success notification. |
Operation successful |
|
Data |
Object |
The response data, which includes fields such as TaskId, Success, and Message. For details, see the response parameter description below. |
Usage examples
Python
import json
import os
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_tea_openapi.client import Client as OpenApiClient
from alibabacloud_tea_util import models as util_models
from alibabacloud_openapi_util.client import Client as OpenApiUtilClient
def main():
config = open_api_models.Config(
access_key_id=os.getenv("ACCESS_KEY_ID"),
access_key_secret=os.getenv("ACCESS_KEY_SECRET"),
)
config.endpoint = "thirdswaicall.aliyuncs.com"
config.protocol = "HTTPS"
client = OpenApiClient(config)
params = open_api_models.Params(
style="RPC",
version="2025-11-27",
action="CreateOutboundTask",
method="POST",
pathname="/",
protocol="HTTPS",
auth_type="AK",
req_body_type="json",
body_type="json",
)
body = {
'TaskName': 'Spring Festival promotion outbound task',
'TaskDesc': 'Spring Festival promotion campaign for VIP customers',
'TaskBasicConfig': {
'SceneId': 1,
'CustomerListId': 1001,
'CustomerListName': 'VIP customer list',
'TtsVoiceCode': 'V23C0DDD0',
'TtsVoiceDesc': 'Mengqi',
},
'TaskExecuteConfig': {
'BeginDate': '2024-01-01',
'EndDate': '2024-01-31',
'BeginTime': '09:00',
'EndTime': '18:00',
'SeatNum': 10,
},
}
request = open_api_models.OpenApiRequest(body=OpenApiUtilClient.parse_to_map(body))
runtime = util_models.RuntimeOptions(autoretry=True, max_attempts=3)
try:
resp = client.call_api(params, request, runtime)
print(json.dumps(resp.get("body", {}), ensure_ascii=False, indent=2))
except Exception as e:
print(f"Call failed: {e}")
if __name__ == "__main__":
main()
Java
import com.aliyun.teaopenapi.Client;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teaopenapi.models.OpenApiRequest;
import com.aliyun.teaopenapi.models.Params;
import com.aliyun.teautil.models.RuntimeOptions;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
public class Demo {
public static void main(String[] args) throws Exception {
// Initialize configuration
Config config = new Config()
.setAccessKeyId(System.getenv("ACCESS_KEY_ID"))
.setAccessKeySecret(System.getenv("ACCESS_KEY_SECRET"))
.setEndpoint("thirdswaicall.aliyuncs.com")
.setProtocol("HTTPS");
Client client = new Client(config);
// Set API parameters
Params params = new Params()
.setStyle("RPC")
.setVersion("2025-11-27")
.setAction("CreateOutboundTask")
.setMethod("POST")
.setPathname("/")
.setProtocol("HTTPS")
.setAuthType("AK")
.setReqBodyType("json")
.setBodyType("json");
// Build request parameters
Map<String, Object> body = new HashMap<>();
body.put("TaskName", "Example value");
body.put("TaskBasicConfig.CustomerListId", 1);
body.put("TaskExecuteConfig.EndDate", "Example value");
body.put("TaskExecuteConfig.BeginTime", "Example value");
body.put("TaskExecuteConfig.EndTime", "Example value");
OpenApiRequest request = new OpenApiRequest()
.setQuery(com.aliyun.openapiutil.Client.query(body));
// Set runtime options (auto-retry)
RuntimeOptions runtime = new RuntimeOptions()
.setAutoretry(true)
.setMaxAttempts(3);
try {
// Call the API
Map<String, ?> response = client.callApi(params, request, runtime);
Gson gson = new Gson();
System.out.println(gson.toJson(response.get("body")));
} catch (Exception e) {
System.err.println("Call failed: " + e.getMessage());
}
}
}
Response example
{
"Success": true,
"Code": null,
"Message": "Operation successful",
"RequestId": "xxxx-xxxx-xxxx",
"Data": {
"TaskId": 2001,
"Success": true,
"Message": "Task created successfully"
}
}
The detailed processing result is in the Data node. The following table describes the parameters in the Data node.
|
Name |
Type |
Description |
Example value |
|
TaskId |
Number |
The ID of the newly created task. |
2001 |
|
Success |
Boolean |
The operation result. |
True |
|
Message |
String |
The notification message. |
Task created successfully |
Error information
If an error occurs, see Error codes for troubleshooting.