Campaigns
Campaigns are essentially buckets of actions. When a campaign is started for a contact, each of the actions is scheduled to occur at a time relative to the campaign's initiation.
The following fields relate to the Campaigns endpoint.
Field | Limits | Required? | Writeable? |
---|---|---|---|
id | No | No | |
The ID of the campaign | |||
name | Yes | Yes | |
The name of the campaign | |||
created_at | No | No | |
The date and time at which the campaign was created | |||
modified_at | No | No | |
The date and time at which the campaign was last modified | |||
is_broker_sharing_on | No | Yes | |
Set this value to true if the broker would like the campaign to be viewable by sub-accounts, otherwise this should be set to false | |||
is_default | No | No | |
True or false depending on if the campaign is a default campaign provided by LionDesk | |||
is_shared_by_broker | No | No | |
If the user querying the API is a sub-account and the campaign has been shared by the broker this will be true, otherwise it will be false |
Submit one Campaign
Note that an error will occur if the user attemps to create a campaign with a name that already exists
POST https://api-v2.liondesk.com//campaigns
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
The request object should have this form:{
"name": "LionDesk: General Buyer Drip",
"is_broker_sharing_on": true
}
Update one Campaign
Only the campaign owner is able to modify a campaign
To update some attributes on one campaign:
PATCH https://api-v2.liondesk.com//campaigns/10
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
data: { name: "LionDesk: General Buyer Drip", is_broker_sharing_on: "true"}
Get One Campaign
To get one campaign:
GET https://api-v2.liondesk.com//campaigns/1
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
The response object will have this form:{
"id": 1,
"name": "LionDesk: General Buyer Drip",
"created_at": "2017-07-08T11:11:11.000Z",
"modified_at": "2018-01-16T12:12:12.000Z",
"is_broker_sharing_on": true,
"is_default": true,
"is_shared_by_broker": true
}
Find All Campaigns
You find/search campaigns by issuing a GET
request to the base endpoint:
GET https://api-v2.liondesk.com//campaigns
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
This endpoint contains campaigns that were either created by the user or shared by the user's broker
{
"total": 2,
"limit": 10,
"skip": 0,
"data": [
{
"id": 1,
"name": "LionDesk: General Buyer Drip",
"created_at": "2017-07-08T11:11:11.000Z",
"modified_at": "2018-01-16T12:12:12.000Z",
"is_broker_sharing_on": true,
"is_default": true,
"is_shared_by_broker": true
},
{
"id": 3,
"name": "Zillow Lead Drip",
"created_at": "2017-12-16T08:08:08.000Z",
"modified_at": "2018-12-01T07:07:07.000Z",
"is_broker_sharing_on": false,
"is_default": false,
"is_shared_by_broker": false
}
]
}
Filtering Campaigns
The following filtering operators may be mixed and matched as desired.
Equality
You may query campaign fields directly by specifying equality parameters in the request URI:GET /campaigns?name=LionDesk Default Drip Campaign&is_default=true
You may wish to exclude results having some value with $ne:GET /campaigns?is_broker_sharing_on[$ne]=false
Dates & Times
Unless otherwise stated all dates and times should be in ISO8601 format. Examples: 2012-09-27, 2012-09-27T09:15:00Z (UTC), 2012-09-27T09:15:00-07:00 (PDT)
Limiting and Pagination
$limit will return only the number of results you specify: GET /campaigns?$limit=2
$skip will skip the specified number of results, useful for paginating:GET /campaigns?is_broker_sharing_on=false&$limit=2&$skip=2
Sorting
$sort will order results based on the field given.
Use 1 for ascending order, and -1 for descending order:GET /campaigns?$limit=10&$sort[created_at]=-1
Inclusion / Exclusion
Find all records where the property values are ($in) some set:GET /campaigns?name[$in]=Realtor Drip Campaign&name[$in]=CRM Drip Campaign
If the column matches any of the given values, the resource shall be returned.
Similarly, you may exclude certain values with ($nin):GET /campaigns?name[$nin]=Realtor Drip Campaign&name[$nin]=CRM Drip Campaign
Comparisons
You may use the less-than $lt and less-than-or-equal $lte operators to filter your queries: GET /campaigns?created_at[$lt]=2020-01-01T00:00:00Z
Similarly, you may use greater-than $gt and greater-than-or-equal $gte operators to filter your queries: GET /campaigns?created_at[$gte]=2018-05-07T10:00:00-07:00
You may also combine these operators to query for a range of values: GET /campaigns?created_at[$gte]=2017-01-01&created_at[$lte]=2017-01-31T00:00:00Z
Remove
Campaigns can only be removed by the campaign's owner
Campaigns can be removed with a delete request.
DELETE https://api-v2.liondesk.com//campaigns/920
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}