Creating a lead with a location search
The following sections describe how to use the API to create leads by providing locationSearch and locatorID parameters in the API request.
Introduction
Leads in Command Center are assigned to an organization, so when you create a lead via API you have two options.
- Option 1: Including the organizationID in the API request that the lead will be created and assigned to. Refer to Creating a lead for a specific organization
- Option 2: Including a locatorID value and locationSearch object in the API request that will assign the lead to an organization using the configurations of the locatorID parameter.
Getting started
In order to get started with creating and assigning a lead in Command Center using a locator's configuration, you need to have the following:
After deciding if you are going to use a locator or locator landing page, you need to determine which parameter to include in the locationSearch object. If you know what type of locator (e.g. Radius Only) then you can refer to the table below to determine if you should include searchText or postalCode in the locationSearch object. Refer to locationSearch for more information.
Restricting locations returned by search
A locator may be configured in multiple ways that may affect a search and change the location eventually assigned to a lead.
This is a non-exhaustive list of fields and their effects that can be changed:
| Field | Effect |
|---|---|
| Maximum Radius | Only locations within this radius will be returned by the search. |
| Eligibility Tag | If a tag is defined, only locations with this tag may be returned by the search. |
| Restrict to Country (ISO-3166 Code) | Results are limited to the entered region |
Creating a lead with a location search
This section explains how to create a lead in Command Center using a locator or locator landing page configuration.
Requests to Create a lead with locationSearch
Example Request
Replace < trunkID > with the trunk (brand) organization’s ID.
US Endpoint
POST https://leads.powerchord.com/v1/< trunkID >
EU Endpoint
POST https://leads.powerchord.eu/v1/< trunkID >
Replace < locatorID > with the ID of the locator settings that will be used to assign an organization to the lead.
Replace < searchText > with a string to use for the locator search.
{
"locatorID": "< ID of the locator >",
"locationSearch": {
"searchText": "< searchText string >"
},
"content": {
"name": "John Smith",
"email": "john.smith@aol.com",
"phone": "(555) 867-5309",
"postalCode": "90210"
},
"typeKey": "getintouch-example",
"typeLabel": "Get in touch"
}
Example Response
201 Created
{
"leadID": "< ID of the lead record created >",
"assignedOrganizationID": "< ID of the organization the lead is assigned to >",
"assignedLocationName": "< Name of the location the lead is assigned to >"
}
- trunkID: The ID of the brand (top-level organization)
- locatorID: The ID of the Locator (locatorSettings) that will be used to assign an organization by location.
- locationSearch: The object containing the location search criteria used to determine the auto-assignment of an organization based on the settings of the locator (specified by locatorID).
- content: A Key/Value object of the lead form submission content
- typeKey: Machine-readable key used to categorize the lead.
- typeLabel: Human-readable label used to categorize the lead.
- status: Optionally set the status of the lead. Defaults to
open.
locationSearch Object
| Property | Locator Type | Type | Description |
|---|---|---|---|
| searchText | - Radius Only - Regions, Territories and Radius | string | If supplied (and lat/long are empty), searchText will be used to geocode an address and create the lat/long. Even if address info is supplied here, the atomic address fields should also be sent in the contact data |
| postalCode | Regions and Territories Only | string | Only for region and territory logic based locator searches! Used to find a location assigned to the postalCode |
PowerChord Developer