How to use ChatGPT to summarize your email Content in UiPath

In this article we will see how we can use Open AI to allow ChatGPT to summarize your email Content.

Many times it happens that you return from a long vacation and you find several long email thread in your mailbox. Instead of reading through each email, we can ask ChatGPT to summarize it and instantly you will have a one-liner sentence summary complete.

I am looping through emails in gmail and passing the email body to ChatGPT to summarize it.

Step 1:- We will use IMAP to get mail messages from Inbox in gmail.

Storing the output in GetMail variable.

image

Step 2:- Looping through each email and get the email body.

Step 3:- We will pass the EmailBody in the UserInput variable.

image

Step 4: - Pass the prompt & model paramater value.

Step 5:- Drag the HTTP request activity into the designer Panel.

image

Click on Configure button and configure the input from Open AI ChatGPT.

You will need an Open Key API which is free and easy to do.

API Reference — OpenAI API

Properties of HTTP Request Activity:-

Store the Output into the variable- ChatGPTOutput.

Step 6:- Deserialize the output by using an activity Deserialize JSON.Store the Output into the variable- DJObject.

image

This will return an output in the form of JSON Array, now to get the desired result we will using an activity Deserialize JSON Array to decode the JSON Array.

image

image

Step 7:- Print the result -

image

Output- This is the first email in my inbox, lets see how ChatGPT will summarise it.

image

I hope you enjoyed the article!!

Happy Automation!!

1 Like

@Nitya1, it was a wonderful use case, will definitely try.

1 Like