Gmail trigger UiPath process | Configuration (IMAP) (SMPT)

Gmail trigger UiPath process | Configuration | Filters | IMAP | SMPT | UiPath Email Automation

0:00​ Intro
1:00​ Gmail configuration inside settings
2:50​ Read Emails and Send Emails
10:30​ Filters for emails
17:40​ Trigger for Orchestrator
23:30​ Google script add data on Orchestrator Queue and start UiPath process

Code:

Gmail trigger UiPath

Menu Resources is not available on https://script.google how i can find it?

I want to be fair with you I use this only when I create the movie. Please tell me the exact second of the movie where you have issues because I really don’t know.
Thanks,
Cristian

Hi @Cristian_Negulescu,

Thank you for creating such amazing videos

I found the error: The issue was that the gmail library was not added.

On the new Apps Script Interface this is the new path to do it


Is there any way to get a file attached from the email using Apps Script?

Thanks for your detailed reply.

I will study to see how you can do this.

Thanks for sharing the wonderful tutorial. is it still working in 2022 since Gmail already update its security?

thank you

1 Like

So a way to do this is to have the file somewhere on WEB with a link on google drive and you will pass the link as a parameter of the process here:
‘InputArguments’:‘{"param1":"YOUR LINK","param2":"Video Live 21:21"}’
and in UiPath Studio you do the download for the file.

1 Like

Could we get the attached file from the email that is triggering the process?

To download the file you need to use the object: GmailAttachment from this documentation

But like I said on the orchestrator you need a link, not a file.
Thanks,
Cristian

1 Like

Thank you for the article.

I found the way how to create a file and send it to the email using google script as a link here

I’m looking how to get the link from the attached file on the email to send it on orchestrator

Thank you for your help.

function searchInbox(){
const results = GmailApp.search(‘has:attachment’,0,5);
Logger.log(results);
let counter = 0;
results.forEach((thread)=>{
Logger.log(thread);
const messages = thread.getMessages();
messages.forEach((message)=>{
const attachments = message.getAttachments();
const subjectEmail = message.getSubject();
Logger.log(‘***’+ subjectEmail);
Logger.log(attachments);
attachments.forEach((data)=>{
Logger.log(data.getName());
Logger.log(data.getContentType());
if(data.getContentType() == ‘text/csv’){
const csv = data.getAs(‘text/csv’);
counter++;
const newFile = DriveApp.createFile(csv);
newFile.setName(‘NEW csv ‘+counter+’.csv’);
var resourceKey = newFile.getDownloadUrl();
Logger.log(resourceKey);
Logger.log(newFile.getId());
}
})
})
})
}