Build an AI Lead Scoring System That Actually Works!

Maxime Warnault shows how to build a lead scoring system in n8n that qualifies prospects, calculates scores, and syncs them to GoHighLevel CRM. The workflow tags contacts based on score thresholds and routes them to different AI agents, with live testing via WhatsApp.
Chapters
All right guys, so this is part 2 of building an AI lead scoring and qualification agent. So on the previous video, I showed you how to qualify the leads by asking them a series of questions. And now what we are going to do is integrate some APIs to actually score the lead and send the score to the CRM so we can tag them, do whatever we want with them, and send them to another AI agent. Okay, so the first step we're going to do here is before we respond, we want to check here in the code if we return a question or if we return the lead score. Okay, so let's go ahead and do that. So we're going to have an if statement, and if this. So actually, we're going to do an expression that I have here. We're going to do the JSON here. So basically, what it says is, if— and let's just rename this one to AI setter, rename. And this way, our if is going to work. And we want to test if this is true or not. Okay, so what we have here is the output is going to be a question. So if this is a question, then we want to just send the message. If this is a lead score, then we want to send the lead score and update the CRM with the lead score, the reasoning behind it, etc. Okay, if this is true, then it's going to go to asking the next question, and if this is not true, then it is going to go to scoring the lead. Okay, so this one, really what we want here is the question. So this is fine here. And then what we want is if this is the lead score, now we need to talk to GoHighLevel to actually change the score of the lead. So how do we do that? We need to go into the API v2 of GoHighLevel, and we need to connect it to N8N. Okay, so what we are trying to do here is to update a contact custom field. Okay, so we're gonna go to contact And first what I want is to get a contact. So I'll show you here how to do that. So basically what we want is go back to settings and we want to go to Private Integration. And here we want to have— we want to create a new integration. Okay, so I already have one, but basically you would want to create a new one and click on next and it's going to give you a, a key. So a PIT, P-I-T, access token. So you're going to need to use this access token to then be able to see if the HTTP request that you do is going to work or not. Okay, so in that case, I want to get a contact using a contact ID, and basically you have my PIT here. And in the authorization, what we want to do is type Bearer with a capital B and then space, and then we want to paste the token that we have here, or the token that you have generated. Okay, and then when we click on send API request, contact with ID not found. Okay, perfectly fine. So let's go to contact, we're going to search for Maxime Warnault, and now we have the contact ID in here. So let's just paste this in here, send the API, and now you see that we have the contact added here. So we have additional emails, tags, and then custom fields in here. Okay. Okay. So, what we want is to have the custom field for the lead score, the lead score reasoning. So, what we're going to do is go to AI agents. So, lead score is 7 and lead score reasoning is Maxime Warnault shows. Okay, so we need to find the value that equals 7. Let's scroll down here. All right, so here it is. We have the ID here, and we have the— so this is the lead score, and this is the lead score reasoning. Okay, so basically what we want is to update these custom values with the lead score. Okay, so what we need to do is HTTP request. We're going to do a POST And we're going to this time update a contact. So I'm going to open the update contact in a new window. I'm going to copy this. I'm going to go back to n8n. It's going to be a PUT because this is an update. And now the contact ID is going to be— okay, so let's just go back here. We're going to pin this data so this way we can use it in our— or maybe not. Okay, let's just go back here, and what we'll do is we'll copy this. All right, so HTTP request is going to be the expression, and instead of first name, we need ID. Okay, so you can see that it has the ID in here. Authentication, we're going— because we previously connected to GoHighLevel using the API v2, we can check predefined credential and high level OAuth2 API. And here we have the connection that we had before. Okay, so what we want here is required in the path parameter is the contact ID. So we just did this here, we passed the contact ID that we want to update. You can see as well here on the required So this one we are not going to need it because we are using the OAuth authentication, but we're going to need the version inside of the header. Okay. So send header. And what we need is version and the value is going to be this. Okay. So paste this in here. Use the field below. And then we have the body. So what do we want to change here? JSON, using JSON. And what we want is to actually update the custom value or custom field. So what we can do is scroll down and then we'll have custom field somewhere. Yep. There we go. Custom fields. And so for it to be like JSON, we need to open the squiggly brackets, custom fields, and then we ask for the ID in here. So what we need is to go here, 7, we need to find the ID, boom, and the value is going to be the output lead score. Okay, so I'm going to do that in a second. And then we need the reasoning, so that's number 1. And then we need— so this one is lead score. We need to add a comma. And then let me put this in big so you guys can see. And this one is lead score, reasoning here. Okay, so what we need to do is basically the output here is going to be this AI setter item output question, but instead of question is going to be lead score. And here instead of lead score, it's going to be lead score reasoning. Okay, so this is the 3 things that is going to give us. All right, so now this one is updating lead score, and then what we can do is add a tag. If we can add a route here, so we're gonna check if the lead score, so lead score number is greater than, and we're going to say 5, in that case that means that it is qualified. So we're going to— qualified question mark. So if it is qualified, we're going to add a tag to send people to, to send this person to the AI Scheduler to get them on a call. And if they are not qualified, we're going to send people to the AI Seller to actually sell them a product. Okay, so now what we can do is go to Tags, add a tag, and here we have the post. So what we need to do in here, we need to duplicate this And we can rename this tag AI Scheduler. And let me just do this one. So here we can do, we can replace this. We are going to move the contact ID before, paste, and basically the tag that we want to add. So let's just make sure that we have the right thing. So, path parameter contact ID, we just did that. The version should be this one, so it's the same. And then the body should include tag. Okay, so let's just— so this is the body, so we can copy the body in here. And basically the tag that we want to add here is going to be AI Scheduler. All right. So we update this contact with this ID. We want to update the tag. This is a post. So this, you need to make sure that you can see it here, post. Post. We have the right URL. We have the right contact ID. And what we do is we send the AI Scheduler in here. Okay, so I'm going to duplicate this, and when this is false, so when the lead is not qualified, we are going to tag this person with "AI seller" to send them to the sales bot later on. Okay. All right. And then We are going to respond to the agent or to the person with the next step. So in here you can see that we have the response is going to be next step. So it doesn't, like, it doesn't have a question, but we use the next step to send the response. So this is what we're going to use in here. So we are going to want to use— so I believe this is text expression. And we're going to take instead of— so I'm going to copy this and I'm going to respond with Next step. Okay, so respond with next step. Okay, so this is what is going to trigger the next AI agent. Okay, so quick recap of what we've done here. During the qualification process, this AI bot is going to ask questions. What's your first name? What are you looking to scale your agency or coaching business? Question, question, question, question, question. So every time there is a question, we just ask the next question, wait for the answer, comes back here, sees what it needs to do, asks the next question. And when it asked all the questions, then it qualifies the lead. So it gives a lead score, lead score reasoning, and the next step. Perfect, you're the exact person we help. Would you be open to some ideas? And they are going to reply yes or no. And before we do that, because now we have the lead score and we don't have question in here because all we send is lead score, lead score reasoning, next step. And then we can update the lead score with the lead score and the lead score reasoning. So now we can create some automations in here that checks for the lead score that changed, and it's going to get this person to the AI scheduler or the AI seller. And because we have the tag now, everything is going to work. So let's try this. So we're going to talk to this AI. And yeah, one other thing I wanted to show you here is this. I reformatted it. So basically we want any of, and we have two elements in here. We have an object that contains question And we have an object that contains lead score, lead score reasoning, or next step. And then we tell it lead score needs to be an integer, so a number, lead score reasoning needs to be a string, and next step needs to be a string, and the question needs to be a string as well. So this is the first one here. Next we have an object That also has output. So you can see here the AI has added output, question, hey Maxime, okay. So we need to test if it's either case. So if we have just object and directly the question, or if we have the object, output, and the question. So that's what this does. Generally it's going to fall under this. So the output object is an object and it has the question and then lead score, lead score reasoning and next steps. Okay. All right. So what we're going to do now is test this to make sure that it is working properly. So just to show you what I do in here is let's just remove the score. Let's just remove this. And what we'll do is we'll make sure that we have the correct tag. So tag, you can see it's on the AI Scheduler. So I want to remove the AI Scheduler and I want to add the AI Setter. So Setter in here. Make sure that there are no other ones. Okay, so we're good. So this is going to go into the AI setter that we just created. So I'm going to send a message that is going to be keyword. I believe I still have my automation set up, so that should be working. Actually, I need to do this using WhatsApp. Sorry. All right, so let me find my— there we go. So I just sent a keyword on WhatsApp. You can see it here. And now because we are in the AI agent, I believe this is going to trigger the AI agent. So let's see. April 22nd at 11:56. So that's the right one. So let's see what we have here. So we add the message sent keyword, and basically here we have an error. So a keyword— so that's not what we're looking at, but output question, a keyword. So you're looking to scale your coaching business, right? So why did this wrong type— oh, okay. So because this is not true, that we want is we want to check if it exists or not. So if aiSellerQuestion or question exists, but we want to make sure that this is a true statement. Okay, so this is what we need to do here, I believe. Yes, here. Question true. Trim. So this is going to check if this is empty or not. So that's what we need to change here. And here you can see this is a boolean that we receive, so true or false. And because this is true, then it is going to move forward. So this is— the question is not empty, basically. This is true. So it's going to keep going here. If we wanted to check on another one, then we would have to do— if we wanted to check on the lead score, sorry, then this is what we would need to do. If the lead score is undefined, and if the lead score is something, is a number, and the lead score reasoning is not empty, and the next step is not empty, then we, this expression is true. And then you can see just the difference here is output in the, in, in between. Okay. So this should be working. I'm just going to reply as if I had received this question. So basically here as well, what we can update is text and we get the expression. I want to get the question here. So let me just go here. There we go. So this is the one that I want. So what we want— I don't like using JSON. So one thing here is it is using JSON. What I want is really use the AI setter. Okay. So I want to use the AI setter to have item JSON. Okay, output. So AI JSON, boom, that's what we want. There is two things here, JSON.question, and boom. Okay, so we make sure that we get this data from the AI agent. And because if we add steps in between, then it is going— it is not going to work. So I always want to make sure that I reference the previous thing that we added. Paste this in here and paste this in here. Okay, so here we can respond with question, rename, respond with next step. Let's make sure that it is AI setter. Perfect. AI setter. AI setter. AI setter. Perfect. Cool. So now that should be working. So I'm going to reply to this question. Hey Maxime, so you're looking to scale your coaching or agency business, right? All right, so we're gonna do this, and now I'm gonna say, "Write," and you're gonna see it appear right here. And now it should actually send me a message as well back, right? Then we're gonna come here, we're gonna wait for the execution. It is running. We're gonna see exactly what it does. So we add a response for this one. And basically, cool, appreciate you sharing what client acquisition method have you been using so far. And because now this is true, then it went through. So we have a question available. So because we have a question, then we can send this message in here. Cool. Appreciate you sharing. You can see that we replied using the AI agent, and now it is on my phone as well. So we're going to say mostly organic. We're going to keep it simple in here. So mostly organic, and we're going to have another execution come here that responds with the next question. Gotcha. How many clients does that bring every month, and what's the current pricing structure? So we're going to have this available in just a second. And so basically you can see everything that it did, checked that the output was correct, and basically asked the next question. You can see the memory as well, a bunch of messages, and yeah, you can see pretty much the entire history in here. So message is right. So you have the entire conversation history. Okay, gotcha. How many clients does that bring? I'm going to answer to this question. Just one or two clients a month. But we're going to— what did we say in here? Cool, great. So I don't think we added a— the qualification criteria, so it probably doesn't know what qualification we are based on. So I'm gonna say $10K each, just so it's $10,000 or $20,000, and we'll see what qualification score it gives us. But basically what we would wanna do here is give some qualification criteria to base the score on. So you can see it here that it just already went through. I already received the message. It's super fast. If things went exactly how you wanted, where would you like to your business to be in the next 6 to 12 months? I want to scale to 100K funds. Okay. So it just keeps asking a series of questions that we have predefined here. So we are on this one, then we have the fifth one, and then we are going to have the invitation to help, and then it's going to be the score. So that's a great goal. So that's what it replied with. So let me show you here. What do you feel is the biggest thing holding you back from achieving this growth right now? Marketing and sales. So we have the reply. It's going back to the bot. Boom. Executing. And now it sent me, based on what you shared, I can see specific ways our Skater system can help you. 'Would you be open to hearing how this might work specifically for your business?' Yes. So I just replied yes. I believe there is a redundant step in here because we have— we asked the question, 'Would you be open to hearing?' and then we have this call with the next step asking the same question, 'Can I send you some IDs?' So we have an error here. Okay, so it already scored delete. So it went to the false branch. And here, authorization failed. This auth class type is not allowed to access this scope. Okay, so we don't have the scope on here to— is not allowed to access this scope. Please verify your IAM configuration. In this case, I think I need a location level. Okay, okay, I think I know what I did. Actually, I think that should be working, but we're going to try something else. Agency account, and what we'll do here is we're going to add— create a new credential. White Label. We're going to use the same. Boom. Okay, let's connect. And what we'll do is instead of connecting to the agency, we're going to connect to this subaccount. So, connection successful. This is Maxime Warnault's account. Save. Okay, so let's try that again. Okay, let's— yep, let's go. Okay, so now it worked. Okay, so that was the reason. So because I was using the agency account that I could not— okay, so let's just remove this authorization here. We don't need it. Then I'm going to use Systems to Scale, and this should be working as well. This should be working as well. Save, respond. All right, so now we have updated the lead score, so I need to re-edit again. So let's remove this. Boom, boom. And we'll add the AI setter again. All right, perfect. So that should be the one. Yes, let's do this. And we should have a reply with the next steps. Update the lead score if it's qualified. Yep. All right, there we go. Boom. And now I have an AI scheduler and it asked me the right question. Perfect. Cool. So now this worked. Lead scoring, we updated the lead score. We can see Custom fields all the way down, probably here. So 8, and the lead score reasoning is here. So this is all good. Then we added the tag. So let's just refresh this. We want to make sure that now it leads to the scheduler when they reply, and we should be good to go. 8, doing 20K a month. We should have the AI Scheduler. So now when we reply, because we have the AI Scheduler and a lead score, it should go to the AI Scheduler. There you have it. That's everything for this video on how to create an AI agent that qualifies and scores your leads. If you guys have any questions, let me know below this video. If you want me to build this for you, send me a message on Instagram, and I will see you guys in the next video. Peace.
More from Maxime

I was talking to one of my clients' husband today and she's very not tech savvy and her hu

Most of the time we undercharge in the marketplace because we feel we do is not valuable e









