Create Campaign
POSThttps://api.tinyemail.com/v1/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 - Contact Ids. Refer Contacts API
- schedule.dateTime - Campaign schedule time in UTC
- schedule.days - Recurring campaign days
- schedule.time - Recurring campaign time in HH:mm:ss format
Campaign Status Scenarios:
- Draft Campaign (No Schedule Provided):
- If the
schedule
object 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
schedule
object is present, and it has a non-emptydateTime
field, 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
schedule
object hasdays
andtime
specified, 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
contentSourceUrl string
campaign objectrequired
senderId uuidrequired
template objectrequired
contactIds string[]
schedule object
Responses
- 200
- 400
- 401
- 405
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 uuid
status string
{
"id": "00000000-0000-0000-0000-000000000000",
"status": "DRAFT"
}
Bad Request
- application/json
- Schema
- Example (from schema)
Schema
message string
{
"message": "Some error message"
}
API key is missing or invalid
Method Not Allowed
Authorization: X-API-KEY
name: X-API-KEYtype: apiKeyin: header
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://api.tinyemail.com/v1/campaign' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-KEY: <API_KEY_VALUE>' \
--data-raw '{
"contentSourceUrl": "https://app.tinyemail.com/api/v1/content.json",
"campaign": {
"name": "Black Friday Campaign",
"subject": "Black Friday Offer",
"previewText": "Offer!"
},
"senderId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"template": {
"html": ""
},
"contactIds": [
[
"2b4ea4a6-1fa3-4863-87e7-f498376d68",
"b85a7177-b94b-43de-a8cd-03713c91b"
]
],
"schedule": {
"dateTime": "2024-01-26T08:15:00.00Z",
"days": [
[
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
]
],
"time": "03:00:00"
}
}'
ResponseClear