JSONLead Examples
Embedding a JSONLead in a HTML Email
It is a best practice to surround the JSONLead with a div with the attribute id=”jsonlead” (i.e <div id=”jsonlead“>). This allows JSONLead parsers to easily retrieve the DOM element containing the JSONLead.
<html>
<body>
<h3>Customer Data:</h3>
<ul>
<li>Name: John Doe</li>
<li>Email: johndoe@example.com</li>
<li>Phone Number: (555) 555-5555</li>
</ul>
<h3>Vehicle:</h3>
<ul>
<li>Make: Toyota</li>
<li>Model: Corolla</li>
<li>Version: VVTI</li>
<li>Year: 2006</li>
<li>Horsepower: 110</li>
<li>Url: https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html</li>
</ul>
<h3>Customer inquiry</h3>
<p>Hi, is this vehicle still available?</p>
<div id="jsonlead">
{
"version": "1.0.0",
"client": {
"first_name": "John",
"last_name": "Doe",
"email": "johndoe@example.com",
"phone": "(555) 555-5555"
},
"sales_lead": {
"car": {
"make": "Toyota",
"model": "Corolla",
"version": "VVTI",
"year": 2006,
"horsepower": 110,
"url": "https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html"
},
"inquiry": "Hi, is this vehicle still available?"
}
}
</div>
</body>
</html>
<html>
<body>
<h3>Customer Data:</h3>
<ul>
<li>Name: John Doe</li>
<li>Email: johndoe@example.com</li>
<li>Phone Number: (555) 555-5555</li>
</ul>
<h3>Vehicle:</h3>
<ul>
<li>Make: Toyota</li>
<li>Model: Corolla</li>
<li>Version: VVTI</li>
<li>Year: 2006</li>
<li>Horsepower: 110</li>
<li>Url: https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html</li>
</ul>
<h3>Customer inquiry</h3>
<p>Hi, is this vehicle still available?</p>
<div id="jsonlead">
{
"version": "https://jsonlead.org/2.0.0/schema",
"customer": {
"contacts": [
{
"phones": [
"5555551234"
],
"emails": [
"john@gmail.com"
],
"name": {
"first_name": "John",
"salutation": "Mr",
"gender": "male",
"last_name": "Doe"
}
]
},
"sales_lead": {
"vehicles": [
{
"prices": [],
"colors": [],
"urls": [
"https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html"
],
"media": [],
"equipment": [],
"quantity": 1,
"type": "used",
"category": "car",
"make": "Toyota",
"model": "Corolla",
"version": "VVTI",
"year": 2002,
"horsepower": 110
}
],
"inquiry": "Hi, is this vehicle still available?"
}
}
</div>
</body>
</html>
Including custom fields within a JSONLead
To include a custom field that is not part of the JSONLead Schema use the custom key whose value will be an JSON. The values allowed in the custom object can only be one of the following: String, Array, Numbers –objects are not permited within the custom object.
Here is an example of how to add a pet’s name as a custom of “customer” and the id from a DMS inside the Sales Lead.
JSONLead - Lead with appointments
Include a service or lead appointment within the lead document like so:
Note: Dates are in ISO Date 8601
JSONLead - Lead with a task
You can specify tasks to be associated with a lead like so:
JSONLead as a payload API
Some Lead Managers implement an API endpoint to parse JSONLead’s. Simple send the JSONLead as the payload of a POST HTTP Request. Here is a curl example:
curl -d '{"client": {"first_name": "John"},"sales_lead": \
{"car": {"make" : "Ford"}},"version": "1.0.0"}' \
-H "Content-Type: application/json" \
-X POST http://www.exampleCRM.com/saveLead
Some Lead Managers implement an API endpoint to parse JSONLead’s. Simple send the JSONLead as the payload of a POST HTTP Request. Here is a curl example:
curl -d '{ "version": "https://jsonlead.org/2.0.0/schema", "customer": { "contacts": [ { "phones": [ "5555551234" ], "emails": [ "john@gmail.com" ], "name": { "first_name": "John", "salutation": "Mr", "gender": "male" } } ] }, "sales_lead": { "vehicles": [ { "quantity": 1, "type": "used", "category": "car", "make": "Ford" } ] } }' \ -H "Content-Type: application/json" \ -X POST http://www.exampleCRM.com/saveLead
Embedding a JSONLead in a plain-text Email
In plain text, JSONLead needs to be surrounded by the tag “[jsonlead]”. This allows JSONLead parsers to easily retrieve the DOM element containing the JSONLead.
Customer:
Name: John Doe
Email: johndoe@example.com
Phone: (555) 555-5555
Interested in Vehicle:
Make: Toyota
Model: Corolla
Version: VVTI
Year: 2006
Horepower: 110
Url: https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html
Customer inquiry:
Hi, is this vehicle still available?
[jsonlead]
{
"version": "1.0.0",
"client": {
"first_name": "John",
"last_name": "Doe",
"email": "johndoe@example.com",
"phone": "(555) 555-5555"
},
"sales_lead": {
"car": {
"make": "Toyota",
"model": "Corolla",
"version": "VVTI",
"year": 2006,
"horsepower": 110,
"url": "https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html"
},
"inquiry": "Hi, is this vehicle still available?"
}
}
[jsonlead]
Customer:
Name: John Doe
Email: johndoe@example.com
Phone: (555) 555-5555
Interested in Vehicle:
Make: Toyota
Model: Corolla
Version: VVTI
Year: 2006
Horepower: 110
Url: https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html
Customer inquiry:
Hi, is this vehicle still available?
[jsonlead]
{
"version": "https://jsonlead.org/2.0.0/schema",
"customer": {
"contacts": [
{
"phones": [
"5555551234"
],
"emails": [
"john@gmail.com"
],
"name": {
"first_name": "John",
"salutation": "Mr",
"gender": "male",
"last_name": "Doe"
}
]
},
"sales_lead": {
"vehicles": [
{
"prices": [],
"colors": [],
"urls": [
"https://www.mydealerwebsite.com/toyota-corolla-2006-gasoline-vvti.html"
],
"media": [],
"equipment": [],
"quantity": 1,
"type": "used",
"category": "car",
"make": "Toyota",
"model": "Corolla",
"version": "VVTI",
"year": 2002,
"horsepower": 110
}
],
"inquiry": "Hi, is this vehicle still available?"
}
}
[jsonlead]
Created with the purpose of simplifying life