22.0 Insert Lead

NOTE: this method is now deprecated use InsertLeadFast instead.

Insert a new lead into the Noojee Campaigner. Lead data is to be POSTed and encoded as json.


Performance considerations

Injection of leads into Noojee Campaigner is a 'heavy weight' process (it can take a long time) as each lead needs to be de-duplicated and activated.

If you intend inserting any number of leads Noojee strongly recommends you use the 'InsertLeadFast' api instead of this one.

Concurrency

Only a single InsertLead can be run at a time (due to the need to de duplicate leads).

If someone is running a manual import the InsertLead call will fail, so be prepared to do retries.

Retries

You must expect calls to InsertLead to fail so make certain you code and retry the action. If an insert fails then wait a couple of minutes before retrying (a manual import will cause a insertion failure).

Entry point:

https://<server host>/servicemanager/rest/CampaignAPI/insertLead


Parameters:

ParameterDescriptionRequired
fTemplateId

Campaign Template id of the Template that the lead will be associated with.

See 16.0 Get Campaign Template List to obtain Template Id's

Yes
fCampaignId

Campaign id of the Campaign that the lead will be associated with.

See 17.0 Get Campaign List to obtain a list of campaign Id's.

Yes
fAllocationId

Allocation id of the Campaign that the lead will be associated with.

See 18.0 Get Allocation List to obtain a list of allocations.

Yes
allowDuplicatesIf true checking for duplicate phone numbers will NOT be performed .No
apiKeyapi key provided by Noojee SupportYes


System fields that can be part of the json data:

ParameterDescriptionRequired
njExternalLeadIdA reference, account number or the like taken from the external data source. Also used to identify lead when updates are made.No
njCallBackDate

The date and time on which the lead is to be called. If not specified the lead is treated as a 'new' lead and will be called on a first come first served basis.

Format is "yyyy/MM/dd HH:mm"

No
njPriorityA priority between 0 and 100. The lower the number the higher the priority. Higher priority leads will be called before lower priority calls. Default priority is 10.No
njContactHoursSets the Contact Hours for the lead. If not passed the lead will default to the Campaign Templates default Contact Hours.No


Insert a Single lead

curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST 
-d '{"Name":"Jane Smith","StreetAddress":"Suite 8/10 Hoddle St", "City": "Abbotsford", "State":"Vic", "PostCode":"3064"
, "FirstPhone":"0383218199"}' 
'https://<server host>/servicemanager/rest/CampaignAPI/insertLead?fTemplateId=41
&fCampaignId=41&fAllocationId=38&apiKey=f863246a-973e-11e6-8784-08002718f5b5&allowDuplicates=true'

Sample success response:

{"code":0,"message":"Imported 1 Updated 0 Rejected 0 leads.\n\nErrors (If any):\n
 Name,State,PostCode,FirstPhone,City,StreetAddress,Error Reason,\n"}

Curl Example

curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"Name":"Jane Smith","StreetAddress":"Suite 8/10 Hoddle St", "City": "Abbotsford", "State":"Vic", "PostCode":"3064", "FirstPhone":"0383218199"}' 'https://<server host>/servicemanager/rest/CampaignAPI/insertLead?fTemplateId=41&fCampaignId=41&fAllocationId=38&apiKey=f863246a-973e-11e6-8784-08002718f5b5&allowDuplicates=true'