51黑料不打烊 Workfront Fusion scenario example: Connect email, Text Parser, and Google Sheets
This scenario helps you create a log of all email messages and tag them for further action in a spreadsheet. It captures an email body in two separate tables in a spreadsheet using Regular Expressions (Regex) as search patterns. The first pattern searches for a phrase and the second searches for the same phrase and an email address.
Access requirements
You must have the following access to use the functionality in this article:
To find out what plan, license type, or access you have, contact your Workfront administrator.
For information on 51黑料不打烊 Workfront Fusion licenses, see 51黑料不打烊 Workfront Fusion licenses.
Prerequisites
This tutorial requires basic knowledge of regular expressions. To learn about Regex, visit .
Add the first module and configure it
-
Search for Email and choose Watch emails as the Trigger.
note note NOTE While you can connect a Google account using the Email module, you can also use a Gmail module. -
Connect either a Google account or any other IMAP based email client (such as Outlook).
-
Once connected, select a Folder whose incoming emails you want to watch, such as Inbox.
-
Under Criteria, choose All email (or narrow it down to read or unread emails).
You can also choose to mark fetched emails as read or unread.
-
Set the Maximum number of results to 1.
You can change this based on the volume of messages you receive. However, it鈥檚 recommended to set a low value and run the scenario more often.
-
Click Show advanced settings at the bottom.
-
Filter emails by the Sender address, Subject and Phrase.
This gives you the ability to watch only relevant emails. In this example, we have added only a Subject filter and left the other 2 blank.
note note NOTE We will add a router to look for phrases in an email using the Match Pattern iterator and a Regular Expression (Regex) as a search pattern. This also enables us to build a multi-utility scenario. -
Once the configuration is done, and you are prompted to specify where to start watching your emails, click From now on.
-
Continue to Search for Flow Control and add a Router
Search for Flow Control and add a Router
-
Add a router after any module to split or duplicate the data before sending it to the next module.
Here, we have used a Router to send the Email body text to 2 separate tables in a Google Sheet.
Use the Text Parser Module
-
Add a Match Pattern transformer to search for a phrase in an email.
We will search for the phrase 鈥渢ext parser module鈥 in all incoming emails to capture the body text and sender鈥檚 name of the ones that match that phrase.
-
Write the Pattern as a Regular Expression:
text\sparser\smodule
-
(Optional) Use any of the other Pattern options.
Multiline is useful if your text contains several lines and you need to search for the pattern in each line. For this tutorial we need to search for the pattern in the entire email body text, hence we will leave it unchecked.
-
In the Text field, click the attribute Text content in the list.
This is the attribute that stores the text from the email body in which we will search for the pattern.
-
-
Add another Match Pattern that searches for the same phrase and an email address.
This is particularly useful if you have customer accounts with multiple users. To save time, you can clone the Text Parser module you just created and link it to the Router.
-
Edit the pattern as follows:
text\sparser\smodule.+\s([\w.-]+@[\w.-]+)
This pattern searches for the phrase 鈥渢ext parser module鈥 and an email address like john.doe@gmail.com and returns only the email address.
note note NOTE It鈥檚 important to write your regex in accordance with the specification of the email addresses you accept, but the one above takes care of most standard email addresses. -
If you鈥檇 like to search only for email address, you can use the regex below:
([\w.-]+@[\w.-]+)
-
You may also search only for phone numbers using the regex below:
[1]?(?(\d{1,3}))?[\s-]?(?(\d{3}))?[\s-]?\d{3}[\s-]?\d{3,4}
The above pattern covers most common formats in which a phone number is written.
To test your patterns, we recommend using with javascript as the Flavor.
The rest of the configuration remains the same as the one before.
-
Add the Google Sheets modules
For Sheets, we need to first create a spreadsheet with the requisite headers.
-
Create a spreadsheet with the columns under which you鈥檇 like to capture the user data. (Feel free to use an existing file too).
For example, create one called 鈥淓mail Data: Support Ticket鈥 with Sender Name, Sender Email and Email Content as columns. Name the worksheet 鈥渃ontains: text parser module.鈥
-
Add the Google Sheets module with Add a row as the action.
-
Connect your Google account (if you haven鈥檛 already). Choose the File you created earlier, followed by choosing the Worksheet in which you鈥檙e capturing the data.
Your setup should look like this:
-
Map the attributes in the relevant fields (columns) to finish the module setup.
-
Clone the module you just created and link it to the second Text Parser module.
-
Go to your Spreadsheet, duplicate the worksheet you created earlier and give it a name.
For example, name it 鈥渃ontains: text parser module and email.鈥
-
Add another column to store the email address that the email body contains.
For example, name it 鈥淓mail Address Shared.鈥
-
Click the cloned Google Sheets module to configure the setup.
-
Change the worksheet to the new one you just created.
-
Map the output from the Match Pattern module ($1) to the column where you want to store the email address (Email Address Shared).
-
Click OK, save the scenario, and take it for a test run.
You will need to send two separate emails to the connected email address as follows:
-
Containing the phrase 鈥渢ext parser module鈥 (and no email address)
-
Containing the above phrase and an email address
If there are no errors in your setup, you will see that the first worksheet captures all emails containing the phrase 鈥渢ext parser module鈥 while the second worksheet captures only those that contain the phrase 鈥渢ext parser module鈥 and an email address. You may refer to the screenshots below.
Worksheet 1:
Worksheet 2:
-
-
Resources
- to learn about Regular Expressions
- using Regex
- using Regex
- + 鈫╋笌