Email rules: Extracting data: Difference between revisions
No edit summary |
|||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Extracting data is the second block in the rules for processing emails, which you must fill out when creating a rule | {{#seo: | ||
|title=Email rules: Extracting data | |||
|titlemode=append | |||
|keywords=planfix, rules, email, tasks, extracting data from emails | |||
|description=email rules: extracting data | |||
}} | |||
'''Extracting data''' is the second block in the [[Rules for creating tasks by email|rules for processing emails]], which you must fill out when [[Creating and editing rules|creating a rule]]. | |||
You can extract data from different parts of the email: | |||
*Email subject+Body | |||
*Email subject | |||
*Body | |||
*Body(original email) - Only use this option if you control the email-sending process, have the original text before sending it, and are testing regular expressions or other data extraction methods. | |||
Data is extracted into '''infoblocks'''. These infoblocks have intuitive names, making it easier to work with them later in the process when populating task, contact, or data tag fields. In addition to a name, each infoblock contains instructions for extracting the part of the email that should go into it: | |||
https://s.pfx.so/pf/mV/pW1s08.jpg | |||
==Data extraction formats== | ==Data extraction formats== | ||
When extracting data, there are two ways for Planfix to analyze an email: | When extracting data, there are two ways for Planfix to analyze an email: | ||
https://s.pfx.so/pf/ | https://s.pfx.so/pf/dt/QFUoX8.jpg | ||
*'''Text''' — this usually corresponds to what you can see in your browser when you read the email. This is the most popular option. | |||
*''' | *'''HTML''' — all email contents will be analyzed, including markup. This option allows you to use fragments containing HTML tags to more accurately capture the desired content. | ||
*''' | *'''HTML-Table''' — Used for [[Extracting data from tables in emails|extracting data from tables]] in emails. | ||
*'''JSON''' — used for parsing if the message text is in JSON. Read more about this in our [[JSONPath]] help section. | *'''JSON''' — used for parsing if the message text is in JSON. Read more about this in our [[JSONPath]] help section. | ||
*'''XML''' — Used for storing and transferring data and is often used when exchanging data via the [[API|Planfix API]]. | |||
==Data extraction methods== | ==Data extraction methods== | ||
You can use one of the available options: | |||
https://s.pfx.so/pf/2I/CQyWGR.jpg | |||
https://s.pfx.so/pf/ | |||
*'''From label to end of line''' - the infoblock will contain the fragment of the email starting immediately after the label you specify and ending with a newline character or the end of the email. Leading spaces (if any) and the newline character will not be included in the infoblock. | *'''From label to end of line''' - the infoblock will contain the fragment of the email starting immediately after the label you specify and ending with a newline character or the end of the email. Leading spaces (if any) and the newline character will not be included in the infoblock. | ||
*'''From label to label''' - the infoblock will contain the fragment of the email starting immediately after the start label you specify and ending with the final symbol before the end label. Leading and trailing spaces will be ignored. | *'''From label to label''' - the infoblock will contain the fragment of the email starting immediately after the start label you specify and ending with the final symbol before the end label. Leading and trailing spaces will be ignored. | ||
*'''From label to end of line''' - the info block contains the email fragment that starts on the new line after the label you specified. Leading and trailing spaces will be ignored. | |||
*'''Regular expression''' - the infoblock will contain a fragment of the email according to a [[regular expression]] you input. | *'''Regular expression''' - the infoblock will contain a fragment of the email according to a [[regular expression]] you input. | ||
*'''All contents''' - the infoblock will contain the entire content of the email . | |||
==Examples== | ==Examples== | ||
Let's say an email is sent to Planfix with the following body: | Let's say an email is sent to Planfix with the following body: | ||
https://s.pfx.so/pf/BK/V6V153.jpg | |||
https://s.pfx.so/pf/ | |||
The configuration for the infoblock for extracting the customer's phone number from this email would be as follows: | The configuration for the infoblock for extracting the customer's phone number from this email would be as follows: | ||
https://s.pfx.so/pf/sV/U1dqar.jpg | |||
Once this has been processed, an infoblock will be created called Phone, containing +16888933044. | |||
To extract multiple lines from the order that are listed in the email, use the following setup: | To extract multiple lines from the order that are listed in the email, use the following setup: | ||
https://s.pfx.so/pf/4u/wXosec.jpg | |||
https://s.pfx.so/pf/ | |||
Once this has been processed, three infoblocks are created with the following contents: | Once this has been processed, three infoblocks are created with the following contents: | ||
*'''Product name:''' | *'''Product name:''' Toyo r888 | ||
*'''Product price:''' | *'''Product price:''' 500 | ||
*''' | *'''Amount:''' 2 | ||
==Important== | |||
*Later in the mail parsing rule, the [[Email rules: Main operation | main]] operation and [[Email rules: Additional operations | additional]] operations will use these infoblocks to select tasks, contacts, and data tags and populate their fields with data. (For examples, see the corresponding help section articles.) | |||
*Data from incoming emails in Planfix can be further [[Calculate Infoblock|processed]] before use. | |||
== Go To == | == Go To == |
Latest revision as of 06:28, 16 August 2024
Extracting data is the second block in the rules for processing emails, which you must fill out when creating a rule.
You can extract data from different parts of the email:
- Email subject+Body
- Email subject
- Body
- Body(original email) - Only use this option if you control the email-sending process, have the original text before sending it, and are testing regular expressions or other data extraction methods.
Data is extracted into infoblocks. These infoblocks have intuitive names, making it easier to work with them later in the process when populating task, contact, or data tag fields. In addition to a name, each infoblock contains instructions for extracting the part of the email that should go into it:
Data extraction formats
When extracting data, there are two ways for Planfix to analyze an email:
- Text — this usually corresponds to what you can see in your browser when you read the email. This is the most popular option.
- HTML — all email contents will be analyzed, including markup. This option allows you to use fragments containing HTML tags to more accurately capture the desired content.
- HTML-Table — Used for extracting data from tables in emails.
- JSON — used for parsing if the message text is in JSON. Read more about this in our JSONPath help section.
- XML — Used for storing and transferring data and is often used when exchanging data via the Planfix API.
Data extraction methods
You can use one of the available options:
- From label to end of line - the infoblock will contain the fragment of the email starting immediately after the label you specify and ending with a newline character or the end of the email. Leading spaces (if any) and the newline character will not be included in the infoblock.
- From label to label - the infoblock will contain the fragment of the email starting immediately after the start label you specify and ending with the final symbol before the end label. Leading and trailing spaces will be ignored.
- From label to end of line - the info block contains the email fragment that starts on the new line after the label you specified. Leading and trailing spaces will be ignored.
- Regular expression - the infoblock will contain a fragment of the email according to a regular expression you input.
- All contents - the infoblock will contain the entire content of the email .
Examples
Let's say an email is sent to Planfix with the following body:
The configuration for the infoblock for extracting the customer's phone number from this email would be as follows:
Once this has been processed, an infoblock will be created called Phone, containing +16888933044.
To extract multiple lines from the order that are listed in the email, use the following setup:
Once this has been processed, three infoblocks are created with the following contents:
- Product name: Toyo r888
- Product price: 500
- Amount: 2
Important
- Later in the mail parsing rule, the main operation and additional operations will use these infoblocks to select tasks, contacts, and data tags and populate their fields with data. (For examples, see the corresponding help section articles.)
- Data from incoming emails in Planfix can be further processed before use.