Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Update an existing lead in Noojee Contact.

The timing of when the lead will be dialed depends on the normal lead prioritisation mechanism (priority, callback date, balance mode etc) however the lead won't be considered until the next dialer cache refresh occurs. Cache refreshes occur every two minutes, so on average, injected leads will take at least one minute before they will be considered for dialing.

As the UpdateLeadFast end point allows you to set a disposition, a lead may in fact never by dialed as you can close a lead out using the appropriate disposition.

The endpoint UpdateLeadFast replaces the original UpdateLead method. The new endpoint takes the same arguments but has enhanced error codes and as the name implies is faster than the original UpdateLead endpoint.

Performance considerations

Injection of leads into Noojee Campaigner . Lead data is to be POSTed and encoded as json.Entry point:is a 'heavy weight' process (it can take a long time) as each lead needs to be found, validated and updated.

In order to protect the core function of the PBX the end point is rate limited. The api allows multiple concurrent calls limited to (No. of hardware threads / 2) and each call we never complete in less than 100 ms. On larger databases the time required to complete each update may increase further.

Note: the rate limiting is across both the UpdateLeadFast and InsertLeadFast combined.

If you exceed the above rates, the system will queue additional requests. This may result in your call to the endpoint timing out (currently timeout is 1 minute). If your call to the InsertLead endpoint times out, then the lead will not be updated and you will need to retry the update.

Queue insertions

As the end point is rate limited we strongly recommend that you queue the updates within your system and include retry logic for when the update fails. This will deal with the above rate limiting logic as well as provide guaranteed delivery even if the Noojee PBX goes down for maintenance.

Retries

You must expect calls to UpdateLeadFast to fail so make certain your code can retry the action. If an update fails then wait a couple of minutes before retrying.

Entry point:

Lead data must be POSTed and encoded as json.

Code Block
linenumberstrue
https://<server host>/servicemanager/rest/CampaignAPI/updateLeadFast


URL Parameters:

ParameterDescription
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

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.

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.

njExternalLeadIdUsed to identify the lead to be updated

.

apiKeyapi key provided by Noojee Support

...

ParameterDescriptionRequired
njExternalLeadIdUsed to identify the lead to be updated.Yes
njDisposition

Disposition code. Any Dispositon Actions associated with the new Disposition (via the value in njDispositon) WILL be triggered .

Yes

If you don't want to update the existing disposition you may pass the value '<No Change>' instead of a disposition value. Note: THIS WILL FAIL if the lead has not been dialed (and therefore does not have a disposition). In this case you will get the error: DISPOSTION_ISNT_SET_AND_NOCHANGE_SPECIFIED. You must call updateLeadFast again specifying an actual disposition.

 IFYes
njCallBackDate

The date 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
Phone Number

Whilst not a system field, you MUST specify at least on of the phone fields. However if you don't want to change the existing field value you can simply pass the value '<No Change>' as the value for any phone field. Note: the angle brackets '<>' are required.

Yes



Sample queryCurl Example:


Code Block
linenumberstrue
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", "SecondPhone":"<No Change>", "njDisposition":"Sale"}' 'https://127.0.0.1:8080/servicemanager/rest/CampaignAPI/updateLeadupdateLeadFast?fTemplateId=41&fCampaignId=41&fAllocationId=38&njExternalLeadId=9856& apiKey=f863246a-973e-11e6-8784-08002718f5b5'

...

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

Error Codes

The API returns a HTTP status code and an json error code as follows:

HTTP status of 200 is returned when the lead was successfully inserted or updated.

HTTP status of 400 is returned when you passed some invalid data.

HTTP status of 500 is returned if our system throws an exception (our code is broken).

CodeMessageHTTP statusDescription
0OK200The lead was successfully inserted or updated.
101COULDNT_FIND_THE_LEAD400For an update, the njExternalLeadId didn't match a lead
102NO_PHONE_FIELDS400For an import the lead doesn't have any phone numbers.
103EXCEPTION500
104DNC400The lead's phone numbers are on the DNC list
105DUPLICATE400There is already a lead with this phone number
106INVALID_DISPOSTION400When updating, the supplied disposition doesn't exist.
107DISPOSTION_ISNT_SET_AND_NOCHANGE_SPECIFIED400When updating a a lead the disposition can be omitted, and <NO CHANGE> specified. But this is an error condition if the lead doesn't already have a disposition.
108IMPORT_BUT_NOCHANGE_SPECIFIED400Tried to insert a lead but a field contained the value '<NO CHANGE>' which is only valid for updates.
109TIMEOUT_TOO_MANY_CONCURRENT_REQUESTS400

There are too many concurrent insert/update API requests. Wait a bit and then retry the insert/update.

Currently a call will timeout if it is delayed by more than 1 minute.

110LEAD_NOT_UPDATED_DUE_TO_CONFLICT400

The lead update caused a conflict with another update and failed. This usually means that a user was editing the lead whilst you were trying to update it via the api. This type of issues should be rare as in most cases the user will see the error not the api. When the user sees the error they will be given the opportunity to merge the two leads via a specialised merge lead screen. If the api recieves this error then you will need to manually intervene to ensure that data isn't over-written which a simply retry is likely to do.

111INVALID_TIMEZONE_SPECIFIED400The lead contained an unknown Contact Hours (timezone).
112DUPLICATE_EXTERNAL_ID400The value passed via njExternalLeadId already exists in the Campaign.
113EDIT_BUT_NO_EXTERNAL_ID_SUPPLIED400An external lead id was not passed in (njExternalLeadId)
114INVALID_CALLBACK_DATE_FORMAT400The supplied callback date is in an invalid format.
115ALLOCATIN_ID_REQUIRED400An valid Allocation ID was not passed in.
116TEMPLATE_ID_REQUIRED400A valid Campaign Template ID was not passed in.
117CAMPAIGN_ID_REQUIRED400A valid Campaign ID was not passed in.