Using Webhooks
Basic
You can configure your LeadPro account to send events to a designated endpoint when a lead is either created or updated. This is known as a 'webhook'.
To use the webhook functionality, you'll need to:
Create an endpoint to receive the data from LeadPro
Add the endpoint URL to the developers section of your dashboard
Once enabled, LeadPro will POST the event data to your endpoint as JSON. The payload contains two fields:
"event" – which can be either "lead.created" or “lead.updated”
"data" – which contains the lead data, and consists of the following fields:
| Field | Type | Example | Mandatory | Validation |
|---|---|---|---|---|
| id | Number | 1 | Yes | auto-generated |
| first_name | String | Richard | No | length : min 1 max 50 |
| last_name | String | Smith | No | length : min 1 max 50 |
| full_name | String | Richard Smith | Yes | length min 1 max 100 |
| String | richard.smith@gmail.com | Yes | valid email address | |
| phone | String | 07123456789 | Yes | length : max 255 ( only valid UK phone numbers will be called by autocaller) |
| type | String | vendor | Yes | either : 'sale', 'vendor', 'landlord', 'let', 'mortgage_request' |
| source | String | rightmove | No | you can submit a specific lead source only for /leads. If no source is submitted source will default to 'homepage'. |
| address | String | 51 Asimov Place, Starbridge | Yes if Vendor/Landlord/ Mortgage | length : max 100 |
| postcode | String | N1 3JY | Yes if Vendor/Landlord/ Mortgage | length : min 2 max 10 |
| advert_address | String | 51 Asimov Place, Starbridge | Yes if sale/let and no office_id is specified | length : max 100 |
| advert_postcode | String | N1 3JY | Yes if sale/let and no office_id is specified | length : min 2 max 10 |
| advert_url | String | https://www.site.com/result | No | length : max 255 |
| advert_image | String | https://via.placeholder.com/150 | No | length : max 255 |
| title | String | Mr | No | length : min 1 max 10 |
| message | String | When can I view this property? | No | length : max 8192 characters |
| appointment_availability | JSON | { hours: [ 2021-04-22T10:00:00.000Z, 2021-05-22T10:00:00.000Z, ] } | No | max JSON byte size 2048, array values must be ISO 8601 date string |
| meta | Record<String, String> | {“virtual tour”: “true”} | No | max JSON byte size 1024, object with only string values |
| questionnaire | String[][] | [[“Do you have property to sell?”, “yes”], [“When would you like to move”, “Before july”]] | No | max JSON byte size 2048, each value in questionnaire should be array of strings with 2 elements |
| parentId | Number | 54 | No | Must be a valid parent lead |
| createdAt | String(ISO 8601) | 2000-01-23T01:23:45.678+09:00 | No | not writeable |
| status | String | active | No | must be UNREAD, IN_PROGRESS, NO_BUSINESS, BUSINESS, DUPLICATE |
| stage | String | complete | No | must be NEW CONTACTED, KEEP_IN_TOUCH, LOST, NOT_CONTACTABLE, WON VALUATION_BOOKED, INSTRUCTED, VIEWING_BOOKED, REGISTERED, DUPLICATE, SPAM DELETED, |
| gdpr_checkbox | Boolean | false | No | N/A |
| host | String | https://valuation.mydomain.com | No | N/A |
| average_sale_estimation | Number | 10000 | No | max 2 decimal places |
| average_rent_estimation | Number | 1000000 | No | max 2 decimal places |
| office_id | Number | 567 | No | Must be a valid office_id |
| property_reference | String | 'your unique property reference' | If type 'sale' or 'let' | length: max 50 char |
| property_bedrooms | Number | 4 | No | N/A |
| office_name | String | Oxford | No | Read only |
| minimum_sale_estimation | Number | 10000 | No | max 2 decimal places |
| maximum_sale_estimation | Number | 233333 | No | max 2 decimal places |
| minimum_rent_estimation | Number | 55444333 | No | max 2 decimal places |
| maximum_rent_estimation | Number | 343444455 | No | max 2 decimal places |
| comparable_props | Object[] | { "address": "68 Uftwen Road", "beds": 4, "coords": { "x": -0.082544, "y": 51.5422 }, "date": "2021-02-10T00:00:00.000Z", "distance": 166, "months_ago": 7, "original_asking_price": 2150000, "price": 1782500, "time_taken_to_sell": 76 } | No | Not writeable |
| international | boolean | true | No | N/A |
| account_id | Number | 9999 | No | Not writeable |
| account_name | String | Skyline Estates | No | Not writeable |
| office_id | Number | 9999 | No | Not writeable |
| office_name | String | Oxford | No | Not writeable |
| referred_by_office_id | Number | 222 | No | Not writeable |
| referred_by_office_name | string | null | 'Oxford' | No | Not writeable |
| referred_by_account_id | number | null | 334 | No | Not writeable |
| referred_by_account_name | string | null | 'Lead Pro Ltd' | No | Not writeable |
| property_type | string | null | detached | No | only one of detached, semi-detached, terraced, flat-maisonette |
{
event: lead.updated,
data: {
id: 1,
title: "Sir",
first_name: "Richard",
last_name: "Branson",
email: "rbranson@virgin.com",
type: "vendor",
source: "homepage",
phone: 07123456789,
address: "51 Asimov Place, Starbridge",
postcode: "N1 3JY",
advert_address: "51 Asimov Place, Starbridge",
advert_postcode: "N1 3JY",
advert_image: "https://www.site.com/result",
advert_url: "https://via.placeholder.com/150",
appointment_availability: {
hours: ["2021-01-01T08:00:00.000Z", "2021-01-01T09:00:00.000Z"],
},
full_name: "Sir Ricard Branson",
message: "When can we view?",
meta: {
virtual tour: true
}
}
}Advanced
For additional security, you may wish to verify that the requests being made to your endpoint are coming from LeadPro. We include a JWT token in the "Authorization".
{
alg: "HS256",
typ: "JWT"
}The body of this token contains the full payload, and we recommend using this instead of the actual payload.
The token signature is the base64 encoding of the HS256 encrypted header and body. The key for verifying this signature is generated in the developers section of your dashboard under the webhook signing secret.
