The Core Stack: Ingest, Process, Decide, Act
Every solid automation has a logical flow. Don’t just wire up an API call to ChatGPT and hope for the best. For this lead processor, the workflow has four distinct stages. Thinking in these stages keeps the build clean and makes it way easier to fix when something inevitably breaks.
1. Ingest: Get the raw data. In this case, it’s emails from a dedicated inbox where all the badge scans and contact forms are sent. The goal is to grab the body of every new email as it arrives.
2. Process: This is the AI’s job. Turn the unstructured block of email text into structured data. Who is this person? What company? What did they ask? Then, qualify them. Are they a potential customer, a student, or someone trying to sell me something?
3. Decide: Based on the processed data, what happens next? This is simple if/then logic. If the lead is ‘Hot’, do X. If ‘Vendor’, do Y.
4. Act: Execute the decision. Send a Slack message, draft an email, add a row to a CRM, or all three.
This isn’t just theory. It’s a mental model. If a lead doesn’t get a response, I can immediately ask: Did it fail to ingest? Did the AI process it incorrectly? Did the decision logic route it to the wrong place? Was the final action blocked?
Ingestion: Getting Data Out of Messy Emails
The first step is always the least glamorous. You need a trigger. I use Make (formerly Integromat) for this kind of workflow, but Zapier automations or others work too. I set up a simple module that watches a specific Gmail folder. When a new email lands there, the automation kicks off.
AI Side Hustles
Practical setups for building real income streams with AI tools. No coding needed. 12 tested models with real numbers.
Get the Guide → $14
This is where you hit your first problem: email formatting is a disaster. You’ll get plain text, fancy HTML signatures, weird disclaimers, and quoted replies from previous conversations. Your job isn’t to parse it perfectly here. Your only job is to extract the main body of text from the newest message in the thread.
My concrete gripe with many no-code tools is how they handle this. Their built-in text parsers are often too basic. They might grab the entire email thread, including signatures and legal boilerplate from the last five replies. You end up feeding a ton of irrelevant garbage to your LLM, which costs more money and, worse, confuses the model. I had to add an extra step using a bit of regex to strip out common reply patterns (like ‘On Tue, Jan 5, 2026 at 2:15 PM John Doe wrote:’) before sending the content to the next stage. It’s an annoying but necessary cleanup step.
What Most Guides Get Wrong About Lead Qualification
Here’s the biggest mistake I see. People take that messy email body and throw it at a single, complex prompt asking the AI to do everything at once: extract the name, find the company, guess their title, summarize their request, and assign a lead score.
This is lazy and it’s fragile. It fails often.
A much better approach is a two-step prompt chain. It’s more reliable, cheaper to run, and a thousand times easier to debug.
Step 1: Extraction. The first LLM call has one job: convert the unstructured email blob into a clean, structured JSON object. That’s it. It doesn’t judge, it doesn’t analyze, it just extracts facts.
Step 2: Qualification. The second LLM call takes the clean JSON from the first step as its input. Its job is to make a decision. Using the structured data, it determines the lead’s category. This separation of concerns is fundamental. The extraction model can be dumber and faster (like GPT-3.5-Turbo), while the qualification model can be smarter if needed (like GPT-4o), saving you money on most calls.
The Prompt Chain: A Concrete Example
Let’s make this real. Here are the prompts I actually use, simplified a bit for clarity. I run these using the OpenAI module in Make.com.
First, the extraction prompt. It’s very specific and tells the model to output only JSON. This is key.
System Prompt:
You are an expert data extraction assistant. Your task is to extract key information from the user's email text and return it as a valid JSON object. ONLY return the JSON. Do not add any commentary.
The JSON object must have these keys: "name", "company", "email", "phone", "inquiry". If a value is not found, use null.
---
User Prompt:
Here is the email body:
[Insert raw email text here]
The output of this is clean data. Now, I feed that clean data into the second prompt for qualification.
System Prompt:
You are a sales development representative. Your task is to qualify a lead based on the structured data provided. Your output must be a single word: "Hot", "Warm", "Cold", or "Vendor".
- "Hot": The user is asking for a demo, pricing, or a call. They have clear buying intent.
- "Warm": The user is asking a general question or for more information. They are curious but not ready to buy.
- "Cold": The user is a student, job applicant, or the inquiry is unclear.
- "Vendor": The user is trying to sell something to us.
---
User Prompt:
Here is the lead's data:
[Insert JSON output from the first prompt here]
My concrete love: This two-step process. When a lead is miscategorized, I can look at my logs (I use Airtable for this) and see exactly where it went wrong. Was the initial data extraction bad? Or was the qualification logic flawed? With a single prompt, you’d just be guessing.
