Event Triggered via API End Point
Campaign Setup
- Setup a new Event Triggered campaign, and select "api endpoint is called" option for event. Complete remaining campaign setup steps as demonstrated below.

-
Note the campaign identifier/uuid from the url when you edit the campaign, example: https://app.getblueshift.com/dashboard#/campaigns/2df5aa31-3261-4354-8395-53c76a4cec9c/details
uuid: 2df5aa31-3261-4354-8395-53c76a4cec9c -
Launch Campaign
-
Setup a sample call similar to one below. You will need to provide the campaign uuid as well as the user api key
Syntax:
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"email": "<EMAIL ADDRESS>",
"campaign_uuid": "<CAMPAIGN UUID>",
"attribute 1": "<abc>",
"attribute 2": "<xyz>"
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/execute
Sample call:
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"email": "abc+test@getblueshift.com",
"campaign_uuid": "2ef5aa31-5261-4354-8295-53c76a7cec9c",
"campaign_title": "TITLE",
"first_name": "Firstname",
"last_name": "Lastname"
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/execute
Response:
- cURL
{ "success": true }
- You also have the option of triggering multiple campaigns in a single API call through the bulk_execute endpoint. It expects a top level attribute "payloads" whose value is a list of parameters for each user. These parameters are the exact same format that the execute endpoint. You will also need to authenticate using the user api key.
Syntax:
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"payloads": [
{
"email": "<EMAIL ADDRESS 1>",
"campaign_uuid": "<CAMPAIGN UUID 1>",
"attribute 1": "<abc>"
"attribute 2": "<xyz>"
},
{
"email": "<EMAIL ADDRESS 2>",
"campaign_uuid": "<CAMPAIGN UUID 2>",
"attribute 1": "<def>"
"attribute 2": "<uvw>"
}
]
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/bulk_execute
Sample call:
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"payloads": [
{
"email": "abc+test@getblueshift.com",
"campaign_uuid": "2ef5aa31-5261-4354-8295-53c76a7cec9c",
"campaign_title": "TITLE",
"first_name": "Firstname",
"last_name": "Lastname"
},
{
"email": "def+test@getblueshift.com",
"campaign_uuid": "f58e8ed4-de6d-4054-92a8-b0eddcb536a1",
"campaign_title": "SOME OTHER TITLE",
"first_name": "Other Firstname",
"last_name": "Other Lastname"
}
]
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/bulk_execute
Response:
- cURL
[{ "success": true }, { "success": true }]
- Email Attachments : If you are sending an email, you can also specify attachments for the user by setting the "email_attachments" key in the payload. The value should be a list of publicly accessible URLs. Each URL must respond with a 200 HTTP status code and should not contain any redirects.
Sample call
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"email": "abc+test@getblueshift.com",
"campaign_uuid": "2ef5aa31-5261-4354-8295-53c76a7cec9c",
"email_attachments": ["http://mywebsite.com/file.pdf"]
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/execute
You can also specify email attachments with the bulk_execute endpoint. If set outside the "payloads" key, the attachments will be sent to users who do not have attachments specified in their payload. In the example below, user1@getblueshift.com will receive file1.pdf and file2.pdf while user2@getblueshift.com will only receive file3.pdf. Email attachments only get applied to the first touch in the campaign.
To note: This feature is only supported currently for Sparkpost/Sendgrid/Blueshift adapters.
Sample call
- cURL
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
"payloads": [
{
"email": "user1@getblueshift.com",
"campaign_uuid": "2ef5aa31-5261-4354-8295-53c76a7cec9c"
},
{
"email": "user2@getblueshift.com",
"campaign_uuid": "2ef5aa31-5261-4354-8295-53c76a7cec9c",
"email_attachments": ["http://mywebsite.com/file3.pdf"]
}
],
"email_attachments": ["http://mywebsite.com/file1.pdf", "http://mywebsite.com/file2.pdf"]
}' -u <USER API KEY>: https://api.getblueshift.com/api/v1/campaigns/bulk_execute