# THIS Smart Invoice System Will Make You $750/Month

## Метаданные

- **Канал:** Nick Saraev
- **YouTube:** https://www.youtube.com/watch?v=tXrssFdywgQ
- **Дата:** 14.06.2025
- **Длительность:** 44:15
- **Просмотры:** 18,677
- **Источник:** https://ekstraktznaniy.ru/video/11939

## Описание

Join Maker School & get automation customer #1 + all my templates ⤵️
https://www.skool.com/makerschool/about?ref=e525fc95e7c346999dcec8e0e870e55d

Want to work with my team, automate your business, & scale? ⤵️
https://cal.com/team/leftclick/discovery?source=youtube

Get the Invoice System Template in here ⤵️
https://leftclicker.gumroad.com/l/poycbq

Watch me build my $300K/mo business live with daily videos + strategy ⤵️
https://www.youtube.com/@nicksaraevdaily

Summary ⤵️
Watch me live-build a smart AI invoice system you can sell to small businesses for $1,500 each, automating payment follow-ups and boosting revenue by over $12K.

My software, tools, & deals (some give me kickbacks—thank you!)
🚀 Instantly: https://link.nicksaraev.com/instantly-short
📧 Anymailfinder: https://link.nicksaraev.com/amf-short
🤖 Apify: https://console.apify.com/sign-up (30% off with code 30NICKSARAEV)
🧑🏽💻 n8n: https://n8n.partnerlinks.io/h372ujv8cw80
📈 Rize: https://link.nicksaraev.com/rize-short (25% off wi

## Транскрипт

### Introduction []

How many times you guys kicked yourselves for not following up on an unpaid invoice? Well, over the next 20 minutes, I'm going to build a smart invoice collection system in front of you live in NAN that automatically follows up on overdue invoices and can easily generate an additional 10 to $15,000 per year in missed payments for the average agency or freelancer. I use similar systems all the time with real clients and you can easily sell something like this for 1,500 bucks a pop or more. I'm also going to include the template down below for free for anybody who needs it. If you're new here, my name is Nick. I scaled my own AI automation agency to 72,000 bucks per month and currently lead the number one A automation community, Maker School. Anyway, I'm going to build this entire thing for you from scratch in NAND. I'll walk through my exact thought process and I'm going to show you guys all the real development stuff, including the dead ends and debugging that most people would probably leave out. Let's get into it. So, here's the system we're about to build. But before I show you an actual demo, let me give you the business context around this, cuz understanding the why, I think, is just as important, if not more, than understanding the how. The whole goal of today is I want to build an intelligent invoice collection system that eliminates one of the biggest cash flow killers for most businesses, which is forgotten follow-ups and unpaid invoices. As opposed to easily ignorable automatic follow-ups, these are all going to be custom. They're going to be intelligently written. And most importantly, they're going to come directly from the business owner or from you if you're installing this in your own company. So, why this system? A really big problem in small to mid-size businesses is you don't typically get paid at the same time that you do your work. If you guys have ever heard of the terms net30 or net 60 or net 90, what all this stuff means is that a business delivers services and then doesn't expect payment until 30, 60 or 90 days later. And because of this gap, in practice, a lot of clients that should have paid you money just forget or they take a really long time to pay those overdue invoices and you end up with a ton of cash in accounts receivable. Now, this may not seem like a big deal, but can amount to massive cash flow issues for an average small to mid-size business or alternatively just a lot of time spent following up chasing after clients that owe you money. So, that's what the system solves. Instead of manually tracking payment dates, writing annoying follow-up emails. This is just an automation that monitors your invoice status, it calculates exactly how many days each payment is overdue, and then it sends increasingly urgent but professional follow-up emails at precise intervals, 7 days, 14 days, 21 days, and so on. The business opportunity here is massive cuz the ROI is just really obvious. If you say the client won a $3,000 invoice per quarter that would otherwise have been forgotten, you have now generated an additional $12,000 in revenue. And for a service business that's doing several hundred,000 per year, that's probably on the low end of the value you're driving. So you can absolutely charge a percentage of that if you were to sell it or use it in your own business to improve your own cash flow. All right, with that aside, let's dive into the actual build.

### Demo [2:22]

Okay, so here's a demo of the working system. I want you guys to know that you can use this exact same approach that I'm showing you to literally any sort of follow-up situation. Whether it's following up on unpaid invoices or following up sales calls or following up on cold emails, whatever you want to do, the logic is contained here. Just copy and paste your particular templates and you'll be good to go. The way that this works is we're grabbing data from a source. Now, I'm using Google Sheets here because I want to make this agnostic. work with everything. But I want you to know this first node can actually just be swapped out for anything. Like if you're doing Stripe, you can swap it out for Stripe. If you're doing like QuickBooks, you can swap it out for QuickBooks. If you're doing Zero, like whatever platform you're using, this is just where you grab the data. Then what we're doing is we are filtering this to check people that we have sent invoices to on 74 218 day intervals. So every 7 days we're then calculating the distance between today which is uh June the 11th and then you know these invoices over here. So there are two that are on a cadence of 7 and 14 days. And then after that we build in a little bit of logic to grab all of the email history between us and the lead so that we know exactly what's going on. We don't make any erroneous errors by sending a follow-up at the wrong time. We then do a little bit of processing and then finally we send an invoice follow-up using OpenAI where we then in our case are drafting them but in your case you could just send them or whatever the heck you want really. You could have this thing run on turbo all day long. So if I click execute workflow what's happening is it's starting by grabbing that data. It's then looping over and for every email that is found, it's getting our conversation history, whipping up an email follow-up template that is relevant and tailored to our conversation history and it's creating a draft and just doing it over and over and over again. The final draft outcome looks something like this. So these are contextually relevant and they are unique to the prospect. We base it off of a template, but then we modify that template using AI to fit the specific circumstance. So this specific one is for a rascal called Nicholas who didn't pay his invoice on time. Hey Nicholas, following up on the invoice. Let me know if you have trouble paying this or if there's something I can do to assist. I'm here to help if anything's unclear. Show anytime. Thanks Nick. This one says, "Hey Nick, hope you're well. " It's another rascal. I just wanted to check on the invoice. I sent you earlier with you. Let me know if you need anything. Trying to get this in before end of week. Thank you. Cheers Nick. So stuff like this works. Stuff like this is used by companies all over the world to significantly decrease their accounts receivable and make sure that they're cash flow healthy. I'm about to show you how to build it.

### Live-build [4:28]

All right, so as mentioned, I haven't actually built this yet. I'm going to be doing it live in front of you using this NAN canvas. What I have is a road map, which is just a series of steps that I think I'm probably going to use during this build. And the reason why I'm approaching it this way and not just showing you guys a finished product is just because I think it's a lot more informative to proceed with a blank canvas and then run you through and actually narrate what I'm thinking while I do the build. I also think it's a lot more informative to like include all the crappy parts that most other people don't in the video so you guys could see what actual debugging looks like. You know, we're not just looking at the finished product here. I'm actually guiding you through what like an actual development processes. So, yeah, usually the way that I do my development processes is I just bullet point a couple of things that I think I'm going to do and then I proceed logically top to bottom. So, here's what I think I'm going to do. I'm going to start by probably grabbing invoices from some source. Now, bunch of different sources I imagine we could use for this. Like if you guys are using Stripe for payment processors, you could do that. Using QuickBooks for invoices, I'm just going to be using a Google sheet. This is a test Google sheet that I generated a while ago for a similar build that I did in make. com. This is going to be pretty different. So, if you've seen that, stay tuned. But basically, what we need to do is we need some sort of source, right? So, I'm just going to verify I can grab invoices from my source, whether it's a payment processor, QuickBooks or Google Sheet, that's okay. After this, we're going to check the sent dates on the source and then we're going to calculate the distance between when the invoice was sent and then today. And in doing so, we're going to get some number. So, for instance, like today it is June 11th. So that's 2025-06-11. If I go current date minus this date, what should I expect to get? I should expect to get six. Okay. So the reason why I'm doing this is because this feeds into the next step, which is where if the distance is equal to some interval, let's say it's equal to 7 and I want to follow up every 7 days. Well, then I can proceed with the rest of the flow. But if the distance is 6 days or if it's 8 days or something, then I don't. And I'm doing this because I think it's just going to be the simplest way to proceed with an invoice follow-up. I don't know for sure, but um that's what I'm thinking. And then after that, what we're going to do is we're actually going to grab all of the email history for context. One fragile piece in my make. com automation and a couple of other similar builds that I've seen with this before is like sometimes you do communication with a client on three or four different platforms or sometimes you do communication with a client over email and they actually explain why they didn't follow up with you or they didn't pay the invoice or something and they say, "Hey, you know, just give me a couple more days. " So, what I want to do is I want to account for that by basically every time that we have one of these follow-up periods, just getting the last X emails and then aggregating it into some big history, then feeding into AI, just having AI tell us, hey, is this an appropriate email to send? If not, should we make any adjustments to it? From there, yeah, we're going to eliminate the weird messages. Then, we're going to draft or send follow-ups to prospects so that you know what's going on. And then, I kind of have an optional one here. Um, I don't really think we can do this today just cuz I'm going to be using this Google sheet like I talked about, but essentially, you know, if you're using a Stripe invoice system or using a QuickBooks invoice system or maybe Mercury or whatever, you can track events. So, like when somebody pays the invoice, you can actually monitor that, send that to a web hook and then catch the web hook. What you can theoretically do is you could use this to like close the loop in the system. So, if somebody pays your invoice, then you can actually just go back to the source. You can change it from status unpaid to paid or something. Do you know what I mean? So, in that way, we can kind of close the loop and uh yeah, make it really nice and tight. So, I'm going to be filling these out like so. You know, when I'm done, I'm just going to mark this cute little check mark thing, a little bit of dopamine. And uh yeah, let's dive into exactly what this is going to look like. So, first step I'm going to do is I'm going to go to Google Sheets. And what I want is I just want a way to list all of the invoices here. And realistically, I should probably set this on like a daily schedule where it like runs at like 7:30 or something like that. Because if you think about it, if it runs at 7:30, there's much higher likelihood that the person is going to get the email and be like, "Oh yeah, I have a little bit of time to fix that up. " So the note I'm going to use, if you guys can't see it here, is get rows in sheet. Now, what this does is it asks for a credential to connect with. So create a new credential here. All we do in order to hook this up is we just click the sign in with Google button. And then what you do is you go and you select the specific email address that you want. So I've already done this with uh my email address. So, I'm just going to exit out of this puppy and then go to this specific one, which I believe was this one that says YouTube. Okay. Next, sheet within document get rows. The document that I'm going to use specifically is smart invoice follow-up system. At least it should be smart invoice system example. There we go. And then the specific sheet, this just asks for um this value right over here. So, specific sheet is just going to be sheet one. And then it'll give me some filters that I could use, combine, some options and stuff like that. I'm not going to worry about anything. I'm just going to click execute step. And we're just going to see what happens. So executing the step right now on the right hand side we see we have some um output. Now I usually do my output in JSON. A lot of people prefer the schema but the reason why I like JSON is because you guys see up here where it says 10 items. I actually want to be able to see the other nine items. I personally think this is one of the reasons why so many people struggle with NAN item matching because they don't realize that what is actually being output is not just that one record with Samantha TR but like you know 10 records all with their own stuff. So I'm a big fan of JSON. Uh for those that don't know, JSON is just like a very simple convention where you, you know, store the name here and then you have a colon the actual value. So the name or the key and then the actual value. The key actual value. Um and in this way I can just get a much quicker and easier appreciation of what's actually going on. Anyway, what I do after I run that is I'm just going to pin and I pin everything. Pinning is just the simplest and most straightforward way of making sure that you have reliable and consistent data. Um and now what we see here is we feed in one item and then we get 10 items after. So what am I thinking? We just verified that we can grab the invoices from the source. That's easy. What do we have to do now? We have to check the sent dates and calculate the distance and days between sent and now. So, okay, just to reiterate, we have a bunch of dates sent here, right? What we have to do or what I want to do is I want to calculate the distance between all of the records that are just fed in here and then the current date. That may sound like witchcraft to you. What the hell is a distance between dates? Um, what I'm going to do is I'm going to use the edit fields node. And I think this is going to work. I don't actually know. We're going to go manual mapping. So I'm going to call this days since and then over here I'm going to click expression and in n you can actually do dollar sign now and it'll grab you a datetime representation of right this second. So this is actually down to the second thing is we don't actually need the second but that's okay. The second that you have something in a datetime format you can manipulate the hell out of it just with a period. So check this out. Now I pressed period there's minus plus diff to extract. I think what we need is diff two, right? Yeah, I think it's going to be diff two. So, diff 2 returns the difference between two date times in the given units. Cool. So, I'm going to do this. And what we're going to calculate is we're going to calculate the difference between now. That's the thing that we're starting with. And then what I want to do is I want to feed in one of these dates. So, dollar sign JSON dot what we want? We want date sent. Okay, cool. So, distance between now and then date sent in days is 9. 62. 62597. Okay. So, obviously I don't actually want this big 9. 2 whatever, right? Like that doesn't actually mean anything to me. So, what I'm going to do is I'm going to round this now. So, period round. There you go. And now we actually have the distance, the days since the invoice was sent. Easy peasy lemon squeezy. Just for my own, I guess, ease of use. I'm also just going to map the email in here. Let me just drag that in just so that I have it in the edit fields node. I like the edit fields node. Pretty simple and easy. And let me just see if there are any additional settings I want. No, I don't think so. I think we should be good. Okay. So now what I'm going to do is I'm going to execute this. Okay. So what do we get now? Now we get a list of days since sent. Then we actually get the email. Now don't get me wrong, we can totally still access all this information here. I just wanted to simplify, make my life easier and show you which records are responsible for whatever distances. Now if you're smart, you'll notice that I've actually added my own email addresses here in days since for seven and 14 just cuz I wanted to show you what like it actually looks like moving forward on my own stuff. I don't actually have access to Maria Chen's email address, so we'll leave it there. But I'm glad that that's worked. I can now pin this. So now that we've calculated the scent dates, what we do logically is we just need to check to see whether the interval is equal to the distance. And so I guess what intervals are we going to do? I'm thinking I'm going to do it this way. So like, you know, how often do you really want to follow up on an invoice? Well, odds are, you know, if they're actually overdue on invoices, you're not going to be the only person following up. Like um Stripe is going to be following up. If you send that through Panadoc, Panadoc's going to be following up. Quick post is going to be following up, whatever. So I don't actually want to overwhelm them. I personally like the once a 7-day structure. You can theoretically set this up to do like once every day if you were super keen on it and it was a really big payment or I don't know something like that. But I'll just do once every seven days. What I'm thinking is I'll start with a 7-day, then I'll do 14 days, then I'll do 21 28 days. And because, you know, I just want to do this live build and I want to make sure the video isn't 700 hours. I'm just going to stick to these four. Um, feel free to extend this however you want. Feel free to do, I don't know, 4day interval, whatever. You know, the world is your oyster, I suppose. So, we're going to do 7 14 21 28. um delete this 35. So the question is how do we actually check that now? Right? Um we have 10 items. We want to check to see which one of these are within the intervals. There are a variety of different ways logically that you can do this. I'm just going to use a filter node. So a filter node allows you to feed in an item days since sent and then check to see whether it's something that you want. So let's go. Let's check to see if days since is equal to 7. Okay. And should we do number? I actually don't know. I see we have a string here. Let me just try number. I feel like we need number. So number is equal to. Yeah, it's not going to allow that. Why? Cuz days since is currently not a number. There's a little bit of nuance here. But um when you see stuff surrounded in quotes, then it's a string. It's not a number. So does it make a massive difference for us? No, not really. But maybe I'm going to want to use this in the future as a number. So I'm going to go back to my edit fields node. Change this from string to number. And now if I execute this, this should now say 10. Yeah, there you go. You see how it just changed to green. Okay. So I am going to pin this again. That'll make my life easier. Then under the filter, the number field now works. It's not giving me any errors. So basically what I want to do is I just want to filter out anything that's not 7, 14, 21, or 28 days. How do I do this? Just going to add some more conditions and I'll go or add condition or. So what are we doing here? 14 218. You got to go number is equal to number is equal to. And then we're just going to map the same variable over and over again. Oh, that's kind of annoying. We can't actually do that if it's not set to an expression. So, let's set it to an expression first. Okay. So, what are we expecting to happen now? Well, we're feeding in this array and we're just checking to see, hey, which ones of these are 7,4 21 or 28? If they're not 7,4 211 or 28, eliminate them. So, we should only expect to get a couple left. Okay. And that's what happened. Kept two items, discarded eight items. Looking pretty solid to me. Just going to pin this. Now, we sort of have like the base logic setup, I'm thinking. And so, logically, what do we do now? I guess now we need to grab the email history, right? Okay. So, in order there are a variety of different ways to do this, what I'm thinking I'm going to do, just brainstorming out loud here, is I'm going to loop over each email cuz, you know, we have Nick left and Nicholas Drive. I'm going to loop over each email using the loop node and then I'm going to grab all of the emails sent or received by that email address because if you think about it, if it's sent, then that means that I got it. And then if it's received, that means that they got it. So, it'll be like both the two-way communications. I might want to sort that. It may come back as automatically sorted. I don't know. But then what I want to do is I just want to turn all that into a big text thing, feed it into AI, and then ask AI like, "Hey, you know, this is the email template I was thinking of sending, which I guess I haven't done yet, but I'll do that later. Is this one good? You know, is there any changes that we should make to this or whatever? " Okay, so that's what I'm thinking of doing. Let's actually build that out. So, loop over items batch size is one. So, I personally really like using loop over. I don't think you actually explicitly need this. Um, but I really like using loop over items because I used to use a noode platform called make. com predominantly and since I moved over to Nadn, it's been kind of a learning experience with the item matching and stuff like that. You know how earlier I mentioned that item matching is one of the biggest issues that people have with this platform. Nobody talks about it, but I guarantee you that's the main issue that like 90% of people have. Why can't I select this item and stuff? Well, the reason why is because um, you know, they don't understand what's going on under the hood. This is a really simple way of just like contextualizing what's happening. And I usually like adding a weight here too so I could see it. So don't be afraid to do simple straightforward hacks like this. Anyway, so what do I need to do? I need to get emails. So I'm just going to connect to Gmail. And what I want is get many messages. And notice how I'm adding this to the loop route. Basically everything that goes on in this loop route will just go on one at a time. And you can actually visualize it, which is so useful. And then once it's all done, then we're going to proceed down the done route. And we have access to some of the variables inside. Okay. So we're going to start by getting the messages. And what are we going to do? I guess I'm just going to get all them. No, maybe we shouldn't get all of them because I mean, what if it's a lot? Let's just do the last 10. That sounds reasonable. Filter. There should be a way to filter this out. Search. Yeah. So, from Okay, so I don't actually have access to any input data. So, I need to sort that out first. So, why don't I execute this so that we have some output on the loop branch. Okay, looks like we do. I'm just going to pin this. Oh, I can't actually pin. Sorry, I lied. You can't actually pin a loop node. It doesn't look like. So, that's all right. Um, now that I have access to this note, now what I can say is, hey, I want all emails that are from Nick at leftclick. ai or, and I don't know if this is the right syntax. I'm literally just we're raw dogging it today. We're going to see what happens. And then I only want to return 10. So, let's run it. Oh, and by the way, if you guys haven't connected to Gmail, it's very simple and straightforward. Just click create new credential and then you just do that sign in with Google thing. If you're self-hosting, could be a little bit more difficult. I'm a big fan of um cloud hosting because it eliminates all the complexity. But anyway, so what do we have here now? We have emails from or to nick at leftclick. ai. Oh, you know, I'm realizing this isn't actually the email that I wanted to use. My bad. Let me actually go over here cuz I wanted to do this. Yeah, I just got to rerun this one more time. So, let's unpin all of this and then disconnect this. Then let's run it. And just got to collect a different email address. We should still have everything else be the same, right? Just now it should be nick at nixive. com. Okay, cool. So, we're going to go down the loop node. Get that. And then now it's to from nyx drive or to nixive. Let me execute this step. What are we getting? Cool. So, now we have like a, you know, coaching sessions. This is me talking to my LLM. This is me sending and receiving some emails and stuff like that. That's cool. Now, what I want with this stuff is I want to add some sort of Well, actually, hold on a second. This is currently in, now that I'm thinking about it, this is currently in nine item format. So you guys see how it says nine items down here. What I need to do is I need to transform that nine items into one item. Like I just want to aggregate it all so that instead of me outputting a list with nine items, I have a list of nine items in one item. Does that make sense? We got to nest it. So simple and easy way of doing that is the aggregate node. So I'm going to give that a try. And then what I want to do is the input field name. And it's just going to be text probably. I think it's just text. Okay. So, I'm just going to do text. Let's just see what happens. Screw it. Okay. So, there's no text in the input item. So, maybe I didn't do that right. Oh, you know why? Because it's not outputting text. It's outputting snippet. The reason why this happens in Gmail is because the simplify trigger, which is super annoying. Make sure you sort that out. If not, you're not actually going to get the full text. You're only going to get a little snippet of it. Okay, cool. So, now that we have this, we should be able to go text. I execute. Then if I execute this, we should get yes, now we get all of the text. Okay, so logically what just happened? Well, now we actually get all of the text here in one, you know, big like text array essentially. What we can do, do you guys notice how this says one item is now we can actually turn this into just one string. Then with the string, we can feed it into AI and have AI do something cool with it. So at least this is my idea. I don't actually know that's going to work in practice. I'm just going to rearrange this, tidy it up. So select and then shift command T. And that just makes my life a little bit easier. It just like applies some I don't know what the thing that they're doing is, but it just makes it look really pretty. And then I'm just going to pin a couple of these nodes. And then over here, I'm now going to go open AI. So open AI. We're going to go messenger model. Here we go. Okay. And now what I want to do is I just want to select a model that I think is going to be sufficient for this. So the one I like is GBT4. 1. So I'm going to go here. And the prompt I'm going to do is I'm going to say, "You're a helpful, intelligent, administrative assistant. You help me follow up with emails. " Now, that's the system prompt. I'm just giving it some very highle directions in the user prompt. Now, I'm going to ask it some stuff. Your task is to read through a conversation history and determine. So, actually, let's give it some more context. I am following up with overdue invoices by sending a series of templated emails. Your task is to read through a conversation history between me and the prospect and determine whether I can send the email as is or if there are some changes I need to make to the template. Here is the template. Uh, for now I'm going to hardcode a template, but realistically I'd like to select the template based off of how many days it's been. So if it's been 7 days, I want to do one template. If it's been 14 days, I want to do another one. So what I'm going to do is for now I'm just going to hardcode it and then I'll worry about the actual thing later. And I'll just say, you know, hey, hope you're well. Just checking in on that invoice I sent you earlier. Thanks. let me know if you need anything. Okay? And then it'll just be thanks Nick. Okay. Great. So, rules. If we just sent an email discussing the invoice, if we invoice within 48 hours, do not follow up. You return your answer in JSON using this format. We'll go. We'll go verdict. True or false. Let's go email template modified email template with backslash in place of new lines. And then that actually should be sufficient. Now, if we sent an email discussing the invoice within in the last 48 hours, do not follow up. This would be annoying. If this occurs, let's think. Can we schedule an email in Gmail? I mean, it would be really cool if we could schedule an email in Gmail. I don't think we could schedule an email. Yeah, we can't schedule an email. No chance. Send a message. Wait for response. Remove label for message. No, we could schedule it for another day. I think that would just be overkill. So in this case, okay, first of all, let's change this to 72 hours and then we'll just say just skip because I will probably have carried on a conversation. Aside from that, just skip and return false for verdict. If we discussed something that materially makes the followup seem strange, i. e. repeats the same information or says something out of context. Modify the template to accommodate for this. Do not modify the template unless it's necessary to maintain a cohesive conversation. Okay. Then over here, if we did not send an email discussing if we sent or received an email discussing the invoice in the last 72 hours, return true for verdict. Cool. So, this looks pretty good to me. This is going to be our template variable. And then I think we can actually go ahead with it. And then here will be the conversation history. Going to feed in text, which is just going to be one item. Okay. Right. right down there. Okay. Output content is JSON. For output randomness, we're going to go 0. 7. And now, just given all this, let's go and let's see what the verdict does. Verdict should be true. You know, I'm realizing that we're not actually including the date at all. Why aren't we including the date? Hm. We need the current date. So, right now, this isn't actually going to do anything unless we say current date. We're going to go now. And then inside of the conversation history, we have to adjust this aggregator. Oh, and sorry, are we we're just feeding in an entire Are we um array right now? Okay. Yeah, we are. Okay. I think personally we should probably aggregate the data inside of this. Uh we need we need the date somehow, right? the date sent or received. So, we don't currently have I think what we should probably do is we should probably merge the text field with the date field. So, why don't I go date sent or received? That would make more sense. So, where is the date? Oops. Damn, this is big. Okay. Date over here. What is this? Headers. Date. Okay. So, we should be able to get the date with headers. date. So I'm going to go text add field aggregate headers date as well. Let's unpin this and then let's just execute this and see what happens. So now we should have two. We should have text. We should also have headers date or whatever. It's executing. Okay, so that looks pretty reasonable. Uh sorry, my internet just died there. Um looks like we have text and then we also have dates. Can we just merge these lists? Is that a thing? Like there has to be a way to do this. Merge lists. I don't know what this does. Let's find out. Merge the open to a single flat list rather than a list of lists if the aggre if the field to aggregate is a list. Uh is a list? I don't know. Screw it. Execute and see what happens. Okay. So, what I really want to do is I just want to join the date at the current index with the email at the current index. Uh that would just be the easiest for me. So, how the heck do you do that again? I should definitely know how to do this. I need to sort of like map this. I think I may be stupid, but uh I think I just need to map this. So, let's just change this to an expression. What do we do? Dollar sign JSON. ext map. Right. And then item item. Can we get item ID? I'm just going to type map ID NAN. Can we enumerate this? Hello. ID subjects item JSON. H. No, that's not how you do it. I've probably forgotten a function. So, let's just go. Okay. So, here's what we do. We actually need to set this as a map and index, right? So, map then we'll go text index, right? I think I don't actually know if this is how you do it, but we're going to find out. Okay, let's just reset this cuz I hate the red. Go map right now. Go number H. Why did map work a moment ago? I know it's not working. Sometimes this happens. Um, let's try this. JSON. ext dot map. What I want to do is actually in brackets go item index item then plus. No, we want dollar sign JSON date index plus item. Okay, I think I figured it out. So now what we've done is we have mapped the date and for every item we've also mapped the text. Sorry, we mapped the text and then for every element in this array, we've grabbed both the item itself, which is this big long text string and the index. The index is just this place. So 0 1 2 3 4 they're all zero indexed. Then what we're doing is we're returning this. So we're grabbing the dates now and then we're selecting slicing out only the specific record of relevance. Then we're adding a new line and then we're adding the item um via like a string. So what this is now going to be this is going to be text with sent uh date. So now if we run this we're going to have access to a text with date parameter here. And now what we can do is we can go over here and feed this in. So conversation history is going to be text with date. The cool thing is in Na if you just feed it in it's going to be the big array. And uh that's fine. That's sufficient for me. Okay, last thing is we need the first name somehow. So I don't actually know. Can we get the first name? That is the question. What do we get loop over items? You know, I feel like I should probably feed in the first name as well into edit fields. That'll make my life a little easier here, right? So let's do that. Let's go back to edit fields and let's just add first name. Now, what is first name going to be? Well, we're going to grab the client name and then what we're going to do is we're just going to split it. So now it's going to be two things, Samantha and Tran. And then we're just going to grab the first element which is Samantha. Right? So this is going to now say Samantha. So why did I do all this fun stuff? Because if I unpin, which I don't believe you can do bulk. You can only pin in bulk for some silly reason. Now going to execute this workflow. Grab the fields, filter them out, loop over them, and then we should it it's going to um loop back unless I stop it. So I'm just going to stop it. Let's see. Looks like the edit fields worked. We got the full names and every or first names and everything. So we now pin these again. I'll pin this. I'll pin this. And I'll pin this. What did we actually feed in? Most things. It's just for first name. Instead, now what I can do is I can go to my loop over items. Now what I'm going to do is I'm just going to say first name. Just like that. So now I'll say, "Hey Nick, thanks Nick. " I mean, this is kind of annoying because hey Nick, thanks Nick. But is what it is. Then over here it'll say, "Hey, hope you're well. Just checking on that invoice. Thanks Nick. " Cool. Nice. So it is now true. How cool is that? All right. Now, what we're going to do is we're going to I'm just going to filter anything that's not true. Um I personally just like using the filter node. You can use whatever the heck you want. Um but anyway, I'm just going to check to make sure that this here is true. So, we're only going to be selecting them if they're true. Now, I should note that I'm using a string here, not technically a boolean. So, if you're like super big into string types, you'll probably want to murder me, but that's okay. We just filtered that through. And now logically what we can do so we can go back to Gmail and I'm just going to draft a message. Although I want you guys to know you can just completely autonomously send them. Then I'm just going to say reinvoice. And then what we can do is we can feed in the email template with text. Okay. Hey Nick, hope you're doing well. Blah blah blah. All right. Now what I can do is I can feed in the butt of this into the mouth human centipede style. U anyway I'm going to sort this out. Make it look really nice. I'm going to feed that in there. And then now I'm actually going to run this for real. So let me unpin everything. We're going to give this a go. We're going to see how this works. And then we'll worry about all the rest of the logic aka selecting the templates and stuff later. Okay. How satisfying is that? It's going through getting our stuff. Ye-haw. And then it's uh sending or I guess in my case creating a draft. Okay. So where am I going to get this draft? I got to go to my other email. Okay. And we got the emails here. I'm realizing now that we didn't set a two parameter. So we're going to have to fix that. And then we have reinvoice. This is the first one to Mr. Nicholas at Nicholas. And then this one is to Mr. Nick. Nicknix. com. So those are pretty cool, but I'm glad that we caught that, right? Like that's an issue. What do we have to do? We have to go to email, obviously. Jeez, how do you not have the two email, man? Ridiculous. Let's go back to loop over items. And then what I want is this email here. Then what we could even say is reinvoice for. We could even put that in there if we really wanted to like follow up with them and be like, "Hey man, pay the dang invoice. " Okay. So now we should have the two. That looks good. We should also have the subject. That looks good. Email type text. Cool. This looks good. Yeah, I think we're making some solid progress here. So now we're feeding email history into AI with the templates and a weird message. That looks good to me. So what do we have to do now though? We actually have to make different templates for 7,4 21 and 28. So I like this initial light one as my 7-day one. I like that. So I'm going to do that as my 7-day. It's just going to be hey whatever. So let's just go back here. This is going to be my simple, hey, you know, hope you're well. Why don't we just duplicate this and this will be our second one. We'll go hi instead of hey. Hit him with that hi. following up about the invoice. I'm here if I can help with anything. Shout am here to help. If anything is unclear, shout anytime. Cool. Thanks, Nick. This is reasonable. Let's do number three. Yo, big dog. Nick's coming in for your money. Okay. So, hey, thought I'd send another ping re my last invoice. Let me know. Go best, Nick. Oh, yeah. Hit him with that. Best is uh rough. Then I'll say, "Hi, I know it's been a while since that invoice voice and it's not my intention to bother. Just want to follow up. make sure I can close this out. Let me know if there's anything I can do to help. Okay, still pretty light obviously, but you know, we're just slowly gradually applying pressure. I'm sure you can see how over the course of let's say another four to 6 week follow-up thing, we eventually go from like, hey, I know it's been a while and you know, I'm here to help to, hey, the invoice has been outstanding for the last 90 days. You're going to need to sort that out. So, uh, something else that's really interesting is you can employ the same idea in collections. So collection sequences um are very similar to this. You start with like something pretty general and then you know like they're they always have some issue why they can't pay your invoice, right? It's like our cash flow isn't very good. Do you mind waiting until next month? Hey, can we pay a premium charge interest on it or whatever? There's like a million possible responses to this. But if you have AI take in the conversation history and just like tweak your email a little bit just to 100% make sure nothing is a miss, then you're good to go. So cool. So now we have four templates, right? The question is, how do we make it so that this dynamically feeds in a different template for each? Well, what I'm going to do is I'm going to do something really simple. I'm just going to feed in a array and this array is going to have four items. So, we're just going to call this followup template array. Then inside of the array, we're just going to have four items. Every item is just going to be a different one. Cool. So, let's copy this. Let's now just paste this. And first of all, let me just verify that this actually works, right? Does this actually work? Let's just pin everything except for this so that we don't have to rerun this. I'm very um scared. I'm terrified of the Google Cloud Console API. So, I always just like to rerun things manually. Okay. So, we can make this smaller. That's fine. Where's the follow-up template? I am not seeing this. Uh here it is. Okay. So, hey loop over items blah blah. Hope you're well. Just checking the way. So, uh it looks like we can't include new lines here. So, I just have to regenerate the new lines manually, which is kind of annoying. We'll go new line. Thanks. New line. Nick. Okay, that should be fine. And then I'm just going to now duplicate this so that there's three. It's just I need to grab this. Right. Let's go back here now. Go new line. Then here we'll go. Thanks, Nick. This is number two. So, now I'm going to go. My goodness, is that annoying. We can actually open this up. What the heck am I doing? All right, paste this in again. We're going to do this two more times. So, I'm going to go back here. And I'm just going to replace this with new line, new line, new line. This is number three. And then this one here is going to be number four. New line. New line. This one's going to be new line. Okay, so now we should have all four of these. Let's just verify. Do we have all four of these? One, two, three, four. Cool. So, now that we have these, we should be able to implement some if then logic. Basically saying, hey, if this is a 7-day, I want you to follow up with this template. If it's a 14-day, I want you to follow up with another template. And so on and so forth. So, here's the template right over there. Uh, I actually don't know if this is going to hardcode the value of that. We're going to find out. What I'm going to say is we're going to grab the array follow-up templates. So, I'm going to go dollar sign JSON follow-up templates array. This is going to be 0 1 2 3. And actually, is there a switch here? Can I do a switch? Do I cases n switch function? Maybe. No, it looks like we only have a switch node, which is kind of annoying. I don't really want a switch node. or like a cases or something. I don't know. That'd be so much easier. Function node, write some JavaScript, switch node, and then set this value. That's kind of annoying, but it is what it is. Um, all right. So why don't we get this dollar sign JSONf follow-up templates array is zero. What I'm going to say is I'll go dollar sign if and then if the number of days is 14, right? So if days since sent equals 14, I think is it equals 7? H we'll start with this. Can we do multiple? Yes, I think we can. Or do we have to nest a bunch? It's kind of if the value is false, we need to go this again. Okay. Well, this is kind of annoying. Let's just feed this in AI. Write and end JavaScript of the form except we want four conditions. If days since sent equals 7, template follow up template array zero. If days since sent equal 14, then we go followup template array one etc. Let's just have it write it and see if it does a pretty good job. I like how it's doing the indents. Um, and this looks pretty good to me. So, that should be fine. Now, this is 14. So, we should grab number one. Okay. And we are grabbing number one. So, I think this is going to be fine. But hey, screw it. We'll give it a try. Now that we have this, let's pin it over here. Let's execute it and let's see what we feed in. Are we going to feed in the whole variable? Like if whatever or Yeah, it did. It fed in the whole thing, didn't it? It's kind of annoying. All right. So, what does that mean? Um, that means we actually have to do the logic here, which is annoying, but is also just what we got to do. So, let's change this to an expression field. Let's populate this here. And then now we should be feeding in Nick, not this. So we can unpin this. We can then re-execute this. Now we should get Nick. Uh, whoa. Using the item method doesn't work with pin data in this scenario. Why not? So we're aggregating a bunch of text. That's fine. We're now identifying the arrays. We might have to do some unpinning here. Okay. One sec. Let's just run this one more time and let's see if maybe there's an item matching error. Cuz as I mentioned, item matching errors are by far and above the most common and also the worst to deal with. If there is, I definitely don't see it right now, but I could just be crazy. Well, looks pretty good to me. Yeah. Yep. Okay. So, yeah, there was a temporary item matching error, but it was just because I had pinned the data. So, if you run into an issue like this, just unpin the data, give it another try. Okay, cool. So now it looks like we've queued up these drafts again. Just going to check them now. Okay. And so this is the one for Nicholas arrive at Gmail. Invoice for Nicholas with the full name. Following the invoice. I'm here to help anything clear. Show anytime. Hope you're well just checking on the invoice. I sent you to let me know if you need anything. Invoice for Nick. Cool. This looks pretty good. We now have basically accomplished our initial mission, which was to draft or send follow-up emails to a prospect so you know what's going on. We could extend this obviously. We can create a more in-depth follow-up system. We could do some sort of like monitoring or triage thing where after we send it out, we have some follow-up status. Then what we do is we like update this with the number of follow-ups and then maybe after four or something, it gets directed to a human. We could also employ the exact same approach that I just showed you guys right here, except instead of doing it for invoice follow-ups, you can totally just do it for sales follow-ups. So if you guys have people that are coming into your funnel, you can copy and paste the system, then just change the Google sheet source so that it's whatever your CRM is. Maybe it's like uh ClickUp or maybe it's Monday. com or maybe it's a whatever the heck you're storing your leads in Salesforce and then you can just rout it through this feed all the conversation history with a list of templates that are relevant to that particular thing and then just blast them out. So yeah, a lot of cool things you can do here. I'm going to leave it at that. But um hopefully everything here I've said makes sense and thanks so much for watching. And there you have

### Outro [43:08]

it. This is a complete automated invoice collection system that can easily generate an extra 10 to 15K per year by ensuring you guys actually get paid for the work you've already done. Now, if you want to see exactly how to sell systems like this to actual business clients, I'd encourage you to check out this video right here above my right shoulder where I start an AI service completely from scratch and land my first interested prospects live in just 10 hours. I walk through the complete process from identifying pain points to actually showing you how to close deals. Also, I should note that the technical skills to build these systems is not at all sufficient to actually make money. If you guys want to grow an AI automation company, the real need you have is putting yourself in front of customers and staying consistent with daily client acquisition activities while also obviously not getting overwhelmed like a lot of other people do just because this is a very shiny industry and there's a lot of possible directions to go down. Now, that's exactly where Maker School comes in. Maker School, if you haven't heard of it, is my 90-day accountability program that guarantees you your first AI and automation client or your money back. Many members land their first client within just two weeks by focusing on systems that solve obvious, expensive, and mundane problems. So, if you guys are serious about turning your automation skills into actual recurring income, check the link in the description. Otherwise, thanks so much for watching and I'll catch you on the next
