I Built a Personal Assistant AI Agent with No Code in n8n

Dr. Violet Howard builds a personal assistant AI agent in n8n that runs on Telegram, powered by GPT-4 and Pinecone. Six custom workflows handle emails, calendar events, and a Google Sheets database, all triggered by natural language. The agent can be extended with SMS, Slack, or Airtable without writing code.
Chapters
I'm super excited to share this AI agent build with you guys today. I definitely think that it's going to change the way that I do my business, especially anything personal administration related. And that's because I'm going to consider this a human personal assistant, except for unlike a human, this thing is going to be available to me 24/7. It's going to respond to me immediately, and truly it costs a fraction of what it would be to hire an actual human personal assistant. So this is the build right here. As you can tell, the way that we're interacting with our agent is through Telegram, so I can pull that up on my phone or on my desktop, and all I have to do is ask it to do something for me. It's going to run through this logic, and then it's going to output either a result to me, or it's going to tell me that, hey, I went in the backend and I did that for you, you know, updated the database or set a calendar event, whatever it may be. So I'm going to walk through exactly what's going on in each step, and we'll jump into each of these subtools. And all of these are subtools that I built also within N8N. But before we get into, you know, the details, let's just do a quick demo of what this thing looks like in action. Let's say you're running late to a meeting and you don't feel super prepared, so you want to get caught up on emails real quick. Let's just go into our Telegram app on the phone and type in, can you summarize my emails from today? Then we'll see we got 2 emails that we want to read real quick. Here's a summary of your emails from today. First one's from Amanda. She provided an update on a redesign project, completed homepage layout, updated branding, mobile optimization, blah blah blah. The project is on task to complete by the 20th. And she requests approval of the blog page mockup and details by the 14th. She also invites any questions. The second one is from Mike. Mike informed you about a billing discrepancy on the recent invoice from the 5th. We were billed $550, but the correct amount should have been $475, so we have to settle within 7 days to avoid penalties. And it gives us an email to reach out to there. So these two popped up in here because they were marked as unread. So that's the ones that are coming through as and getting summarized for us and all the ones that are red, as you can see, that we wouldn't have got back. Even like this one was from today, but we're not getting it because it was already read. All right. That was a quick demo of what it looks like, how it works, how it interacts with us. Now let's look at what's actually taking place within this agent workflow. So the first thing we'll look at is the OpenAI chat model. Obviously, we're using GPT-4 right here, and this is just sort of the brain that we're giving to the actual agent entity itself. So this is the brain right here. Then we've got the vector store tool. This is just, you know, we're connecting it to Pinecone and Pinecone is the vector store database that we've been using. This is just where in this use case we have contact information. So you can say, can you email Mike? Can you email Jenny? And it will know how to go find Jenny and find her email address and actually send an email. And then we've got, obviously you need to connect different embeddings to these tools, but that's pretty much it for those. And then all the other tools that we'll be using today were tools that I built within N8N. So as you can tell by this little logo, that just means that you're connecting a tool that you built in this software as well. But we have Get Emails, Send Email, Get Calendar, Set Calendar, Update Database, and Summarize Database. So we'll be going through each of these tools. I'll show you guys the logic behind each of these, and we'll get— we'll do a demo for each one as well. And since the demo we just did was for Get Emails, we might as well hop into this one first. What I think makes the most sense when I'm showing you guys each of these little workflows is actually seeing live data move through. So I'm looking at an execution. We're looking at the one when I just asked it through Telegram to summarize emails from today. And that way real data will be moving through each node and you'll be able to see it and I can explain it better and it will make more sense, hopefully for everybody. So all that's happening right here is this workflow is being executed by the AI agent. The AI agent is calling this tool in order to get the job done. So as you can see, this is the workflow trigger and all that's coming in through here is what I said in the Telegram, sort of a summary of what I said, but summarize emails from today. That's what is feeding into this whole process. So this first node is an OpenAI node. And as you can see, the first thing that we wanted to do was give it a prompt. So I said, your job is to identify what date the user's asking for based on the JSON query and what the current date is. So I gave it the current date of now. This is a JavaScript code. It just says, you know, dollar sign now, and that returns the date. Time of what is right now current. So that's all that's happening right there. And then I gave it two examples. The first one is if the query asks for today, you would return today's date. And if the query asks for yesterday, you would return the day before yesterday. And sometimes you just have to outline that. Um, it might seem self-explanatory, but OpenAI doesn't always know that, you know, yesterday was the day before or two days ago was gonna be today's date minus two. So giving it examples ensures that it's as consistent as possible. And then down here we just have to drag in the actual information for it to use. So we're dragged in the JSON query, which was right here that says summarize emails from today. And this is what gave us as the output. We got October 11th, which is in fact today. So it did its job right. So from there we're going to move into a Gmail node. In this one we're just grabbing all the emails from the date. So we can see we have get many, we're getting 10. And these are the labels that we wanted to filter on. So like I mentioned earlier, we just want emails that are in our inbox and that are marked as unread. And then we want anything that was received after 10/11, so October 11th, because this is the day that was asked for when we prompted the Telegram. And this is just coming from that previous OpenAI node where it gave us the date. So then you can see we've got these two emails that came back. These are the ones that got summarized. So If I go over here to text, we have the update on the redesign project and all the way down here we've got the invoice. So this is what we saw in the summarization. So once we get the content of the emails from this Gmail node, we want to move into another OpenAI node to actually summarize this information. So we said your task is to give a concise summary of the emails that you will receive. Please include who it's from and the text of the summary of the email. So if we click in here, we can see that the live information is coming through. We've got— it's from Nate Herkelman and we've got the summary of the email right there. And we got this on the left-hand side. We'll just close out of headers. We dragged in text right here because this is the sum— this is the actual email content. And then if we go down more, we can see we got who it's from. So we have the name and address right here. So I just dragged in the from into this column so that that's the information that it will use. And then on the right, we can see the output. We've got this first email and we've got this second email, and they're summarized a lot shorter to actually be sent back to us on Telegram. Next up, we just wanted to aggregate those real quick. So a simple aggregate node, rather than outputting 2 items, we wanted to output 1. Otherwise it would've only messaged us back on Telegram that first email. So this way, if we had like 8 emails that needed to summarize, it would be able to send us all 8 of them. And then finally, we just needed to actually respond with this information. So we came in here and we set the response field to the content that we were getting from that aggregate node. And as you can see, all of that is in one big chunk right here. And we called it response because this is the field that the agent is looking for after it calls the tool. It's looking for the field response to signal like either that it's done or it's going to give information back to the agent to give back to us on Telegram. So that's what's happening in the get emails workflow. So now we're going to do the send email workflow, which is right here. So what I'm going to do first is actually talk to our agent on Telegram to get it to send an email, and then we can look at the actual execution to see that data moving through. All right, so I said, can you send an email to Colin asking how the project is coming along? Let's see what we get here. The email has been sent to Colin asking for an update on the project. Perfect. And now let's hop into the email and see what we got. So, project request update. Hi Colin, I hope this finds you well. I am writing to ask how the project is coming along. Can you please provide an update at your earliest convenience? Thank you. Best regards, Nate. So we can see that that worked. Now let's hop into the execution of that workflow in order to see the data passing through. All right, here's this workflow. It's only 4 nodes. It looks a little more simple. So as you can see, what's information coming in? We've got, um, who the email's going to. We've got the subject and we've got the, the message. So I hope this message finds you well. I'm writing to ask how the project's coming along. Just what we read. So that's what's being fed into this workflow. Then we need to go to OpenAI node in order to get that information parsed through correctly. So we pretty much just asked it to parse it through in the different parameters. And once it did that, it's going to output, you know, the message, the send to, the subject, all that kind of stuff. And then we can use that in the Gmail node. Super simple. Again, all we got to do is drag and drop the fields in. So to, obviously we're looking for an email. So send to, we've got natehurk88@gmail.com. For subject, we're just going to drag in the subject. Message, we're going to drag in the message. And then I usually just make sure that the email type is text. And that's really all you got to do, especially, you know, after you got everything configured. You can test it and we can see that it actually got sent out. Once again, this workflow has to actually communicate back to the agent that it took care of the business. So we're going to add an edit field set. Once again, we'll add a field, we'll manually call it response, and then we set that field to sent. So you can also do done, but anything that can sort of indicate to the agent that the workflow has completed successfully. Back to the agent, we're going to move on to the calendar events now. So the first one that we'll do is get calendar. So open up Telegram once again, and I'm going to ask the bot to grab my calendar events for tomorrow. So what does my calendar look like tomorrow? So we'll ask that. We will actually real quick go check what the calendar looks like tomorrow. We've got, you know, different stuff going on throughout the day, so hopefully this will come back correctly. And now let's look at the Telegram message. Tomorrow on October 12th, your schedule is as follows: 8 AM to 9 AM, we've got gym. 11 AM to 12 PM, we've got a meeting. Then we've got lunch. And then later in the night, we've got dinner with friends. Enjoy your day. Wow, super friendly, super helpful. That's a lot quicker than, you know, pulling up your calendar, especially if you're, you know, in the middle of something. So we've got our calendar events here. Now let's go into the actual execution of what just took place and look at the data moving through that too. Okay, so now we're in the workflow of the tool that gets calendar events and then spits them back out with a nice, in a nice short summary. So as you can see, this one's a little bit longer than the send email tool, but still not that bad once we break it down piece by piece. Once again, the workflow is being triggered by being called by another workflow, which is the agent. They're all the tools that we make in N8N are going to be called the same way like that. So in here, we see that the data that's coming through is to view events for 2024. 10/12, which is tomorrow because we asked for tomorrow. And so that's really nice that it did that already because I prompted the agent to know what the current date is. But just in case, we always do it here. Sometimes it slips through, especially when I'm building something fast and I'm, you know, trying to prompt it as simple as possible. But here we've got the first OpenAI node, and this was basically the same thing. We wanted to find the current day. So we can see here, your job is to identify what date the user is asking for based on the query, which is coming in through Telegram. And today's date, which is now. And then you can see it's coming in with the live variables. You should return this date in a field called requested day and only include the date. We don't care about the time. And then I said some examples. So if the query asked for today, it'd be today. Yesterday would be the day before. Tomorrow is the day after. Same thing as that one of those other workflows. And then I said after this, please output a field called next day, which should be the day after the date you've already returned. So it may seem a little complicated, but basically all we want is we want the, the day that the user requested, and then we want to get the next day that the user requested. And you'll see why once we get into the calendar node. I'm going to open up this calendar node here, connect the calendar, choose the right calendar. And now you see why we wanted to get the requested date and the day after, because we wanted to select the options of we're returning calendar events that fall after 10/12, but they also have to fall before 10/13. 10:13. Otherwise it would pull, you know, all the events that you have tomorrow and the next day and the next day, and all you wanted to see was tomorrow's date or tomorrow's events. So you have to tell it how to cut that off here. And as you can see, it pulled back those 4 events that I put into the calendar: gym, client meeting, lunch, dinner. And we've got a bunch of different fields here. We also have the start time and the end time, but we have the information we need. Now we just need to figure out how we get it to be concise and summarized in a way that we can digest. Moving on to the next node, we've got the Edit Fields Set. Once again, we're going to set, but we're not going to do response. We're setting 3 fields here because that's all the data that we want to move through. We want the event, we want the start time and the end time. So we're once again just going to be dragging in these variables from that previous node. For the event, we've got the JSON.summary, which is right here. And as you can see, it comes through as gym. And then obviously we want the start time and the end time because that's important when we're asking to get our calendar. So we're just gonna drag in the start date and time and then the end date and time from right over here. And we can see that we're getting the information back and it's outputting just what we wanted, just what we asked for. And you know, super simple. So we've got those 3 fields that we want. Now we're gonna move into an OpenAI node that's gonna help us summarize this information. So I said, you're an assistant and I need you to summarize my day by looking at events in my calendar. And then I gave it details. I gave it the event name, start time, end time. And then you can see in this output it worked. So for example, this first one, on October 12th, you have an event scheduled from 8 AM to 9 AM for a gym session. And then it does the same with the rest of them. Then from there, we need to actually aggregate those into this, into one field once again. Otherwise it would only return that first calendar event in our schedule. So click into here, we can see we aggregated and we just aggregated on message.content, which is just the summary that came through. In the OpenAI node. Once again, we drag that in, and then you can see they're coming through in sort of a list format. So this is the information that's going to come back to us on Telegram. And then we need to do a final response to the agent that we've done the task, but instead of just saying done, we need the information that we got through this workflow. So we put in the content of the list, and then it's going to come back with all 4 of those events, and it's going to send it back to us on Telegram. Moving on to the second calendar tool. Let's say we don't want to get calendar events, but we want to actually put something on our calendar. We can use this setup calendar event. So let's open up Telegram and talk to our agent in order to do that. So I'm going to say, can you set an event with Colin for 5 PM today? And now I'm going to hop over to the calendar. We'll pull back over in Telegram and we can see this stuff happen. In real time. It should pop up with an event right here at 5, and it should tell us. So the event was Colin has been scheduled for 5, and now we can see right here, meeting with Colin. We can click on that and we can sort of get information on that, and you can make that more detailed if you want. If you wanted to actually include a link to, you know, a Zoom meeting or send them an email about it, we can hook that kind of stuff up too. But that's just a simple look at how that just happened there. So let's hop into the execution of what we just asked this agent to do. We are now in the Set Calendar tool. This one is again only 4 nodes, so it looks a lot less intimidating, but all of them are very simple once you break them down piece by piece. Once again, being triggered here by, um, being called by another workflow. This information we've got here is set an event with Colin and it gave us his email too for 5:00 PM today. The next node is gonna be an OpenAI. So we'll click on this one. We're gonna message a model and we're gonna ask this node to determine the following output fields based on the user query. So we want it to take what we said over here to set an event, and we want it to give us what the name is, the start time, and the end time of the event. And then at the end, I put use now. Once again, it's going to give us the current time and date, but we want use now as the current date. If an end time isn't specified, assume it will be 30 minutes after the start date. So if you guys maybe wondered, how did it know to make the meeting from 5 PM to 5:30 PM? And it's just because I specified. If we don't say how long it's going to be, just assume it's 30 minutes. So that's what comes through over here. We've got the event name, the start time, and the end time. And now we can move into the next node. The next step here is taking this information into a calendar node, and this one's pretty self-explanatory. We're going to be creating event rather than getting events. Um, we're choosing the calendar obviously, and then we need to set up the start and end time for the event. So we can just drag these in based on that OpenAI node we just configured. And then we had to add an additional field down here. Because otherwise if we didn't do this, it would just create an event on our calendar and just, it would be Untitled Event. But we add this summary and we, that's why we wanted it to extract an event name. So we put this in here and now we can see it outputs sort of some information for us. It gave us the status confirmed, it gave us this link. So the link is cool because then you could have it also automatically email, you know, Colin or whoever you're making an email with, and it could give them this link too and all this kind of stuff. But at this point, this node is done, so we can move on to the last step, which is just informing the agent that we did the task. Once again, we do this with an Edit Fields Set node, and this time we added a field called Response, and we put the response value to Done so that the agent knows that we're done and it can Telegram message us back and say, we did that for you. Okay, now we are on to our last two tools down here, which are both having to do with databases. So we can update one or summarize one, and this is just based on a Google Sheets database that I'm gonna be using for this example. So first, let's go into the update database one and see what this looks like. Here's an example database that I made for this workflow. Now I'm just using Google Sheets, but obviously you could connect this to Airtable or Notion or whatever sort of backend database software you're using. But in this case, this is just project database. So we've got names of the project, we've got notes on the project, and then we've got their status. So For example, let's say that we just, you know, wrapped up a call and we wanted to update a note or a status or both about a project. So let's come in here and say, can you update the notes and status of the AI tool project to complete? And so this should change both the notes and the status of this first row in here to complete. And then it should tell us that it was able to do that for us. So let's see, the status and notes of the AI tool product have been updated to complete. And as you can see right in here, we've got these two rows, or sorry, the row with the two columns that were updated to complete. So that's how this one works. Let's hop into the actual execution of what we just asked Telegram to do. All right, thank goodness for another four-node workflow. They're super simple, and really it's just two nodes because the set and the trigger don't really count. But as you can see, it's another trigger and it's saying update the AI tool. Project status to complete and notes to complete. So it split that up into two different things, which was awesome because it knows that it wants to change the status and the notes, not just one or the other. So then, of course, we're going into an OpenAI node. We're prompting it based on the JSON query, which we gave the information here. And then I said, you need to justify— or sorry, you need to identify and output the following fields separately. And the fields are project name, notes, and status. As you can see over here, we got the project was called AI Tool and the notes and status were both set to complete. And so we've got the information here. Now we just need to actually get that updated in Google Sheets. So we'll do that here with a Google Sheets node. We want to append or update row. We just have to connect our credentials, grab the document, grab the sheet, and then we want it to match each column on the field called project. So we just dragged in project name over here because then it's saying it's only going to update if It sees that one project in Sheets is called AI Tool in this case, and then one project over here in N8N is called, is called AI Tool. It's gonna match those and then it can update that row. And so it's gonna update the column of notes to complete and the column of status to complete based on the information we just dragged in right here. And here's what a little look of what it looks like. Um, we've got the project notes and status, and we know that worked. So once again, we just have to get back to the agent and say that we did it. So we've got response and we set that to done. And now we can move on to the last tool of this workflow. This last one I think is something that's super cool. It's going to be able to read all of the information in your database and give you a summary of it. So this could work really well if, again, another use case, you're running late to a meeting or before you're going to meet with a client, you just want to get caught up on what's going on in their profile. You could have your Telegram bot just sort of summarize that information for you. So let's Let's hop into, um, this database real quick so we can give a look at what's going on. And then we will ask it to please, um, summarize our database. So obviously nothing's gonna happen here because it's not changing anything. It's just going to be giving us a summary of this information, but hopefully we'll see a quick blurb about each project and the status of each one. So as you can see, we've got the 5 projects here. AI tool project has been successfully completed. It involved training an AI model, blah, blah, blah, some details on that. We can see this marketing campaign one is listed as pending, and we can see this last one, cloud migration. It involves transferring data and servers to the cloud. Data backup is complete, and the migration of servers is scheduled for the weekend. The project is currently in the scheduled phase. So that is super cool if you need, you know, a quick little rundown, or you could ask for a quick rundown on a specific one rather than sort of getting a summary of everything. We are now in the most recent execution of our last tool for the day. This one is kind of a mix of all the other ones because it only has 3 real nodes, but again, we had to aggregate everything at the end to give us an actual summary. So let's see how the data is moving through this workflow. Of course, we've got the call in the beginning by another workflow. I need a summary of our current database including key projects, recent updates, and overall status. So it's actually giving us a better prompt than we gave it initially on Telegram, which is pretty cool. Then we move into a Google Sheets node. This one is also pretty simple. All we're doing is grabbing rows and we're grabbing every single row in this case because we didn't specify we only wanted a certain project. Then in here, of course, we're taking these 5 items, these 5 projects into an OpenAI node. The prompt here is, please summarize each project in the database based on their details. And then all we had to do was drag in project name. The notes, and the status. So then on this right-hand side, you can see that each of them got their own little custom summary based on their information. So we took those 5 items and we wanted to turn them into 1. As you can see, after the aggregate node, it goes from 5 to 1. So in here, all we did was we wanted to aggregate this field, which was message.content, which is basically just all the summaries of all of the projects that the OpenAI node gave us. And then on the right side, you can see that all 5 of these, um, usually sort of coding languages count from 0. So that's why it says 4, but these are indeed the 5 projects. We got those over here into one field, and then we're able to respond to our agent with that information sort of aggregated together in one field because we gave it the response of json.content, which is just what was output from the aggregate node. So I hope all that makes sense. And I hope that it was useful for you guys to see actual data moving through each of these steps. So that's really about it for this video. But what's super cool about building an AI agent like this, where you have a workflow for the agent and then you give it access to different tools, is that this is like always going to be here for me and I'm able to continually build a new tool every day to give this. So every day it's just going to get better and better and smarter and smarter as long as I don't overwork it. But yeah, like, so there's definitely, definitely some things within each of these tools that I could have made more complex. But I wanted to sort of give you guys more of a simple view of how maybe you could get into N8N and start getting something like this set up for you and your business. But, you know, like one of those examples that I said, rather than just setting up a calendar event with someone, it would actually send them an email with the link and with maybe a description about what the meeting is going to be about, that sort of stuff. You know, there's different possibilities with hooking up different ways you can talk to the agent. So you could talk to it in N8N, you could, you know, grab a Twilio phone number and you could hook this up to an SMS if you wanted to be texting it rather than Telegram, although Telegram is free. You know, you could connect it to WhatsApp, you could connect it to Slack if you wanted to have this integrated into your, the CRM or the work system that you use. So the possibilities here really are endless and you're able to, you know, connect more and more tools. And I think that it's just something that you really got to get in here and start building and playing with, and then you'll really understand like the capabilities of these AI tools and specifically AI agents. I just hope that this video was helpful. I hope that even if you couldn't follow along all the way, that you at least— it sort of opened up your eyes to the capabilities of these agents and what they can do and, you know, how helpful they can be.










