JSONPath: Difference between revisions
Line 84: | Line 84: | ||
"<span style="color:red;">date</span>": "26.04.2021 09:16:05",<br> | "<span style="color:red;">date</span>": "26.04.2021 09:16:05",<br> | ||
"status": "In progress",<br> | "status": "In progress",<br> | ||
"email": " | "email": "techT7@gmail.com",<br> | ||
"phone": "+ | "phone": "+1 211 906-4147",<br> | ||
"address": " | "address": "1109 SW 12th St1",<br> | ||
"price_total": " | "price_total": "466.45",<br> | ||
"item_order": [ | "item_order": [ | ||
</p> | </p> | ||
Line 93: | Line 93: | ||
<p style="padding-left:20px;"> | <p style="padding-left:20px;"> | ||
"sku": "598623",<br> | "sku": "598623",<br> | ||
"<span style="color:red;">name</span>": | "<span style="color:red;">name</span>": Cobalt drill bit set 29pc",<br> | ||
"barcode": "596325689126",<br> | "barcode": "596325689126",<br> | ||
"<span style="color:red;">price</span>": " | "<span style="color:red;">price</span>": "29.99",<br> | ||
"<span style="color:red;">quantity</span>": | "<span style="color:red;">quantity</span>": 5 | ||
</p> | </p> | ||
<p style="padding-left:10px;"> | <p style="padding-left:10px;"> | ||
Line 104: | Line 104: | ||
<p style="padding-left:20px;"> | <p style="padding-left:20px;"> | ||
"sku": "589624",<br> | "sku": "589624",<br> | ||
"name": " | "name": "High torque driver",<br> | ||
"barcode": "5963256858963",<br> | "barcode": "5963256858963",<br> | ||
"price": " | "price": "230.00",<br> | ||
"quantity": | "quantity": 1 | ||
</p> | </p> | ||
<p style="padding-left:10px;"> | <p style="padding-left:10px;"> | ||
Line 115: | Line 115: | ||
<p style="padding-left:20px;"> | <p style="padding-left:20px;"> | ||
"sku": "579824",<br> | "sku": "579824",<br> | ||
"name": " | "name": "Half inch ratchet 120 tooth",<br> | ||
"barcode": "5963256889634",<br> | "barcode": "5963256889634",<br> | ||
"price": " | "price": "43.25",<br> | ||
"quantity": | "quantity": 2 | ||
</p> | </p> | ||
<p style="padding-left:10px;"> | <p style="padding-left:10px;"> |
Revision as of 09:31, 26 November 2024
You can parse incoming emails or webhooks in Planfix with JSON. Emails sent to Planfix can be parsed using JSON. JavaScript Object Notation is a format for storing and exchanging information available as human-readable text. There are two main elements in a JSON object: the key and the value.
Example:
{"city":"New York", "country":"United States"}
- keys — city and country;
- values — New York and United States
Planfix can parse emails in this format and add the necessary data into info blocks using the JsonPath library. Note: If you use a function when parsing, make sure that you insert parenthesis at the end, otherwise the function will not work.
Example №1
Sending an Email with JSON Format to Planfix
- As an example, we'll use the following JSON:
{
"firstName": "Denis",
"lastName": "Evans",
"address": {
"streetAddress": "1109 SW 12th St",
"city": "Newport",
"postalCode": 97365
},
"phoneNumbers": [
"1-211-906-4147",
]
}
- Let's say we need the following data from the JSON:
{
"firstName": "Denis",
"lastName": "Evans",
"address": {
"streetAddress": "1109 SW 12th St",
"city": "Newport",
"postalCode": 97365
},
"phoneNumbers": [
"1-211-906-4147",
}
- We would configure the following rule for processing emails:
- Next, we create a new customer using the template, indicate which infoblocks to set from which fields, and add the contact to the task created from the email:
- As a result, the necessary data from the email in JSON format was transferred to Planfix:
Example №2
Adding JSON parameters to Planfix data tags
For this example, we'll use JSON from a product order in an online store. The data required for adding analytics is highlighted in red:
{
"site": "mysite.shop",
"name": "Denis Evans",
"id": "6598634",
"date": "26.04.2021 09:16:05",
"status": "In progress",
"email": "techT7@gmail.com",
"phone": "+1 211 906-4147",
"address": "1109 SW 12th St1",
"price_total": "466.45",
"item_order": [
{
"sku": "598623",
"name": Cobalt drill bit set 29pc",
"barcode": "596325689126",
"price": "29.99",
"quantity": 5
},
{
"sku": "589624",
"name": "High torque driver",
"barcode": "5963256858963",
"price": "230.00",
"quantity": 1
},
{
"sku": "579824",
"name": "Half inch ratchet 120 tooth",
"barcode": "5963256889634",
"price": "43.25",
"quantity": 2
}
]
}