Lead Offers
Lead offer notifications that either will be sent or have already been sent to users.
Below you'll find examples for managing lead offers in the following ways:
The following fields relate to the Lead Offers endpoint.
Field | Limits | Required? | Writeable? |
---|---|---|---|
id | Yes | No | |
Unique ID of the lead offer. | |||
lead | Yes | No | |
The lead being offered | |||
user | No | No | |
The user that the lead is being offered to | |||
notify_at | No | No | |
The date and time at which the lead offer is sent to the user. | |||
rank | No | No | |
Only applicable if the ordering method by which lead offer alerts are sent was based on rank. A user with a lower rank would be among the first to receive a lead offer | |||
assign_automatically | Yes | No | |
Whether the lead is assigned to the user automatically or if user had to manually claim the lead | |||
has_call_alert | No | No | |
Whether or not the user is notified of a lead alert by phone call | |||
has_text_alert | No | No | |
Whether or not the user is notified of a lead alert by SMS | |||
has_email_alert | No | No | |
Whether or not the user is notified of a lead alert by email | |||
team | No | No | |
The team that the user belongs to |
Submit one Lead Offer
When a new lead is submitted, this /leads/:id/offers endpoint should be used to schedule notifications for members of a team.
A lead offer is created based on the following preexisting information:
- The user is the creator of the lead
- Distribution target specified in the lead (Must equal to "Team Rollout")
- Team member distribution options for a team that was created by the current user
- Any offers for the specified lead that have already been sent
To submit one lead offer:
POST an empty request object to /leads/:id/offers to distribute to the team specified in the lead routing. The routing method depends on the team selection method:
Specific Team
: lead offers are sent to the specifiedteam_id
Zipcode
: lead offers are sent to the team whose zipcodes match the zipcode specified in the lead.
Teams should all have mutually exclusive zipcodes. If two teams have the same zipcode, the team that was created first will receive the lead offers.
Get One Lead Offer
To get one lead offer:
GET https://api-v2.liondesk.com//leads/3/offers
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
The response object will have this form:{
"id": 1,
"lead": {
"id": 2,
"distribution_target": "Team Rollout",
"contact": {
"id": 2,
"first_name": "Mary",
"last_name": "Jackson"
}
},
"user": {
"id": 5,
"first_name": "Dorothy",
"last_name": "Vaughan",
"email": "dot@example.com"
},
"notify_at": "2018-01-16T09:09:09.000Z",
"rank": "3",
"assign_automatically": "true",
"has_call_alert": "true",
"has_text_alert": "false",
"has_email_alert": "true",
"team": {
"id": 6,
"name": "IBM"
}
}
Find All Lead Offers
Retrieves all lead offers that:
- have been sent to the user making the query
- have been sent to members of teams that the querying user created
Note that records may represent past records or offers that have yet to be sent out, depending on the value of notify_at
.
You find/search lead offers by issuing a GET
request to the base endpoint:
GET https://api-v2.liondesk.com//leads/3/offers
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
The response will contain an array of lead offer objects, like so:
{
"total": 2,
"limit": 10,
"skip": 0,
"data": [
{
"id": 1,
"lead": {
"id": 2,
"distribution_target": "Team Rollout",
"contact": {
"id": 2,
"first_name": "Mary",
"last_name": "Jackson"
}
},
"user": {
"id": 5,
"first_name": "Dorothy",
"last_name": "Vaughan",
"email": "dot@example.com"
},
"notify_at": "2018-01-16T09:09:09.000Z",
"rank": "3",
"assign_automatically": "true",
"has_call_alert": "true",
"has_text_alert": "false",
"has_email_alert": "true",
"team": {
"id": 6,
"name": "IBM"
}
},
{
"id": 2,
"lead": {
"id": 45,
"distribution_target": "Team Rollout",
"contact": {
"id": 2,
"first_name": "John",
"last_name": "Glenn"
}
},
"user": {
"id": 2,
"first_name": "Katherine",
"last_name": "Johnson",
"email": "kathy@example.com"
},
"notify_at": "2018-12-01T08:08:08.000Z",
"rank": "10",
"assign_automatically": "false",
"has_call_alert": "false",
"has_text_alert": "true",
"has_email_alert": "false",
"team": {
"id": 9,
"name": "NASA"
}
}
]
}
Filtering Lead Offers
The following filtering operators may be mixed and matched as desired.
Equality
You may query lead offer fields directly by specifying equality parameters in the request URI:GET /leads/3/offers?rank=1&assign_automatically=true
You may wish to exclude results having some value with $ne:GET /leads/3/offers?team_id[$ne]=3
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 /leads/3/offers?$limit=2
$skip will skip the specified number of results, useful for paginating:GET /leads/3/offers?team_id=3&$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 /leads/3/offers?$limit=10&$sort[notify_at]=-1
Inclusion / Exclusion
Find all records where the property values are ($in) some set:GET /leads/3/offers?team_id[$in]=4
If the column matches any of the given values, the resource shall be returned.
Similarly, you may exclude certain values with ($nin):GET /leads/3/offers?team_id[$nin]=4
Comparisons
You may use the less-than $lt and less-than-or-equal $lte operators to filter your queries: GET /leads/3/offers?notify_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 /leads/3/offers?notify_at[$gte]=2018-05-07T10:00:00-07:00
You may also combine these operators to query for a range of values: GET /leads/3/offers?notify_at[$gte]=2017-01-01¬ify_at[$lte]=2017-01-31T00:00:00Z