You can use the following api to create and launch an event triggered campaign
Sample Call:
- cURL
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"name": "Event Triggered campaign - 1",
"startdate": "2017-08-21T20:09:26Z",
"enddate": "2017-09-21T20:09:26Z",
"triggering_event_name": "enrolled",
"bypass_message_limits": true,
"send_to_unsubscribed": false,
"triggers": [
{
"template_uuid": "0f09e1d8-7a4a-4e0d-85f5-987e47cf95dd",
"utm_source": "blueshift",
"utm_campaign": "event_triggered_campaign_1",
"utm_medium": "email"
}
]
}' -u <USER_API_KEY>: https://api.getblueshift.com/api/v1/campaigns/event_triggered
Sample Response:
- JSON
{
"campaign": {
"uuid": "21f20429-a2ab-477d-8d66-ddd9a6308fe1",
"name": "Event Triggered campaign - 1",
"startdate": "2017-08-21T20:09:26Z",
"enddate": "2017-09-21T20:09:26Z",
"triggering_event_name": "enrolled",
"bypass_message_limits": true,
"send_to_unsubscribed": false,
"journey_concurrency": "multiple"
}
}
Attributes:
Attribute | Description | Sample |
name | Campaign Name | "Event Triggered campaign - 1" |
startdate | Campaign start time, in iso8601 format, default's to the current time (The campaign will launched immediately) | "2017-08-21T20:09:26Z" |
enddate | Campaign end time, in iso8601 format, default is null (will run forever) | "2017-09-21T20:09:26Z" |
triggering_event_name | The event which trigger's this campaign. If this attribute is not set it defaults to "api endpoint is called" | "enrolled" |
bypass_messaging_limits | Exclude from messaging limits, boolean value. Default is false | true |
send_to_unsubscribed | Send to Unsubscribed users, boolean value. Default is false | false |
journey_concurrency | Allowed values ["once_per_lifetime"," once_at_any_time", "multiple"]. Default value is once_at_any_time | "once_at_any_time" |
triggers.templates_uuid | UUID of the template to be used for the trigger, this will determine the channel too (Email, Push or SMS) | "0f09e1d8-7a4a-4e0d-85f5-987e47cf95dd" |
triggers.utm_source | UTM Source, default value is "blueshift" | "blueshift" |
triggers.utm_campaign | UTM Campaign, default value is campaign name | "event_triggered_campaign_1" |
triggers.utm_medium | UTM Medium, default value is the inferred from the template type (Ex: "email" ) | "email" |
triggers.utm_content | UTM Content | |
triggers.utm_term | UTM Term |
Sample Data:
- JSON
{
"name": "Event Triggered campaign - 1",
"startdate": "2017-08-21T20:09:26Z",
"enddate": "2017-09-21T20:09:26Z",
"triggering_event_name": "enrolled",
"bypass_message_limits": true,
"send_to_unsubscribed": false,
"triggers": [
{
"template_uuid": "0f09e1d8-7a4a-4e0d-85f5-987e47cf95dd",
"utm_source": "blueshift",
"utm_campaign": "event_triggered_campaign_1",
"utm_medium": "email"
}
]
}
One Time Campaign
You can use the following api to create and launch a one time campaign
Sample Call:
- cURL
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"name": "One time campaign",
"startdate": "2018-08-21T20:09:26Z",
"segment_uuid": "7ffeb874-c059-431d-a54c-c7fbae08cb98",
"send_summary_emails": "test@test.com",
"bypass_message_limits": true,
"send_to_unsubscribed": false,
"triggers": [
{
"template_uuid": "0f09e1d8-7a4a-4e0d-85f5-987e47cf95dd",
"utm_source": "blueshift",
"utm_campaign": "one_time_campaign_1",
"utm_medium": "email"
}
]
}' -u <USER_API_KEY>: https://api.getblueshift.com/api/v1/campaigns/one_time
Sample Response:
{
"campaign": {
"uuid": "21f20429-a2ab-477d-8d66-ddd9a6308fe1",
"name": "One time campaign - 1",
"startdate": "2018-08-21T20:09:26Z",
"bypass_message_limits": true,
"segment_uuid": "7ffeb874-c059-431d-a54c-c7fbae08cb98",
"send_summary_emails": "test@test.com",
"send_to_unsubscribed": false
}
}
Attributes:
Attribute | Description | Sample |
name | Campaign Name | "One time campaign" |
startdate | Campaign start time, in iso8601 format, default's to the current time (The campaign will launched immediately) | "2017-08-21T20:09:26Z" |
segment_uuid | Uuid of the segment, this is a required field | "1ffec874-c059-431d-a54c-c7fbae18cb98" |
send_summary_emails | The email address for the campaign execution summary report | "test@test.com,test1@test.com" |
bypass_messaging_limits | Exclude from messaging limits, boolean value. Default is false | true |
send_to_unsubscribed | Send to Unsubscribed users, boolean value. Default is false | false |
triggers.utm_source | UTM Source, default value is "blueshift" | "blueshift" |
triggers.utm_campaign | UTM Campaign, default value is campaign name | "event_triggered_campaign_1" |
triggers.utm_medium | UTM Medium, default value is the inferred from the template type (Ex: "email" ) | "email" |
triggers.utm_content | UTM Content | |
triggers.utm_term | UTM Term |
Campaign Launch
You can use the following api to launch a campaign
curl -X PUT -u <USER_API_KEY>: https://api.getblueshift.com/api/v1/campaigns/<campaign_uuid>/launch
Campaign Pause
You can use the following api to pause a campaign
curl -X PUT -u <USER_API_KEY>: https://api.getblueshift.com/api/v1/campaigns/<campaign_uuid>/pause
Error Codes & Responses:
Code | Text | Description |
400 | Bad Request | The request was invalid or cannot be otherwise served. An accompanying error message will explain further |
404 | Resource not found | Can happen due to resource conflict's, re-try with exponential backoff, if the issue is not resolved please contact blueshift |
409 | Conflict error, please retry | The request could not be completed due to a conflict with the current state of the target resource, re-try with exponential backoff |
413 | You can upload maximum 50 users in one api call | The server is refusing to process a request because the request payload is larger than the server is willing or able to process. |
429 | Rate limit exceeded | Too many requests, please contact blueshift for recommended throughput's. |
500 | Internal Server Error | Please contact Blueshift for more information |
502 | Service unavailable, please retry | Bad Gateway, re-try with exponential backoff |
503 | Service unavailable, please retry | Service Unavailable, re-try with exponential backoff |
504 | Service unavailable, please retry | Gateway Timeout, please re-try with exponential backoff |