JSONPath: Difference between revisions
Line 71: | Line 71: | ||
*As a result, the necessary data from the email in JSON format was transferred to Planfix: | *As a result, the necessary data from the email in JSON format was transferred to Planfix: | ||
https://s.pfx.so/pf/ | https://s.pfx.so/pf/nG/dL1P6b.jpg | ||
== Go To == | == Go To == |
Revision as of 09:12, 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: