I have found a better way to accomplish this all in a single call by utilizing REST API.
You use the endpoint automation/v1/automations
to create (POST) your new automation.
See below example:
POST /automation/v1/automations
Host: {{yourSubDomain}}.rest.marketingcloudapis.com
Authorization: Bearer XXXXXXX
Content-Type: application/json
and then the payload:
{
"name": "testRestAuto",
"description": "testRestAuto",
"key": "testRestAuto",
"steps": [
{
"annotation": "",
"stepNumber": 0,
"activities": [
{
"id": "yourActivityID",
"name": "yourActivityName",
"objectTypeId": 43,
"displayOrder": 0,
"activityObjectId": "{{yourActivityObjectID}}"
}
],
"id": "f4518041-5702-4712-a690-abc17e6a30f1"
},
{
"annotation": "",
"stepNumber": 1,
"activities": [
{
"name": "1 Hours",
"objectTypeId": 467,
"displayOrder": 0,
"activityObjectId": "00000000-0000-0000-0000-000000000000",
"serializedObject": "{\"duration\":1,\"durationUnits\":\"Hours\"}"
}
]
}
],
"startSource": {
"typeId": 2, /* sets it to Triggered Auto */
"fileDrop": {
"filenamePatternTypeId": 0,
/* 0 is no name, 1 Contains, 2 begins with, 3 ends with */
"filenamePattern": "file",
/* only used with 1-3 to set string for filename - remove for 0 */
"folderLocation": "triggered_automations",
"statusId": 0,
"queueFiles": true
}
},
"categoryId": 58142 /* Folder ID */
}
The important part to pay attention to is the 'startSource' section:
"startSource": {
"typeId": 2, /* sets it to Triggered Auto */
"fileDrop": {
"filenamePatternTypeId": 0,
/* 0 is no name, 1 Contains, 2 begins with, 3 ends with */
"filenamePattern": "file",
/* only used with 1-3 to set string for filename - remove for 0 */
"folderLocation": "triggered_automations",
"statusId": 0,
"queueFiles": true
}
}
This is where you will set up the triggered Send information.
After you created it, you can then use PATCH or GET (utilizing the ObjectID at the end of the endpoint) to update or retrieve your automation.