Meet Your New Personal Assistant: How to Use the UiPath Email Automation Bot!

Meet Your New Personal Assistant: How to Use the UiPath Email Automation Bot!

Our world is adapting to new realities. Resiliency is the key to the future – especially as we continue to change in a world that may continue to be unknown.

UiPath has always been preparing and planning for a “new normal” and the “future of work.” Robotic Process Automation (RPA) is one of the technologies that businesses have turned to deal with the stresses the 2019 novel coronavirus (COVID-19) has placed on them. RPA will now be a necessity for many organizations, and we are here to help you learn new skills to future proof your career.

To help you future proof your career and prepare for this new normal, we launched our Robot Pack. These innovative and customizable robots are your opportunities to get a jump start on your path to successful RPA. 

What is My Assistant?

It is necessary more than ever to have less distractions and increase our productivity. My Assistant is here to help. This robot has the power to give you what you need to be your best self at work and at home. By reducing spam, unimportant communications, and low-priority matters, the My Assistant bot is the ideal email solution for modern productivity.

How to use My Assistant: An email automation bot 

Email summary workflow

This workflow uses Google Cloud NLP and Microsoft Outlook integrations to create a summary of your unread emails and sends it back to you as single combined email.

1. Create a new blank project

Create a new blank project

2. Add new sequence element 

Add new sequence element

3. Change sequence name to Email Summaries by clicking on header

Change sequence name to Email Summaries by clicking on header
Change sequence name to Email Summaries by clicking on header

4. Add Get Outlook Mail Messages activity

Add Get Outlook Mail Messages activity
Add Get Outlook Mail Messages activity

5. Go to properties for new activity, click on MailMessage text field, and press Ctrl+K to create new variable, name it unreadMessages

unreadMessages

Result (click Variables button):

click Variables button

6. Add new Assign activity

Add new Assign activity

Paste "Summary of most recent 30 emails Ellipsis (...) means that some sentences were omitted from original" (with quotation marks) into left textbox

Summary of most recent 30 emails Ellipsis

Use Ctrl+K in right textbox to create new variable summaryEmail

create new variable summaryEmail

7. Add Send Outlook Email activity with properties specified below - add your own email, subject is: "Unread email summary" + DateTime.Now.ToString("MM-dd-yy")

Add Send Outlook Email activity

8. Check IsBodyHtml checkbox in activity properties (shows up when you highlight one):

Check IsBodyHtml checkbox

9. Try to run the result and ensure that you receive an email. If that works correctly, in the next part of the exercise we will add summaries.

Final stage

1. Add new For Each activity...

Add new For Each activity

...and specify TypeArgument to be MailMessage:

specify TypeArgument to be MailMessage

2. Add new Assign activity with summaryElement being the variable the value is added to and

string.Format("{0}Subject: {1}({2})" , summaryEmail, message.Subject, message.From.Address) being the value. 

3. Add another Assign activity with newly created variable singleEmailContents (use Ctrl+K) being the value and

System.Text.RegularExpressions.Regex.Replace(message.Body, "]*>", "") being the value assigned – latter is needed to remove any irrelevant markup from email. See screenshot below for steps 2-3.

Add another Assign activity

Add new Google text Analysis (part of UiPath.Cognitive.Activities package in package manager) activity with properties specified below: Do not forget to pick all the options for Analysis Type:

Add new Google text Analysis

Do not forget to pick all the options for Analysis Type:

pick all the options for Analysis Type

4. Add new DeserializeJson activity (part of UiPath.Web.Activities package in package manager).

Add new DeserializeJson activity

5. Finally, add activity for to empty singleEmailSummary variable.

singleEmailSummary variable

Congratulations! These steps enable the robot to retrieve your emails and send them for processing. Now, all we need to do is add steps that will extract partial data that is relevant and add to our summary.

Extracting relevant, partial data

1. Add For Each activity with If activity inside with parameters specified below:

For Each activity

(jsonObj("sentences").Take(15) we only look at first 15 or less sentences in email)

sentences in email

(Double.Parse(item("sentiment")("magnitude").ToString) > 0.4 to only pick sentences that are considered non-neutral in text, otherwise they will be skipped with ellipsis (…)).

non-neutral

(singleEmailSummary + item("text")("content").ToString.Trim + "." if sentence is relevant add it to summary)

singleEmailSummary

(if magnitude for the sentence was less than specified value, just add …)

2. Add new Assign activity to separate between workflow summaries, outside of internal For Each loop:

Assign activity

3. Add additional Assign activity to spend new summary to overall email:

Add additional Assign activity

Entities in text

This section will allow you to setup part of email that contains terms that are mentioned in email.

1. Add new Assign activity under original For each loop, to create a Keywords section:

create a Keywords section

2. Add new For Each activity to iterate over entities identified by text analysis (those are by default sorted in descending Salience order, and we want to pick words that are most relevant):

Iterate over entities identified by text analysis

3. Add If activity with Assign activity embedded:

Add If activity with Assign activity embedded

Check out this demo video created by our Presales Engineer Russel Alfeche:

Demo video created by Presales Engineer Russel Alfeche

If you get stuck on any of the steps, make sure to visit our Forum and search for answers using the search function. If you can’t find an answer to your question, we encourage you to post a new topic. Stay tuned for my next Work From Home Robot Pack blog post!

judy lee uipath
Judy Lee

Product Marketing Manager, UiPath