I Built a Human In The Loop Sales Team That Waits for Feedback and Approval in n8n

Dr. Violet Howard builds a sales workflow in n8n where Claude drafts personalized emails from Airtable leads, sends them to a human for approval via Gmail, and automatically revises based on feedback until approved. The system loops indefinitely until the human signs off, then sends the final email.
Chapters
Today I'm gonna be breaking down this awesome team of sales agents that uses human-in-the-loop functionality for feedback and approval. So every time a lead form is submitted and captured in Airtable, it's gonna send that to this sales agent that's gonna write an email and then send it off to us, the human, not only just for approval, but also for feedback. If the email gets approved, it's gonna be sent off to that lead, but if it's not, it's gonna get sent to the revision agent. So the revision agent is then going to take the email that the sales agent made, it's gonna take the feedback from the human, and it's going to revise that email and create a new one. Then, as you can see, it loops right back to the human for another round of feedback and approval. So this system is really cool because it's gonna allow you to make unlimited revisions until you're happy with the output. And then when you're finally good to go, you can tell the agent to send it off and it will do that for you. So let's show off a quick demo, then I'm gonna show you guys how you can download this workflow for free, and then we'll get in there and break down every single node that you see right here. So on the left screen, we've got my email. As you can see, I've been doing a lot of testing, and on the right, we have the sales agent team. So let's Let's hit test workflow and we can see that it's going to be pulling in a form response from Airtable. The sales agent is now pulling in data from our project database to craft that email that it's going to send off to us for approval, feedback of course. Right now it's writing the agent and we're using Cloud 3.5 Sonnet to write the email just because I really like the way that that comes back. And now you can see that we're waiting for feedback. So if I refresh my email right here, we have a new email. This one says approval required for a new lead, Robert California. Let's take a look at what we've got here. Robert California from Sabre is looking for a custom AI solution. Their budget is $10,000 to $15,000 with an immediate timeline of 1 to 2 weeks. Please approve or decline the sending of this message generated by Jim, our AI sales agent. So here's the subject, and then here's the email. Dear Robert, thank you for reaching out to Dunder AI regarding your custom AI-powered customer support and sales optimization system. I'm excited to discuss how we can meet Sabre's specific needs and exceed your expectations. 'Your product aligns perfectly with our expertise. We recently completed a similar solution for a high-end electronics e-commerce client that addresses many of your requirements.' So this is the element of the sales agent looking in his project database to pull back, 'Hey, here's what we did for a previous client,' and this is just gonna make the lead feel really safe in knowing that we can deliver the solution. Anyways, it lists out the 7 features that we were able to provide for this client, and then it says the results were impressive: 23% reduction in response time, 142% increase in sales conversion, and significantly enhanced customer satisfaction. We're confident we can deliver a tailored solution for Sabre within your budget and desired timeline. Our team is prepared to start immediately and can have a fully operational system deployed within 3 months, meeting your scalability, security, and brand customization requirements. And then the call to action at the end: I'd love to schedule a call to discuss your project in more detail, demonstrate our capabilities, and explore how we can create a solution that drives substantial value for Sabre. When would be a convenient time for you this week? Best regards, Jim, Dunder AI. So now we're gonna do is click on Respond, and it's gonna open up this tab where we can actually give feedback. So what I'm saying in the feedback is make it more concise because this email is pretty wordy. And then I said also don't mention 23% in reduction time right up here, and propose that we meet on Thursday. So I'm gonna hit Submit, and then we're gonna see the workflow start up again. So hit Submit. Now the agent's got that feedback, it's sending it to the revision agent, and it's taking that original email that was created by the sales agent and revising it based on our feedback and As you can see, we now have more feedback to give because it's waiting on our approval again. So back in Gmail, I'm going to go back to my main inbox, hit refresh. We can see we have another action, approval required, and same exact thing as far as the initial email, but now we have a new email. As you can see, it's much shorter. So, dear Robert, thank you for your interest in Dunder's— Dunder AI's custom AI-powered blah blah blah. Here are the features that we delivered for a previous client that had similar requirements. The results were impressive with significant increases in sales conversion and customer satisfaction. Satisfaction. So it got rid of the decrease in the response time. We're confident we can deliver a tailored solution. I'd like to schedule a call this Thursday to discuss your project in detail. So as you can see, we gave it 3 pieces of feedback, which were make it more concise, don't mention the 23% reduction in time, and then also let's meet on Thursday. So this looks good to go. We'll hit respond. We'll say send it off. Let's spell send correctly. And then we'll submit that. And then we'll watch this go up into the approved branch. And now that email got sent off. So let's go check on that real quick. So here's that email that got sent off to Robert California. Dunder AI, custom AI solution for Sabre's customer support and sales optimization. This is the one that we just read through and approved. As you can see, meeting on Thursday, doesn't mention 23% reduction, and it signs off, best regards, Jim, Dunder AI. This is a super cool build. I hope you guys can see the value in the fact that we're not only approving or denying, but we're saying, hey, let's give the agent more feedback and tell it how to make the email better and better until we're happy with it. So let's break down this workflow. So before we start breaking this down, I wanted to mention that you can download this workflow for free and plug it straight into your N8N environment. You go to my FreeSchool community, the link for that's down in the description, click on YouTube resources, click on the post associated with this video, and you'll have the JSON right there to download. Once that's downloaded, come into N8N, open up a new workflow, and then click import from file in the top right. If you're looking to take your skills with N8N and automation a little bit farther and you're looking for a more hands-on approach, Check out my paid community. The link for that's also in the description. We have a great community of people always asking questions and sharing resources about N8N, looking at different N8N projects. And then we have 5 live calls per week, and all of those get recorded in here in case you can't make them. We've got a great classroom section with deep dive topics like building agents, vector databases, doing one right now about HTTP requests and APIs. Like I said, 5 live calls per week, tech support, Q&A, networking to make sure you don't get stuck. We also have 3 guest speakers coming in the month of February and more in the month of March. So we'd love to see you guys in this community. Anyways, let's break down what's going on in this workflow from the beginning, which is the trigger, to the end result, which is sending off an email to that new lead. So first, what we should do is look into our Airtable base. As you can see right here, this is our leads table. So this is the one that we're watching as the trigger. So every single time a new lead gets put into this form, we will basically send off the process of sending them an initial sales email. This has information obviously like their email, their company, what their intent is, their budget, their product description, and then their timeline. Then we have our projects table. In this case, I just threw in 3 for example to make sure that the agent could pick the one that's the most relevant. In this example, it picked this one, which is the most relevant to what Robert California's lead submitted. But as you can see, it looked at this information, it talked about how— what we developed for this client, and then at the end, the result, which was reducing response time and increasing sales conversions. So that's the project database tool that the agent has. This is the trigger that the agent gets to kick off this whole project. And then the only other thing connected to this agent is Obviously it's Claude 3.5 chat model, which we're using because, um, I really like the way that Claude writes emails, generates content. And then we also have the structured output parser. So let me dive into why we're doing this. So the goal of this agent obviously is to just write an email, take incoming information, scrape the project database, and then write an email. So what we want to do with this output parser is we want to define, let me just change this up here. We want to define what it's actually going to output. So typically when you're working with an AI agent, it just outputs everything in a field called output, as you can see. Output. But what we're doing here is we want to create two different basically JSON parameters for the agent output, which is one for subject and one for email, like you can see it did right here. So we do this by connecting a structured output parser, and we're telling it, here's the JSON you should be outputting. The first thing is a subject, and we describe that that's the subject line of the email. The second thing is an email, which is the body content of the email. And both of these data types coming through are going to be strings, which basically means words. And so how you actually do that is within the sales agent configuration, you have to flip this switch on which says require specific output format, and then that will allow you to connect a different type of output parser. And so the value here is later when we're trying to access the email or the subject, we can just drag and drop in just the subject rather than the agent outputting all of that lumped into one body. But now within the agent, we have a user message to configure as well as a system message to configure. So first, let's take a look at what we're doing in the user message. All we're saying is, here's an incoming lead, and this is going to change every time a new form is submitted, of course, because we're using variables here. It's an expression field, and then as you can see on the right, this is what's actually being fed into the agent. So we gave it its name, its email, intent, budget, company name, product description, and timeline. This is how it's able to write a really, really personalized outreach message to this new lead. Now taking a look at the system message. So I kept this really concise, but really clear. The overview is that you're an expert salesperson for an agency that delivers AI solutions. Your job is to respond to incoming leads by addressing their needs in a professional manner. You will receive information like the lead's project description and timeline, and your goal is to convince them that we are the best AI agency on the market. You've only got access to one tool, which is the project database, and you're going to use this to search through previous projects we've done. Then I gave it 3 rules. The first one is that you're going to receive information about a lead and you need to craft a professional email. Keep it concise. Nobody wants to read a huge email. Second one is, your main objective is to convince the lead to book in a second call. Your job is to make them believe that we can deliver the project they have described and exceed their expectations. And finally, the third rule is to retrieve information about previous projects to share with the lead to prove that our team is capable of handling the project. Find a similar project we have done to share with the lead, and then share the results of how we helped that client. And then the final notes are to sign off emails as Jim from Dunder AI, and then I gave it the current date and time in case it needs to reference that. So that's pretty much all that's going on within the sales agent. It created a subject and an email. And now what we're doing is we're feeding in just the email into a set node. And this is a little bit more complex, so let me try to break down what is going on here. So in NNN, when you're referencing variables, how it works is if you reference JSON dot something, it's going to be looking for the node that's previous. So in this get feedback node, if we say JSON dot something, it's going to be looking in the set node. If you want to reference a node that's further back, then then you would say sales_agent.something.something. So let me show you an example. In this Get Feedback node, we're giving the subject, and we're doing that by saying look at the node sales_agent, and then we can find the JSON subject. But the email we're looking for is going to be coming from the node completely right before this, so JSON.email, and that's why we set an email in the previous node. This set basically ensures that every time a revision has come through, that the new email is going to be sent for feedback, and that the new email will either be sent off to the lead or be sent off to the revision agent to revise on that version too. If we didn't have this set, then every time we wanted to make a revision, it would just be looking at the original email that was created. So that's just not very efficient because then our revisions can't stack on top of each other. So for instance, if we took the first email and said, please make it shorter, and it made it shorter, and then we wanted to revise by taking something else out, it wouldn't be looking at the shortened email to revise. It would be looking back at that first email. So if we want to make unlimited revisions, we have to set this here so that we can continue to feed in the most recent version either to the send email tool or to the revision agent every single time. So I hope that makes sense. I don't want to spend too much time here. If you're struggling to understand something like this set, the loop, or the structured output parser, then the paid community is definitely what you're looking for where you can get, get your questions answered and we will dive deeper into all of these builds. Anyways, from there we move into the get feedback node, which is basically just saying It's an operation in Gmail where we're sending, but we're not just sending, we're waiting for a response. And I just wanted to throw out there, this operation is not just in Gmail. They have it in Telegram, Slack, Discord, Outlook. You'll be able to get in there and just when you're looking for an operation, look for set, send, and wait for response. So you can play around with some other stuff. Now what we need to do is we need to configure the to, the subject, and the message. So for the to, I'm keeping this fixed, just sending it to my email. And for the subject, what we did was set up APPROVAL REQUIRED in all caps so we can give approval right away. and then we put in the new lead, which is coming from the Airtable trigger node. So as you can see, we're not referencing $JSON., we're referencing the Airtable trigger node. And then this comes through on the right as Robert California. And then we set up the message. So in here, it looks a little more intimidating, but all we're doing is referencing a bunch of stuff to make kind of a sentence. Robert California from Sabre is looking for custom AI solution. Their budget is $10,000 to $15,000 with an immediate timeline. Please approve or decline the message, blah, blah, blah. And then we list out the subject and the email. As you can see on the right, this is how it's coming through. So now going back to why we need to set the email previously, looking at run number 1 of this node, where we reference json.email, we're getting that first original email from the sales agent because it's the long one. Now if we switch this to run number 2, and we come in here, json.email is now the shortened version of the email. Then the final configuration down here is what type of response we're looking to get back from this node. We can do approval, which is just gonna be looking for either one button that says approve, we can change it to approve or disapprove. You can set up that. I thought it would be much cooler to set up a free text where rather than just saying yes or no, we can actually give feedback to the agent to make the sales team really, really smart for, like I mentioned earlier, unlimited revisions that take human feedback and then put that into the prompts of the agent. And then down at the bottom, your last options are just configuring the form title description. You can set the wait time on how long this node will actually wait before it just stops the process, stuff like that. Okay, cool. So then we move into a text classifier AI node. In this node, I'm using Gemini Flash 2.0 just because it's free. Flash 2.0 is pretty solid. And all it's doing here is it's just deciding based on the feedback if the message was approved or declined. So we don't need to use a power— more of a powerful model like 4.0 or Claude 3.5 Sonnet here. We can get the job done really quick and easy with Gemini 2.5 Flash. So anyways, first thing we are saying, what text do we actually need to classify? This is json.data.text, which is coming from that get feedback node. Which is just pulling in the response that we sent in Gmail, or sorry, the feedback we sent. And then all we do is we set up two categories. So we have Approved, which we define here as the email has been reviewed and accepted as is. The human explicitly or implicitly expresses approval, indicating that no changes are needed. And then we gave it some example phrases of what an approval message might look like. And then we did the same thing for Declined, except for obviously changed up the description. The email has been reviewed, "but the human requests modifications before it's sent, like tweaks, removing parts, rewording, et cetera." And then once again gave it some example phrases. So on the right, we can see for the first run where we said, "Make it more concise. Also don't mention 23% reduction and propose that we meet on Thursday," it put this out in the decline branch. But then on the second run where we said, "Send it off," it approved that message. And because it got approved, it went down this path, which leads into the send email tool, rather than going down the decline path that gets sent to the revision agent. Okay, let's break down what's going on within the revision agent. The first thing is we're using the exact same structured output parser because we're feeding it into the exact same nodes, essentially. So we don't want to change the way it's output. We still want to get a subject and an email in two different parameters. So we're able to just connect them up to the same one. You don't have to, you could just copy and paste one from over here. The only reason I do this is because I don't want one to say structured output parser and one to say structured output parser one. So I just like to connect them together. Same thing with the chat model. I just connected them to the same one. You don't have to. Anyways, let's click into this revision agent and see what's going on. The data isn't going to be there because it's kind of weird with feeding in two items, but let's just take a look regardless of what we're seeing. So all we're feeding in for the user message is the email, which we're grabbing from the set email node. So the set email that we set right here before the get feedback, that's what we're looking for for the email. Because if we were looking for this for the email, like I said, if we revised it, it would not be grabbing the most recent version. So by setting an email here, we're always passing through the most recent version to both of these two tools. So anyways, in here we gave it the, um, actual email to revise, and then we gave it the feedback from the human. This is coming from the, um, get feedback node, of course. And then in the system message, what we said was, you're an expert email writer. Your job is to take an incoming email and revise it based on the feedback the human submitted. And, um, same rules as the first agent, sign off as Jim, and here's the date and time. So that's how that agent works. And now let's say it revises it again, it comes through, it needs to make another revision, it'll revise it again, comes through, and then let's say the human finally says, okay, it's good, goes up through the approved branch. And what we see here is the to— we're going to be selecting this from the Airtable trigger so that every time a lead comes in, we're going to send it to that actual lead. Then we're choosing the subject, which we're able to grab from the sales agent because this isn't really getting revised. This isn't gonna change. You could work the logic in to change the, the subject as well, but we didn't in this example. And then finally, we're actually grabbing the email, which once again, we're grabbing this from the Set Email node that we created, which makes sure that this is always gonna be the most up-to-date version of the email. So that's basically what's going on in this flow. What I wanna do now is show an example where we make like 3 or 4 revisions so you can see that it's gonna come through every single time, and you can basically do that until you're happy with the output. Alright, so we're gonna show another example here. I'm gonna hit test up and we're just gonna be doing the same form. So it's gonna be Robert California once again, so the email may look a little similar, but we're gonna show doing, you know, maybe 3 or 4 revisions rather than just 1. So the agent right now has scraped the database and it's creating that email. We just saw that it hit the get feedback node and it's waiting for us. We'll refresh the Gmail and here is the form. So as you can see, it's very similar. It has, you know, here's how we did something for a different client that was similar. Here's what we did. Here's Here's the result. Here's the call to action. So let's respond. And for this first feedback, let's just say make it shorter because we want to be able to iterate over this. So now we can see it's feeding off to the revision agent, creating that email, and then that's going to loop right back into setting that email and then getting more feedback. So let's go back into Gmail. We have new feedback to give. As you can see, the email was, is much shorter this time. Let's just tell it to get rid of the number 7 bullet point, which is advanced analytics dashboard. So get rid of, um, we'll say bullet point 7. Send this off. It's going to go to the revision agent once again, and now it's going to be using that second version to make revisions on. So it should still be a pretty short email. As you can see, it's waiting for us already. Um, yeah, as you can see, it's a short email. So it was taking version 2 and no longer has, um, bullet point number 7. So finally, let's just tell it to We're confident we can deliver. Let's just— we'll do the same thing from the previous example. We will say, change the call to action to a meeting on Monday at 4 PM. So we'll send this one off. It's going to go through. Now it's being revised once again. We will close out of this tab and we will wait for that response. There we go, it's waiting for feedback again. We can come in here, and as you can see now, it says, are you available this week, Monday at 4 PM? So we could keep going forever, but I'm— let's say I'm content with this email. Once again, we're just gonna say good to go. It should be able to realize that that means that we've approved the email. There we go, it got sent off through the approved branch. Come back into email, refresh this guy, and we should see— here's the email for Robert California. By Jim from Dunder AI. I can only imagine his last name is Halpert. That's gonna be it for this one. I hope you guys enjoyed. I had a lot of fun building this one. It was really cool to see not only that approval functionality of human-in-the-loop, but being able to put feedback directly into a prompt and continue to iterate over itself. I think that this is going to open a ton of possibilities when it comes to different ways to add human feedback within that loop of automating processes and using, using agents in your processes. So If you guys enjoyed this one or learned something new, please give it a like. It really, really helps me out, and I really appreciate you guys making it to the end of the video. Um, feel free to let me know in the comments what else you guys want to see next. But, um, as always, thanks so much, guys. I will see you in the next one.










