Create Campaign
POST/campaign
Create a new campaign
- contentSourceUrl - While adding campaign into system we will verify contentSourceUrl. If verification is failed, we will abort the campaign creation process.
- contactIds - Audience Ids. Refer Audiences API
- schedule.dateTime - Campaign schedule time in UTC. format:
YYYY-MM-DDTHH:mm:ssZ - schedule.days - Recurring campaign days. Values can be
SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY - schedule.time - Recurring campaign time. format:
HH:mm:ss - aiTrafficControlId - AI Traffic Control Id, created from tinyEmail UI.
- sendOrder - Order the recipients are sent in:
ALPHABETICAL(Standard),RANDOM(Shuffled) orENGAGEMENT_SCORE(Most engaged first). Omit it to send in the standard order. It is honoured on traffic-shaped sends only. - htmlTemplateId - ID of a saved template to use as the campaign content, instead of
template.html. Refer Templates API.
Create a campaign from a saved template:
- The template's html, css and editor type are copied into the campaign when the request is made. Editing or deleting the template later does not change the campaign.
- The template's subject and preview text are used only when
campaign.subject/campaign.previewTextare not sent. Values sent in the request always win. htmlTemplateIdand inlinetemplate.htmlare mutually exclusive. Sending both fails with412and the messageProvide either template.html or htmlTemplateId, not both.- An unknown
htmlTemplateIdfails with412and the messageTemplate <id> not found.
Campaign Status Scenarios:
- Draft Campaign (No Schedule Provided):
- If the
scheduleobject is not included in the payload, the campaign will be in the Draft status. This means the campaign is saved but not scheduled for delivery yet.
- If the
- Scheduled Campaign (DateTime Provided):
- If the
scheduleobject is present, and it has a non-emptydateTimefield, the campaign will be in the Scheduled status. This indicates that the campaign is scheduled for delivery at the specified date and time.
- If the
- Recurring Campaign (Days and Time Provided):
- If the
scheduleobject hasdaysandtimespecified, the campaign will be in the Recurring status. This means the campaign is set to recur on the specified days at the provided time.
- If the
Request
- application/json
Body
required
ALPHABETICAL(Standard) - the order every campaign sends in when no order is picked.RANDOM(Shuffled) - a stable pseudo-random order, seeded with the campaign id, so every batch of one send agrees.ENGAGEMENT_SCORE(Most engaged first) - highest engagement score first, lowest and unscored contacts last. Omit the field to keep the standard order. It has no effect on campaigns that are not traffic shaped.
campaign objectrequired
template object
Inline content. Required unless htmlTemplateId is sent; mutually exclusive with it.
ID of a saved template (see the Templates API) to use as the campaign content, instead of template.html.
The template's html, css and editor type are copied into the campaign; editing or deleting the template later does not change the campaign.
The template's subject and preview text are used only when campaign.subject / campaign.previewText are not sent.
Mutually exclusive with template.html.
Possible values: [ALPHABETICAL, RANDOM, ENGAGEMENT_SCORE]
Order the recipients of a traffic-shaped campaign are sent in.
schedule object
Responses
- 200
- 400
- 401
- 405
- 412
Successful operation
The status could be one of
- DRAFT - The campaign will be this state until client confirms sender details through email
- SCHEDULED - campaign successfully scheduled in our system
- LAUNCHED - campaign is launched at the specified date/time
- COMPLETED - will only be in case when campaign is scheduled for type - ONCE
- PAUSED - When campaign is PAUSED
- FAILED - will be FAILED, after launching a campaign if contentSourceURL is not present or down or we receive invalid content from this URL.
- application/json
- Schema
- Example (from schema)
Schema
{
"id": "00000000-0000-0000-0000-000000000000",
"status": "DRAFT"
}
Bad Request
- application/json
- Schema
- Example (from schema)
Schema
{
"message": "Some error message"
}
API key is missing or invalid
Method Not Allowed
Precondition Failed. The htmlTemplateId was not found in your account, or the request sent both template.html and htmlTemplateId.
- application/json
- Schema
- Example (from schema)
- Template not found
- Both content sources
Schema
- Array [
- ]
errorCodes object[]
{
"message": "Some error message",
"messageDetails": "string",
"errorCodes": [
{
"errorCode": "string",
"errorMessage": "string"
}
]
}
{
"message": "Template 8a6e0f6c-2b7d-4a8e-9a5e-6f1d2c3b4a59 not found"
}
{
"message": "Provide either template.html or htmlTemplateId, not both"
}