Creating campaigns with steps using the application API
There are many campaign steps available to you when creating a campaign. This tutorial outlines how to use the application API to create a campaign with campaign steps and provides an example. After you understand how to create campaign, see campaign element reference for a full list of all campaign steps.
Creating a campaign with steps
Creating a campaign with steps is done using the elements
array. Here is an example of a campaign in Eloqua.
The following request outlines how to create this campaign using the API. Note the elements
.
Request
POST /api/REST/2.0/assets/campaigns
Request body
{
"name": "Campaign with steps example",
"elements": [
{
"type": "CampaignSegment",
"id": "-1",
"name": "Segment Members",
"memberCount": "0",
"memberErrorCount": "0",
"position": {
"x": 167,
"y": 53
},
"isFinished": "false",
"isRecurring": "false",
"segmentId": "38",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "out",
"connectedId": "-2",
"connectedType": "CampaignWaitAction",
"id": "-500011"
}
],
"reEvaluationFrequency": "3600"
},
{
"type": "CampaignWaitAction",
"name": "Wait",
"position": {
"x": 167,
"y": 168
},
"id": "-2",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "out",
"connectedId": "-3",
"connectedType": "CampaignEmail",
"id": "-500012"
}
],
"waitFor": "3600"
},
{
"type": "CampaignEmail",
"name": "Email",
"position": {
"x": 167,
"y": 281
},
"id": "-3",
"includeListUnsubscribeHeader": "true",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "out",
"connectedId": "-4",
"connectedType": "CampaignWaitAction",
"id": "-500013"
}
],
"emailId": "61",
"sendTimePeriod": "sendAllEmailAtOnce"
},
{
"type": "CampaignWaitAction",
"name": "Wait",
"position": {
"x": 167,
"y": 393
},
"id": "-4",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "out",
"connectedId": "-5",
"connectedType": "CampaignEmail",
"id": "-500014"
}
],
"waitFor": "259200"
},
{
"type": "CampaignEmail",
"name": "Email",
"position": {
"x": 167,
"y": 506
},
"id": "-5",
"includeListUnsubscribeHeader": "true",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "out",
"connectedId": "-6",
"connectedType": "CampaignEmailClickthroughRule",
"id": "-500015"
}
],
"emailId": "52",
"sendTimePeriod": "sendAllEmailAtOnce"
},
{
"type": "CampaignEmailClickthroughRule",
"name": "Clicked Email?",
"position": {
"x": 167,
"y": 621
},
"id": "-6",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"terminalType": "no",
"connectedId": "-7",
"connectedType": "CampaignMoveToContactListAction",
"id": "-500016"
},
{
"type": "CampaignOutputTerminal",
"terminalType": "yes",
"connectedId": "-8",
"connectedType": "CampaignMoveToContactListAction",
"id": "-500017"
}
],
"emailId": "52",
"numberOfClicks": "1",
"evaluateNoAfter": "0",
"withinLast": "604800"
},
{
"type": "CampaignMoveToContactListAction",
"name": "Move to Shared List",
"position": {
"x": 52,
"y": 735
},
"id": "-7",
"listId": "96",
"outputTerminals": [
]
},
{
"type": "CampaignMoveToContactListAction",
"name": "Move to Shared List",
"position": {
"x": 281,
"y": 729
},
"id": "-8",
"listId": "97",
"outputTerminals": [
]
}
]
}
Request notes:
- In this request body, negative numbers are used for each campaign element. This is necessary because Eloqua will set these ids when the Campaign is created; therefore, you cannot know what they are prior.
- The negative id is a placeholder that allows you to connect the steps within the output terminals. For the output terminals, the unique negative number reference id is only needed for the output terminal itself if there is more than one output terminal, i.e. a yes / no decision step.
Response
{
"type": "Campaign",
"currentStatus": "Draft",
"id": "118",
"createdAt": "1543427274",
"createdBy": "9",
"depth": "complete",
"folderId": "1263",
"name": "Campaign with steps example",
"permissions": [
"Retrieve",
"SetSecurity",
"Delete",
"Update",
"Activate"
],
"updatedAt": "1543427274",
"updatedBy": "9",
"elements": [
{
"type": "CampaignSegment",
"id": "2211",
"initialId": "-1",
"name": "Segment Members",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1821",
"initialId": "-500011",
"connectedId": "2212",
"connectedType": "CampaignWaitAction",
"terminalType": "out"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "53"
},
"isFinished": "false",
"isRecurring": "false",
"segmentId": "38"
},
{
"type": "CampaignWaitAction",
"id": "2212",
"initialId": "-2",
"name": "Wait",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1822",
"initialId": "-500012",
"connectedId": "2213",
"connectedType": "CampaignEmail",
"terminalType": "out"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "168"
},
"isNotificationEnabled": "False",
"waitFor": "3600"
},
{
"type": "CampaignEmail",
"id": "2213",
"initialId": "-3",
"name": "Email",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1823",
"initialId": "-500013",
"connectedId": "2214",
"connectedType": "CampaignWaitAction",
"terminalType": "out"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "281"
},
"sendTimePeriod": "sendAllEmailAtOnce",
"emailId": "61",
"includeListUnsubscribeHeader": "true",
"isAllowingResend": "false",
"isAllowingSentToMasterExclude": "false",
"isAllowingSentToUnsubscribe": "false",
"stoType": "none"
},
{
"type": "CampaignWaitAction",
"id": "2214",
"initialId": "-4",
"name": "Wait",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1824",
"initialId": "-500014",
"connectedId": "2215",
"connectedType": "CampaignEmail",
"terminalType": "out"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "393"
},
"isNotificationEnabled": "False",
"waitFor": "259200"
},
{
"type": "CampaignEmail",
"id": "2215",
"initialId": "-5",
"name": "Email",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1825",
"initialId": "-500015",
"connectedId": "2216",
"connectedType": "CampaignEmailClickthroughRule",
"terminalType": "out"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "506"
},
"sendTimePeriod": "sendAllEmailAtOnce",
"emailId": "52",
"includeListUnsubscribeHeader": "true",
"isAllowingResend": "false",
"isAllowingSentToMasterExclude": "false",
"isAllowingSentToUnsubscribe": "false",
"stoType": "none"
},
{
"type": "CampaignEmailClickthroughRule",
"id": "2216",
"initialId": "-6",
"name": "Clicked Email?",
"memberCount": "0",
"memberErrorCount": "0",
"outputTerminals": [
{
"type": "CampaignOutputTerminal",
"id": "1827",
"initialId": "-500017",
"connectedId": "2216",
"connectedType": "CampaignEmailClickthroughRule",
"terminalType": "yes"
},
{
"type": "CampaignOutputTerminal",
"id": "1826",
"initialId": "-500016",
"connectedId": "2217",
"connectedType": "CampaignMoveToContactListAction",
"terminalType": "no"
}
],
"position": {
"type": "Position",
"x": "167",
"y": "621"
},
"emailId": "52",
"evaluateNoAfter": "0",
"numberOfClicks": "1",
"withinLast": "604800"
},
{
"type": "CampaignMoveToContactListAction",
"id": "2217",
"initialId": "-7",
"name": "Move to Shared List",
"memberCount": "0",
"memberErrorCount": "0",
"position": {
"type": "Position",
"x": "52",
"y": "735"
},
"listId": "96"
},
{
"type": "CampaignMoveToContactListAction",
"id": "2218",
"initialId": "-8",
"name": "Move to Shared List",
"memberCount": "0",
"memberErrorCount": "0",
"position": {
"type": "Position",
"x": "281",
"y": "729"
},
"listId": "97"
}
],
"isReadOnly": "false",
"actualCost": "0",
"budgetedCost": "0",
"campaignCategory": "contact",
"campaignType": "",
"crmId": "",
"fieldValues": [
{
"type": "FieldValue",
"id": "9",
"value": ""
},
{
"type": "FieldValue",
"id": "10",
"value": ""
},
{
"type": "FieldValue",
"id": "11",
"value": ""
}
],
"isEmailMarketingCampaign": "false",
"isIncludedInROI": "false",
"isMemberAllowedReEntry": "false",
"isSyncedWithCRM": "false",
"product": "",
"region": ""
}
Check out campaign element reference to learn how to create campaigns with other campaign elements.