Campaigns
Get all campaigns
GET /campaigns
Query string parameters
status
string- Can be
sent
,draft
orpending
- Can be
types
string - Comma separated list of campaign types.- Can be
email
,telephone
orletter
- Can be
teams
integer - Comma separated list of ids.- Supports Pagination
- Supports Searching
Deprecated parameters
type
in favor oftypes
- Removal: 2018/10/01
Response
Status code 200
{
"data": [
{
"id": "fab657f1-40de-4dec-bad5-a577ef4e4b05",
"user": {
"id": 1,
"first_name": "Doe",
"last_name": "John",
"phone_number": "+4588888888",
"job_title": "Animal",
"email": "info@easir.com",
"profile_picture": "http://api.randomuser.me/portraits/thumb/women/5.jpg",
"created_at": "2014-01-01 12:45:56",
"updated_at": "2014-01-02 00:11:22"
},
"team_id": 1,
"group_id": null,
"scope": "global",
"name": "Campaign name",
"approved" : true,
"description": "Some text to describe the campaign.",
"type": "email",
"message": {
"subject": "Campaign subject"
},
"template": {
"id": 2,
"type": "email",
"company_id": 1,
"title": "Email template",
"user_id": 1
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"sent_at": null,
"total_sent" : null,
"send_at": "2015-11-30 00:00:00",
"total_sent" : null,
"task": {
"distribution_strategy": "distribute",
"distribute_users": [
{
"id": 2,
"first_name": "Florian",
"last_name": "Walter",
"phone_number": "300.010.4731x3314",
"job_title": "Data Miner",
"email": "something@example.com",
"profile_picture": null,
"created_at": "2014-09-16 01:23:22",
"updated_at": "2015-02-11 10:58:41"
}
],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2015-11-30 00:00:01",
"end_at": "2015-11-30 00:00:02"
},
"created_at": "2015-07-29 11:20:32",
"updated_at": "2015-07-29 11:20:32"
}
],
"pagination": {
"total": 5,
"page": 1,
"per_page": 15,
"urls": {
"previous": null,
"next": null
}
}
}
Get a campaign
GET /campaigns/:campaign_id
Response
Status code 200
{
"id": "fab657f1-40de-4dec-bad5-a577ef4e4b05",
"user": {
"id": 1,
"first_name": "Doe",
"last_name": "John",
"phone_number": "+4588888888",
"job_title": "Animal",
"email": "info@easir.com",
"profile_picture": "http://api.randomuser.me/portraits/thumb/women/5.jpg",
"created_at": "2014-01-01 12:45:56",
"updated_at": "2014-01-02 00:11:22"
},
"team_id": 1,
"group_id": null,
"scope": "global",
"name": "Campaign name",
"approved" : true,
"description": "Some text to describe the campaign.",
"type": "email",
"message": {
"subject": "Campaign subject",
"content": "The content of the campaign body"
},
"template": {
"id": 2,
"type": "email",
"company_id": 1,
"title": "Email template",
"user_id": 1
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"sent_at": null,
"total_sent" : null,
"send_at": "2015-11-30 00:00:00",
"total_sent" : null,
"task": {
"distribution_strategy": "distribute",
"distribute_users": [
{
"id": 2,
"first_name": "Florian",
"last_name": "Walter",
"phone_number": "300.010.4731x3314",
"job_title": "Data Miner",
"email": "something@example.com",
"profile_picture": null,
"created_at": "2014-09-16 01:23:22",
"updated_at": "2015-02-11 10:58:41"
}
],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2015-11-30 00:00:01",
"end_at": "2015-11-30 00:00:02"
},
"created_at": "2015-07-29 11:20:32",
"updated_at": "2015-07-29 11:20:32"
}
Create a campaign
POST /campaigns
Note that a campaign domain will have to be set in the campaign settings before a campaign can be created.
Parameters
name
string- Required
description
stringapproved
bool * default:true
type
string- Can be
email
,letter
ortelephone
- Required
- Can be
message
array- Required when
approved
isfalse
* Required whentype
isemail
orletter
message.content
string * Required whenapproved
isfalse
* Required whentype
isemail
orletter
**message.subject
string- Required when
approved
isfalse
- Required when
type
isemail
- Required when
message.sender
string- Required when
approved
isfalse
- Required when
type
isemail
- Required when
- Required when
filter
- Supports
filters
section * Required whenapproved
istrue
- Supports
template_id
integer- Must be a valid template id, and the template type must match the
type
- Must be a valid template id, and the template type must match the
execute_now
boolean- Passing this flag set to
true
will trigger sending campaign immedietly ifapproved
istrue
- Passing this flag set to
send_at
date- Y-m-d H:i:s format
- Must be after now
- Required if
approved
is not present orapproved
is true - Not required if
execute_now
is present
task.distribution_strategy
string- Must be
distribute
- More will be added in the future
- Required if
task
is present
- Must be
task.distribute_users
array- Required if
task
is present
- Required if
task.relations_path
UUID- Must be a valid relations path id.
- Required if
task
is present
task.start_at
date- Y-m-d H:i:s format
- Must be after
send_at
- Required if
task
is present
task.end_at
date- Y-m-d H:i:s format
- Must be after
task.start_at
- Required if
task
is present
Payload
{
"name": "My campaign",
"description": "Some text to describe this campaign",
"approved" : true,
"type": "email",
"message": {
"content": "This is my content",
"subject": "This is my subject",
"sender": "example@easir.com"
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"template_id": 2,
"send_at": "2016-11-30 00:00:00",
"task": {
"distribution_strategy": "responsible_user",
"distribute_users": [4, 10, 34],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2016-11-30 00:00:01",
"end_at": "2016-11-30 00:00:02"
}
}
Response
Status code 201
{
"id": "60318269-aeec-4284-a6c1-10ca6ff38d68",
"user": {
"id": 1,
"first_name": "Doe",
"last_name": "John",
"phone_number": "+4588888888",
"job_title": "Animal",
"email": "info@easir.com",
"profile_picture": "http://api.randomuser.me/portraits/thumb/women/5.jpg",
"created_at": "2014-01-01 12:45:56",
"updated_at": "2014-01-02 00:11:22"
},
"team_id": 1,
"group_id": null,
"scope": "global",
"name": "My campaign",
"description": "Some text to describe this campaign",
"approved" : true,
"type": "email",
"message": {
"content": "This is my content",
"subject": "This is my subject"
},
"template": {
"id": 2,
"type": "email",
"company_id": 1,
"title": "Email template",
"user_id": 1
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"sent_at": null,
"total_sent" : null,
"send_at": "2016-11-30 00:00:00",
"total_sent" : null,
"task": {
"distribution_strategy": "responsible_user",
"distribute_users": [
{
"id": 4,
"first_name": "Dorris",
"last_name": "Hane",
"phone_number": "459-677-4978x26093",
"job_title": "Chief Data Officer",
"email": "dorris@easir.com",
"profile_picture": null,
"created_at": "2015-03-23 14:25:07",
"updated_at": "2015-06-16 13:43:17"
}
],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2016-11-30 00:00:01",
"end_at": "2016-11-30 00:00:02"
},
"created_at": "2015-07-30 07:01:24",
"updated_at": "2015-07-30 07:01:24"
}
Update a campaign
PUT /campaigns/:campaign_id
Note: You can't update a campaign that is already sent
Parameters
name
string- Required
description
stringapproved
bool * default:true
type
string- Can be
email
,letter
ortelephone
- Required
- Can be
message
array- Required when
approved
isfalse
* Required whentype
isemail
orletter
message.content
string * Required whenapproved
isfalse
* Required whentype
isemail
orletter
**message.subject
string- Required when
approved
isfalse
- Required when
type
isemail
- Required when
message.sender
string- Required when
approved
isfalse
- Required when
type
isemail
- Required when
- Required when
filter
- Supports
filters
section * Required whenapproved
istrue
- Supports
template_id
integer- Must be a valid template id, and the template type must match the
type
- Must be a valid template id, and the template type must match the
send_at
date- Y-m-d H:i:s format
- Must be after now
- Required if
approved
is not present orapproved
is true
task.distribution_strategy
string- Must be
distribute
- More will be added in the future
- Required if
task
is present
- Must be
task.distribute_users
array- Required if
task
is present
- Required if
task.relations_path
UUID- Must be a valid relations path id.
- Required if
task
is present
task.start_at
date- Y-m-d H:i:s format
- Must be after
send_at
- Required if
task
is present
task.end_at
date- Y-m-d H:i:s format
- Must be after
task.start_at
- Required if
task
is present
Payload
{
"name": "My campaign",
"description": "Some text to describe this campaign",
"approved" : true,
"type": "email",
"message": {
"content": "This is my content",
"subject": "This is my subject",
"sender": "example@easir.com"
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"template_id": 2,
"send_at": "2016-11-30 00:00:00",
"task": {
"distribution_strategy": "responsible_user",
"distribute_users": [4, 10, 34],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2016-11-30 00:00:01",
"end_at": "2016-11-30 00:00:02"
}
}
Response
Status code 200
{
"team_id": 1,
"group_id": null,
"scope": "global",
"name": "My campaign",
"description": "Some text to describe this campaign",
"approved" : true,
"type": "email",
"message": {
"content": "This is my content",
"subject": "This is my subject"
},
"filter": [
{
"field": "contact.fixed_fields.last_name",
"operator": "ct",
"value": "e"
}
],
"template_id": 2,
"send_at": "2016-11-30 00:00:00",
"task": {
"distribution_strategy": "responsible_user",
"distribute_users": [4, 10, 34],
"relations_path": "9eae431b-3d0f-4528-9c59-e9d1a40fcd04",
"start_at": "2016-11-30 00:00:01",
"end_at": "2016-11-30 00:00:02"
}
}
Copy a campaign
POST /campaigns/:campaign_id/copy
Response
Status code 201
{
"id": "ed065b6b-36e1-4849-9a4b-7e4aa884e96a",
"user": {
"id": 1,
"first_name": "Doe",
"last_name": "John",
"phone_number": "+4588888888",
"job_title": "Animal",
"email": "info@easir.com",
"email_notifications": false,
"profile_picture": "http://api.randomuser.me/portraits/thumb/women/5.jpg",
"created_at": "2016-01-01 12:45:56",
"updated_at": "2017-01-02 00:11:22"
},
"team_id": 1,
"group_id": null,
"scope": "global",
"name": "a campaign - copy",
"description": "",
"approved" : true,
"type": "email",
"message": {
"content": "fasko da ero va",
"subject": "Lorem ipsum",
"sender": "sa29@example.com"
},
"template": null,
"filter": [
{
"field": "contact.fixed_fields.email",
"value": "@easir.com",
"operator": "ct"
}
],
"sent_at": null,
"total_sent" : null,
"send_at": null,
"total_sent" : null,
"task": null,
"created_at": "2015-09-17 11:21:14",
"updated_at": "2015-09-17 11:21:14"
}
Delete a campaign
DELETE /campaigns/:campaign_id
You can't delete a campaign that is already sent!
Response
Status code 204
Get campaign messages
GET /campaigns/:campaign_id/messages/:campaign_message_id
When sending a email or letter campaign, you can get the actual content sent to a contact.
Response
Status code 200
{
"id": 1,
"campaign_id": "1390836c-5817-4c4d-897f-68c825005528",
"contact_id": "bf42dead-59df-472c-8ead-423012d12c23",
"content": "Campaign content",
"created_at": "2016-06-16 09:57:29",
"updated_at": "2016-06-16 09:57:29"
}
Letter campaign
GET /campaigns/:campaign_id/letters
If your campaign is of type letter
you will recieve a notification when we have created the PDF's.
When we are done, you can get a URL to a ZIP file with the PDF's. The URL is valid for 5 minutes!
Response
Status code 200
{
"url": "http://example.com/download_url"
}
Send test email
POST /campaigns/test-email
The request is the same as creating a campaign, but a different endpoint.
Parameters
email
- string- Required
- Supports same as Create campaign
Response
Status code 202 Queued
{
"email": "john.doe@example.com"
}
Send test email for existing
POST /campaigns/:campaign_id/test-email
Sends a mail with the campaign to a user-specified email for testing purposes.
Parameters
email
- string- Required
Payload
{
"email": "john.doe@example.com"
}
Response
Status code 202 Queued
{
"email": "john.doe@example.com"
}
Campaign settings
GET /campaigns/settings
Campaign domains
Campaigns can either be sent from a custom domain (domain
property), or using a subdomain of the easircampaigns.com
domain (domain_slug
property).
The custom domain will have the first priority, and if that isn't set, emails will have a from address in the form of noreply@[domain_slug].easircampaigns.com
.
Either domain
or domain_slug
will have to be set in order to create campaigns.
Response
Status code 200
{
"domain": "easir.com",
"domain_slug": "easir",
"domain_slug_suffix": "easircampaigns.com",
"consent": {
"enable": true,
"unsubscribe_url": "https://easir.com/unsubscribe"
}
}
Set campaign settings
PUT /campaigns/settings
Parameters
Campaign domain
domain_slug
string - The subdomain to send campaigns from. Will result in campaigns being sent from[domain_slug].easircampaigns.com
Custom consent settigns
consent.custom
boolean - Enable custom consent settingsconsent.unsubscribe_url
string - Consent URL for nonconsent. This will be used in the footer of campaign emails- Required when
consent.custom
is true
- Required when
Payload
{
"domain_slug": "easir",
"consent": {
"enable": true,
"unsubscribe_url": "https://easir.com/unsubscribe",
}
}
Response
Status code 200
domain
- Will be set if you have a custom domain to send campaigns from
{
"domain": "https://easir.com",
"domain_slug": "easir",
"consent": {
"enable": true,
"template_id": 2,
"subscribe_url": "https://easir.com/subscribe",
"unsubscribe_url": "https://easir.com/unsubscribe",
"subject": "subject",
"content": "content",
"help_text": "help text"
}
}
Get campaign recipients
GET /campaigns/:campaignId/recipients
Getting list of all recipients in campaign.
Query string parameters
- Supports Pagination
Response
Status code 200
{
"data": [
{
"id": "98388685-4b08-4321-b99c-80a73e620ca8",
"b2c": true,
"account": {
"id": "d4423996-bc55-4b58-a050-570379bb683b",
"name": "Felicity Padberg"
},
"user": {
"id": 2555,
"first_name": "Noe",
"last_name": "Emmerich",
"phone_number": "532-395-1749",
"job_title": "Sales Executive",
"email": "585676betty.mclaughlin@bartell.com",
"email_notifications": false,
"profile_picture": "https:\/\/randomuser.me\/api\/portraits\/thumb\/women\/woman\/28.jpg",
"system_user": false,
"created_at": "2018-03-22 10:09:05",
"updated_at": "2018-03-22 10:09:05"
},
"team_id": null,
"team": null,
"status": null,
"fixed_fields": [
{
"id": 17,
"type": "text",
"name": "salutation",
"label": "Salutation",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 27,
"type": "text",
"name": "state_region",
"label": "State\/Region",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 19,
"type": "text",
"name": "last_name",
"label": "Last name",
"value": "Mertz",
"validation": null,
"required": true,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 36,
"type": "text",
"name": "mobile_phone_number",
"label": "Mobile phone number",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 21,
"type": "text",
"name": "landline_phone_number",
"label": "Landline phone number",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 24,
"type": "text",
"name": "address",
"label": "Address",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 26,
"type": "text",
"name": "city",
"label": "City",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 18,
"type": "text",
"name": "first_name",
"label": "First name",
"value": "Maegan",
"validation": null,
"required": true,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 28,
"type": "single_choice",
"name": "country",
"label": "Country",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 20,
"type": "text",
"name": "email",
"label": "Email",
"value": null,
"validation": "email",
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 38,
"type": "date",
"name": "date_of_birth",
"label": "Date of Birth",
"value": null,
"validation": "date_before_tomorrow",
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 23,
"type": "text",
"name": "title",
"label": "Title",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 25,
"type": "text",
"name": "zip_code",
"label": "Zip code",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
}
],
"custom_fields": null,
"created_at": "2018-03-22 10:09:05",
"updated_at": "2018-03-22 10:09:05",
"latest_activity_at": null,
"social_profile": {},
"consent": {
"email": {
"consent_given": null,
"updated_at": ""
},
"letter": {
"consent_given": null,
"updated_at": ""
},
"call": {
"consent_given": null,
"updated_at": ""
},
"sms": {
"consent_given": null,
"updated_at": ""
}
}
},
{
"id": "63be135e-c9f6-4e83-9e26-68efd35dc806",
"b2c": true,
"account": {
"id": "01f81b59-68d6-4546-bdeb-9eb5d12d5dd7",
"name": "Christine Murray"
},
"user": {
"id": 2556,
"first_name": "Zelda",
"last_name": "Crist",
"phone_number": "1-663-855-6168 x834",
"job_title": "Sales Executive",
"email": "401005howell.hester@gmail.com",
"email_notifications": false,
"profile_picture": "https:\/\/randomuser.me\/api\/portraits\/thumb\/women\/woman\/3.jpg",
"system_user": false,
"created_at": "2018-03-22 10:09:05",
"updated_at": "2018-03-22 10:09:05"
},
"team_id": null,
"team": null,
"status": null,
"fixed_fields": [
{
"id": 17,
"type": "text",
"name": "salutation",
"label": "Salutation",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 27,
"type": "text",
"name": "state_region",
"label": "State\/Region",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 19,
"type": "text",
"name": "last_name",
"label": "Last name",
"value": "Vandervort",
"validation": null,
"required": true,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 36,
"type": "text",
"name": "mobile_phone_number",
"label": "Mobile phone number",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 21,
"type": "text",
"name": "landline_phone_number",
"label": "Landline phone number",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 24,
"type": "text",
"name": "address",
"label": "Address",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 26,
"type": "text",
"name": "city",
"label": "City",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 18,
"type": "text",
"name": "first_name",
"label": "First name",
"value": "Maximus",
"validation": null,
"required": true,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 28,
"type": "single_choice",
"name": "country",
"label": "Country",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 20,
"type": "text",
"name": "email",
"label": "Email",
"value": null,
"validation": "email",
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 38,
"type": "date",
"name": "date_of_birth",
"label": "Date of Birth",
"value": null,
"validation": "date_before_tomorrow",
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 23,
"type": "text",
"name": "title",
"label": "Title",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
},
{
"id": 25,
"type": "text",
"name": "zip_code",
"label": "Zip code",
"value": null,
"validation": null,
"required": false,
"hidden": false,
"read_only": false,
"sort_order": 0
}
],
"custom_fields": null,
"created_at": "2018-03-22 10:09:05",
"updated_at": "2018-03-22 10:09:05",
"latest_activity_at": null,
"social_profile": {},
"consent": {
"email": {
"consent_given": null,
"updated_at": ""
},
"letter": {
"consent_given": null,
"updated_at": ""
},
"call": {
"consent_given": null,
"updated_at": ""
},
"sms": {
"consent_given": null,
"updated_at": ""
}
}
}
],
"pagination": {
"total": 2,
"page": 1,
"per_page": 15,
"urls": {
"previous": null,
"next": null
}
}
}
Export campaign recipients
GET /campaigns/:campaignId/recipients/export
Exporting list of all recipients in campaign to xlsx (Excel) file.
Response
Status code 202
{
"export_id": "f6ff892b-a661-4fd8-8d77-dcc35d3870f2",
"file_id": null,
"status": "pending"
}
Fetch the export for campaign recipients
GET /campaigns/:campaignId/recipients/export/:exportId
When the export is marked as done
you will get the fileId which you can then use to download the file. See Files.
Statuses
pending
- Waiting to be executedfailed
- The export has faileddone
- The export has been succesfully completed
Response
Status code 200
{
"export_id": "f6ff892b-a661-4fd8-8d77-dcc35d3870f2",
"file_id": "41896dbb-ff15-44d3-add1-d089905fc181",
"status": "done"
}