In this video I will show you how I built this inbox manager that actually sorts my emails with only
one click.
I just need to click on this workflow and then actually my email is successfully sorted inside the newsletter.
Also, I will have for you the other version that actually sorts your emails.
So for example, if you have the emails in the past, you can sort your entire inbox at once.
Because let me tell you something.
If you have an inbox that is loaded with many different emails as mine.
So for example, I've got over 3000 emails.
Sometimes it's really hard to sort actually, and take these emails that are really important.
So, you know, I've got a lot of notifications, I've got a lot of newsletters and there I can miss
something out.
That's why in this video we'll build this entire project.
I will give you the free JSON template and also will build it from scratch.
So you will see how it works.
And again, with only one click, you can sort your entire inbox and also sort incoming emails whenever
you receive an email on your Gmail.
And for the simplicity, I included all of the instructions along with the free template to download
inside our 100% free community on school.
So there we've got our core students.
There are other people interested in AI, so you can go over to the classroom and click on the Inbox
manager.
So inside you've got the prompt, you've got the system message.
Also our template you can download right here.
And when you do this you can click on these three dots import from file.
And there pick your inbox manager.
And inside actually you've got your automation already set up.
So in general again um yeah.
Go over here because we'll be using these instructions in this project.
However, with all that being said let's get started.
Let me click on Ctrl Z and undo this entire action and create this project from start to finish.
So first things first, we'll be using Gmail as a trigger.
So on message received.
Whenever we've got a message we would like to trigger this entire automation.
And then what we can do we can choose actually the pool times.
So as you can see here we've got a mode which is every minute.
So every minute it checks for any emails we have, um, you know inside our Gmail.
However I don't recommend this approach because in this case you run out from your credits inside and
I then very fast.
Okay.
So for this purpose I will I would like to trigger this automation every 15 minutes if we have the new
message.
So I can pick the custom.
And then we've got cron expression.
For this case we need to provide a specific code.
If you're not familiar with the cron um you can go over for an example and type in cron expression every
15 minutes for an example.
And there you've got cron cron job every 15 minutes.
And here you've got specified formats.
So we can just copy it.
Go over here, paste it there and it triggers every 15 minutes.
Also there you've got it explained how it works.
So you can just read it.
So in general if you for example, want to run it every five minutes just instead of 15, type five
or just, you know, go over to ChatGPT and ask for the specific code or just type inside, you know,
type inside.
Um, the Google I would like to trigger, um, you know, automation with the cron every five minutes
or so, then, um, it will give you the exact code.
However, this is a quick notification.
Also, as I see here, I forgot to uncheck the simplify button because what it does, it simplifies
our email.
However, for this case for our agent we want to have the entire email, all of the variables and so
on.
So we can disable that and again fetch test event.
Also we'll have more, you know more variables to choose.
And it's nice.
So again what it does we check every 15 minutes.
If we have the new email.
The next step inside our automation will be to filter because we want to check if the email has already
a label or not.
Otherwise, if it has a label like we don't want to process.
Um, so in general what we do, we go over to the value and there we pick the labels zero here, this
one variable and we um, yeah.
Check.
Um, does not contain them.
So it does not contain the label, the word label.
So we test the step.
And as you can see item is kept and we don't have items discarded.
Now we can go back to canvas and it's the time for our AI agent that will manage all of the stuff.
So in general, we'll do all of the things.
Okay.
And here what we need to do, we need to provide a prompt we can go over simply to our document here
and copy this entire text.
So here inside we've got the topic description and sender.
Um so in general we can go over there.
Also when it comes to the subject, um, let me show you.
And here you've got the subject.
So I dragged and dropped this entire variable for um, let me delete it for the text.
Um, I have here.
Where do I have the text I have here the text.
So again, you can simply do this.
Um, however, even you can copy that from, um, you know, from our community, um, from our free
document.
Um, nevertheless, it works by this way.
So we've got again the topic description sender and what we want to do, we want to add the system message.
We will now actually define how this chatbot should behave.
So also inside here we've got our system message.
And very shortly I will explain what it does.
So let's move to expression.
So your role you're an intelligent ML assistant responsible for sorting incoming messages.
Your task is to analyze the content, subject and sender of each email and assign it to the appropriate
category.
Categories.
Categories for sorting, priority, business, newsletter, administrative, personal notifications,
and spam.
You can change these categories okay.
You can provide your very own I don't know, um, I just thought like these categories will be proper.
However, again you can add some categories and later on like modify your entire automation.
You can change the names.
However, as usual, if you are building this automation together with me, I encourage you to actually
do it first together with me and then change it.
So first you check if it works or not and then you've got the, you know, point of view, how it should
work.
Nevertheless, we've got the instructions for each email.
Analyze the content, subject and sender.
Assign it to the appropriate category at label with the category.
If you are unsure, do not label the message response formats we've got always return the result in
JSON format, so we just get only the category.
And now what we can do.
Um, we can go over here and add the model.
So let's go over back to canvas.
Um, I'm choosing OpenAI chat model which is GPT four or mini.
It's cheap.
It's good.
Uh that's it.
Okay.
Um, you can choose other models.
You've got a lot of them.
Um, you know, actually, we've got some problem for now, however.
Whatever.
Um, yeah, I need to connect different OpenAI account.
Um, so here you've got, for example, GPT four four, um, 4.1 mini nano, which is pretty, you know,
pretty cheap.
Also cheaper than for mini, Romine, however.
Um, yeah.
Pick your model.
Additionally, for this agent, we need to go over there and require specific output format.
So we would like to provide the output parser.
And why?
Um, because we want to actually indicate the entire, um, form of the response to make it even.
Um, yeah.
To make it even more correct for this case, from here we need to provide this entire data.
So let's copy it and let's provide inside our output parser.
That's correct.
We've got output parser and their email label.
So this will be the variable name.
And in the variable we should have the specific category.
After we do this.
For now let's run it.
So as you can notice it shows the newsletter label for our email which is pretty nice.
We only wanted this word to return okay, so decide which label it is.
And even now let me actually.
Um.
Yeah.
Change, um, change the names of that.
So here, label checker, rename it, um, there for an example.
Give a label.
That's nice.
And there is a time for the switch option that allows us to actually process with different actions
based on, um, you know, the response from our model.
So we choose the switch and there the value one is our email label.
And we check if it's equal, um, our categories we want to get.
So first we've got priority.
Then what we do rename output and then we name it as priority.
With big letter we add routing rule.
So there again we go over and we provide email label.
And then we check it for um there we've got Personal.
So here.
Personal.
Rename.
Output.
Label.
So personal.
All right.
Another road will be for notifications.
So again we take email label notifications notifications.
And remember actually to type these names actually these words with small letters.
Because here we've got actually newsletter newsletters that start that starts with the small letter
also is typed in with the small letters.
Um so yeah that's why we are using renamed output variable to just provide big letters notifications.
So now actually what I need to do, I need to fulfill, um, you know, provide other routing rules
for uh, for other different labels.
So here when I open my system message, I've got a newsletters, administrative personal Sonal notifications
and spam.
So I've done it.
It looks like this.
And all it does again.
Actually, whenever we have.
For example newsletters.
Um, yeah.
Here label.
It goes with this specific path.
So we've got newsletters.
If the email is priority it goes with this path.
And we just store this email in the priority label.
And for each kind of route we need to and for each path each route we need to add the Gmail step.
So in general we need to add Gmail.
And we want to add label to message.
And here we just execute previous notes.
So there as you can notice we don't have a message because our message was um yeah categorized to the
newsletters.
So let's go over here.
Pick again Gmail add label to message.
And there we've got the message ID.
So for this case we can scroll down or even collapse For an example, this node and there take the id
from the Gmail trigger.
So we've got message id and here even we've got the problem.
So for this case what we can do to solve it type first.
So it takes the first message.
And we have inside our inbox.
And this often occurs when we have multiple items.
So yeah like if you have that on the red highlighted on the red.
And just provide the first and it works, you actually indicate that, hey, take the first email from
the inbox, the latest.
And for that so what we have and we can rename it as the priority.
Priority okay.
We can rename it and then choose the label which is priority.
And however before what's very important we need to go over to our email.
So let me go to my email.
I used other email for this case and there already I provided my labels.
So I've got administrative business newsletter notifications personal priority.
And when I was creating this automation for you.
However, if you want to add the label, click here and add it.
So there for an example, let's say um, I don't know health.
It's not related.
However, you know, that's how you add the label.
And when you add your labels you go you go over there and choose.
We've got the priority.
You choose priority.
We test the step and it should be classified to our priority.
So it worked for sure.
And we need to do the stuff for all of the, you know, for all of the for all of the paths.
So what we can do, we can click here, click Ctrl D to duplicate and just provide all of the nodes
for each path.
So we've got 123456, seven, seven, um different labels.
So we've got um, actually six items.
Let's provide another one.
Uh, okay.
And as you could notice here inside our Gmail, we don't have there in the labels the spam.
And this is why actually it's due to we have the spam already inside our inbox.
So we haven't provided the label, which is spam.
Yeah right there.
We'll be using this spam label for this case.
What I can do, I can simply connect all of these to my automation, change the name.
Actually, let me go over here.
I can change the name.
So firstly we've got what we firstly had.
Let's see.
Um, firstly we had um the priority.
This is the priority okay.
So we've got the priority.
Let's rename it.
Actually we need to firstly um yeah this one changed to the newsletter.
Um, yeah.
So actually it's um, you need to do it by this way newsletters.
However, afterwards and when it's set up, um, you can use it for a long time.
So you've got priority there.
You can see you've got you've got message ID that is proper there.
You can't choose it because it didn't choose this path.
It wasn't the priority message.
So we only have the data inside the newsletters.
However we copy this, um, note.
So now we can use the variable right there.
And only what we need to do is to change the label.
So here we have the priority um, there in the newsletters.
And we had um right there, um, the priority, however we have the newsletter right there.
What we have, um, this is the personal so we can rename it as personal.
Very, very simply personal.
Okay.
And there just change the label to personal.
It's simple as that.
So we have personal.
So now let me change all of these.
So this is how you create the entire automation to sort your emails into specific labels, and I think
it's really useful.
A lot of us have like, mess inside our inbox for sure.
Me so yeah, that's how it works.
And with this single kind of automation, you can sort your emails.
However, I said at the beginning and I showed the other automation that sorts your inbox and old messages.
And in general, it's pretty straightforward to create because what you do, you copy all of these steps.
So all of these notes and then only what you do you you provide the trigger which is different, which
is on click you get messages from the Gmail.
So let me show you how it looks like.
Also remember you can download the full template.
So here you will be able to see how it works.
You know you can just set it up by this way.
Nevertheless let me guide you through that very quickly.
So in general inside the Gmail we get many emails.
The limit is 15.
So at the like at once.
We get 15 emails and then what we do, we provide a filter and again we check if the email has has already
a label or not.
And now let me show you how it works.
So in my account I have like these numbers.
So in the newsletter I've got five emails and notifications I've got nine.
And the priority I've got one.
And however if I click let me go over here.
If I click on Test Workflow now it takes 15 emails and it will sort everything.
When I zoom up you can see like we've got five items already.
Um, given like the category for them, 1011.
So just it creates 15 different, um, you know, categories.
It sorts our emails into 15 different labels.
So as you can see we've got 13 notifications and two newsletter.
So let's check it.
Let's go over here.
Let's refresh the page and that we have it.
We've got notifications newsletter.
So this automation works.
And in general feel free to change actually the amount of um yeah of getting the emails.
You can actually I don't know modify it to 100 for 120.
Remember it will take more time.
Nevertheless you've got more items you know like sorted at once.
So for example, let me pick 50 for now and let's see how it works.
So test workflow.
So it takes 50 latest emails for us.
Um and yeah our chat.
So our agent will sort everything up.
And I think it's great automation for me it's really worth to use because for an example like here in
one click you can sort your entire inbox.
Uh, for now, thank you for watching this material.
I hope you enjoyed it and I will see you in the next video.