Leads

Creating a lead with a location search

This guide explains the method of creating a lead in the PowerChord platform by passing a location search.
This guide assumes that you already have a service account and have authenticated. Please refer to Authentication if you haven't authorized your service account.

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.

  1. 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
  2. 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.
This article goes into depth for Option 2.

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:

  1. trunkID
  2. locatorID

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.

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:

FieldEffect
Maximum RadiusOnly locations within this radius will be returned by the search.
Eligibility TagIf 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

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

PropertyLocator TypeTypeDescription
searchText- Radius Only
- Regions, Territories and Radius
stringIf 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
postalCodeRegions and Territories OnlystringOnly for region and territory logic based locator searches! Used to find a location assigned to the postalCode

Copyright © 2024