diff --git a/workflows/Qualify & Auto-Reply to Leads with OpenAI, Airtable, and Gmail-10928/qualify_auto-reply_to_leads_with_openai_airtable_and_gmail.json b/workflows/Qualify & Auto-Reply to Leads with OpenAI, Airtable, and Gmail-10928/qualify_auto-reply_to_leads_with_openai_airtable_and_gmail.json new file mode 100644 index 000000000..7211fe19b --- /dev/null +++ b/workflows/Qualify & Auto-Reply to Leads with OpenAI, Airtable, and Gmail-10928/qualify_auto-reply_to_leads_with_openai_airtable_and_gmail.json @@ -0,0 +1 @@ +{"id":"YfyO0GIAXy6P4q55","meta":{"instanceId":"2d7c0c52129f1e0e43eae52274134c8279cbf331cb1f0f6c3b87b0c9c99629f7","templateCredsSetupCompleted":true},"name":"AI Lead Qualifier & Auto Draft Reply AI Agent","tags":[],"nodes":[{"id":"2c840e17-2052-4a11-ae82-3e31a7cd65c8","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-64,-96],"webhookId":"2530848b-f845-4070-ba84-6a2ded19de95","parameters":{"options":{},"formTitle":"Leads Form","formFields":{"values":[{"fieldLabel":"Name","placeholder":"Enter Name","requiredField":true},{"fieldType":"email","fieldLabel":"Email","placeholder":"Enter Email","requiredField":true},{"fieldLabel":"Company / Business Name","placeholder":"Your Company"},{"fieldLabel":"Website (URL)"},{"fieldLabel":"What do you need help with ?"}]},"formDescription":"Work with Us to get more work done."},"typeVersion":2.3},{"id":"54c1e206-3f7d-4b66-9092-4dc7d072d906","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[144,-96],"parameters":{"text":"=A new lead has submitted a form. Analyze the lead and produce structured qualification data.\n\nHere is the lead information:\n\nName: {{ $json.Name }}\nEmail: {{ $json.Email }}\nCompany: {{ $json['Company / Business Name'] }}\nWebsite: {{ $json['Website (URL)'] }}\nMessage: {{ $json['What do you need help with ?'] }}\nSubmitted At: {{$json[\"submittedAt\"]}}\nSource: {{ $json.formMode }}\n\nYour tasks:\n1. Identify the business type (ecommerce, SaaS, agency, service business, creator, or unknown).\n2. Summarize their request or problem in 1–2 sentences.\n3. Infer an estimated budget in USD (numeric value only).\n4. Classify timeline as one of: \"ASAP\", \"1-3 months\", \"3-6 months\", \"Just Exploring\".\n5. Score the lead from 1 to 10 based on seriousness, clarity, buying intent, and fit.\n6. Classify priority based strictly on lead_score:\n - High: 7–10\n - Medium: 4–6\n - Low: 1–3\n7. Add a brief internal note (1–2 sentences) for the sales team.\n\nReturn ONLY the JSON object that matches the JSON Schema provided by the system.\n","options":{"systemMessage":"You are an expert Lead Qualification AI for an automation & AI services agency.\n\nYour role:\n- Analyze incoming leads\n- Extract structured data\n- Infer missing details when needed\n- Ensure all values match the JSON Schema provided to you\n\nRules:\n- Follow the JSON Schema EXACTLY.\n- Do NOT add extra fields.\n- Do NOT output text outside the JSON.\n- Do NOT include explanations, markdown, or backticks.\n- If information is vague, make a reasonable inference.\n- Assign lead priority based on lead_score:\n - High: score 7–10\n - Medium: score 4–6\n - Low: score 1–3\n- Timeline MUST be one of: \"ASAP\", \"1-3 months\", \"3-6 months\", \"Just exploring\".\n\nYour ONLY job is to fill the required fields with the best possible values based on the user-provided lead data.\n\nThe Agent tool will wrap your JSON inside an \"output\" object automatically. You MUST only return the JSON that matches the schema.\n"},"promptType":"define","hasOutputParser":true},"typeVersion":3},{"id":"2b31724e-7ba5-4488-88b7-d0d70d6c0b48","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[16,112],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{},"builtInTools":{}},"credentials":{"openAiApi":{"id":"msviD1slq6lGTW7K","name":"OpenAi account"}},"typeVersion":1.3},{"id":"7d213793-54b0-463b-a815-3eadd6c6620a","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[320,112],"parameters":{"schemaType":"manual","inputSchema":"{\n \"type\": \"object\",\n \"properties\": {\n \"lead_score\": {\n \"type\": \"number\"\n },\n \"priority\": {\n \"type\": \"string\",\n \"enum\": [\"High\", \"Medium\", \"Low\"]\n },\n \"business_type\": {\n \"type\": \"string\"\n },\n \"use_case_summary\": {\n \"type\": \"string\"\n },\n \"budget_normalized_usd\": {\n \"type\": \"number\"\n },\n \"timeline\": {\n \"type\": \"string\",\n \"enum\": [\"ASAP\", \"1-3 months\", \"3-6 months\" , \"Just Exploring\"]\n },\n \"ai_notes\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"lead_score\",\n \"priority\",\n \"business_type\",\n \"use_case_summary\",\n \"budget_normalized_usd\",\n \"timeline\",\n \"ai_notes\"\n ],\n \"additionalProperties\": false\n}\n"},"typeVersion":1.3},{"id":"1060c488-5f97-42dc-ae6e-a92ec2ba240c","name":"Create a record","type":"n8n-nodes-base.airtable","position":[496,-96],"parameters":{"base":{"__rl":true,"mode":"list","value":"app7j7VqUroBnTVVH","cachedResultUrl":"https://airtable.com/app7j7VqUroBnTVVH","cachedResultName":"AI Lead Qualifier"},"table":{"__rl":true,"mode":"list","value":"tbliuEsUTI5PRuAK6","cachedResultUrl":"https://airtable.com/app7j7VqUroBnTVVH/tbliuEsUTI5PRuAK6","cachedResultName":"Leads"},"columns":{"value":{"Name":"={{ $('On form submission').item.json.Name }}","Email":"={{ $('On form submission').item.json.Email }}","Phone":"NA","Stage":"New","Source":"Website","AI Notes":"={{ $json.output.ai_notes }}","Priority":"={{ $json.output.priority }}","Timeline":"={{ $json.output.timeline }}","Use Case":"={{ $json.output.use_case_summary }}","Lead Score":"={{ $json.output.lead_score }}","Assigned To":"Salesperson 1","Raw Message":"={{ $('On form submission').item.json['What do you need help with ?'] }}","Business Type":"={{ $json.output.business_type }}","Budget (Normalized)":"={{ $json.output.budget_normalized_usd }}"},"schema":[{"id":"Name","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Phone","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Phone","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Source","type":"options","display":true,"options":[{"name":"Website","value":"Website"},{"name":"Landing Page","value":"Landing Page"},{"name":"Ads","value":"Ads"},{"name":"Other","value":"Other"}],"removed":false,"readOnly":false,"required":false,"displayName":"Source","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Raw Message","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Raw Message","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Business Type","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Business Type","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Use Case","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Use Case","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Budget (Normalized)","type":"number","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Budget (Normalized)","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Timeline","type":"options","display":true,"options":[{"name":"ASAP","value":"ASAP"},{"name":"1–3 months","value":"1–3 months"},{"name":"3–6 months","value":"3–6 months"},{"name":"Just Exploring","value":"Just Exploring"}],"removed":false,"readOnly":false,"required":false,"displayName":"Timeline","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Lead Score","type":"number","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Lead Score","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Priority","type":"options","display":true,"options":[{"name":"High","value":"High"},{"name":"Medium","value":"Medium"},{"name":"Low","value":"Low"}],"removed":false,"readOnly":false,"required":false,"displayName":"Priority","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Stage","type":"options","display":true,"options":[{"name":"New","value":"New"},{"name":"Contacted","value":"Contacted"},{"name":"Qualified","value":"Qualified"},{"name":"Not a Fit","value":"Not a Fit"}],"removed":false,"readOnly":false,"required":false,"displayName":"Stage","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Assigned To","type":"options","display":true,"options":[{"name":"Salesperson 1","value":"Salesperson 1"},{"name":"Salesperson 2","value":"Salesperson 2"},{"name":"Salesperson 3","value":"Salesperson 3"}],"removed":false,"readOnly":false,"required":false,"displayName":"Assigned To","defaultMatch":false,"canBeUsedToMatch":true},{"id":"AI Notes","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"AI Notes","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Created At","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Created At","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{"typecast":true},"operation":"create"},"credentials":{"airtableTokenApi":{"id":"oyVD1wP4P7lqNoaJ","name":"Airtable Personal Access Token account"}},"typeVersion":2.1},{"id":"da858a02-045e-4772-ac81-95c93ebd01bd","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-368,-320],"parameters":{"color":7,"width":992,"height":624,"content":"## 1. Capture the leads form the Form \n\nFor each new lead, the workflow starts when someone submits your website form — their details arrive instantly through a webhook. Before sending anything to the AI, the workflow cleans and normalizes the fields so the model clearly understands the name, email, website, and message. The AI then evaluates the inquiry and returns structured insights like lead score, priority, business type, budget, timeline, and a short sales-ready summary. Finally, everything is saved neatly into your Airtable CRM so the team can review, track, and follow up without missing important context."},"typeVersion":1},{"id":"24a6fc17-e424-4732-891d-eaf15c410231","name":"Quality Leads Based On Score","type":"n8n-nodes-base.if","position":[704,-96],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"de8b767e-0617-462b-8e8e-be875b36e918","operator":{"type":"number","operation":"gte"},"leftValue":"={{ $('AI Agent').item.json.output.lead_score }}","rightValue":7}]},"looseTypeValidation":true},"typeVersion":2.2},{"id":"793d469a-7021-4640-b760-ddf5bfa19b0d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[656,-320],"parameters":{"color":7,"width":208,"height":624,"content":"## 2. Qualify a Lead\n\nCheck if lead is high quality >= 7 score"},"typeVersion":1},{"id":"65370c74-17a9-404e-946f-52e790fe92c6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[896,-320],"parameters":{"color":7,"width":496,"height":352,"content":"## Send Notification ?? (Optional)\n\nSending a notification to WhatsApp , Slack , order any other channel is alos possible with new functionality."},"typeVersion":1},{"id":"013fe72c-fbf3-44b8-8d68-985c86c8a4bd","name":"Send a message","type":"n8n-nodes-base.slack","disabled":true,"position":[944,-144],"webhookId":"7cf57873-77ce-42bf-a0c0-dddd4e2cd613","parameters":{"otherOptions":{}},"typeVersion":2.3},{"id":"5b0b59bb-b857-4e43-8fcf-25868e9f250a","name":"Send message","type":"n8n-nodes-base.whatsApp","disabled":true,"position":[1136,-144],"webhookId":"84c89cbf-4024-404f-8308-013663e87b0e","parameters":{"operation":"send","additionalFields":{}},"typeVersion":1.1},{"id":"a0c447a5-5a3f-4405-aa91-bd23dfdb411c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[896,64],"parameters":{"color":7,"width":496,"height":240,"content":"## 3. Send Email To Team \n\nThis node notifies when a High quality lead as come through."},"typeVersion":1},{"id":"1feea1d9-03c8-468e-871e-5a546a549a5d","name":"Send a message1","type":"n8n-nodes-base.gmail","position":[1008,176],"webhookId":"f7931997-397b-40d1-9a3c-98d1d075f202","parameters":{"sendTo":"growthriseagency@gmail.com","message":"=New high-priority lead qualified by AI:\n\nName: {{ $('On form submission').item.json.Name }}\nEmail: {{ $('On form submission').item.json.Email }}\nCompany: {{ $('On form submission').item.json['Company / Business Name'] }}\nWebsite: {{ $('On form submission').item.json['Website (URL)'] }}\nSource: {{ $('On form submission').item.json.formMode }}\n\nBusiness Type: {{ $('AI Agent').item.json.output.business_type }}\nTimeline: {{ $('AI Agent').item.json.output.timeline }}\nBudget (USD): {{ $('AI Agent').item.json.output.budget_normalized_usd }}\n \n","options":{},"subject":"=🔥 New High-Priority Lead ({{ $('AI Agent').item.json.output.lead_score }}/10) – {{ $('On form submission').item.json.Name }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"XP75jZHvtYBmWRDQ","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"c15e8031-5ccc-4181-82e4-9abe876594b2","name":"Gmail Trigger","type":"n8n-nodes-base.gmailTrigger","position":[-272,560],"parameters":{"filters":{},"pollTimes":{"item":[{"mode":"everyMinute"}]}},"credentials":{"gmailOAuth2":{"id":"XP75jZHvtYBmWRDQ","name":"Gmail account 2"}},"typeVersion":1.3},{"id":"ef2afd6d-bb05-4825-b8a4-a249f9e44fbb","name":"If","type":"n8n-nodes-base.if","position":[-64,592],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"db01b02b-f6fc-4c17-94c9-926e969155bc","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.Subject }}","rightValue":"🔥 New High-Priority Lead"}]}},"typeVersion":2.2},{"id":"6c143d82-82c7-4ada-a580-bb1e3cbc5f53","name":"Create a draft","type":"n8n-nodes-base.gmail","position":[640,480],"webhookId":"298ef59d-e5d0-4b7b-b31e-a3b8bdfdbde8","parameters":{"message":"={{ $json.text }}","options":{},"subject":"=Re: {{ $('Gmail Trigger').item.json.Subject }}","resource":"draft"},"credentials":{"gmailOAuth2":{"id":"XP75jZHvtYBmWRDQ","name":"Gmail account 2"}},"typeVersion":2.1},{"id":"b3b46d2a-5cdf-4d81-8aab-d1ab6fb736d1","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[272,512],"parameters":{"text":"=Here's the Email received - {{ $json.snippet }}","batching":{},"messages":{"messageValues":[{"message":"You are an automation & AI consultant. You write concise, friendly emails to new leads, based on their inquiry.\nYour goal is to:\n- Acknowledge their situation\n- Briefly explain how you can help\n- Ask 2–3 focused questions to clarify scope\n- Offer a link to book a call\nKeep it under 180 words. Tone: friendly, clear, and professional.\nReturn only the email body text, no greetings metadata, no JSON.\nAlways sign off with Growth Rise Agency\n"}]},"promptType":"define"},"typeVersion":1.7},{"id":"854c5798-b722-4df1-887b-e88615c92074","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[208,720],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{},"builtInTools":{}},"credentials":{"openAiApi":{"id":"msviD1slq6lGTW7K","name":"OpenAi account"}},"typeVersion":1.3},{"id":"2b9df358-d2ff-48ca-a719-9f5f970aaf94","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-368,336],"parameters":{"color":7,"width":1760,"height":640,"content":"## 4 . Draft a Reply Email AI Agent\n\nWhen a new high proioty lead comes we generate a AI-generated reply. The draft is a a clear, context-aware response. The draft is then sent to Gmail’s Create Draft node, so you can review, edit, and send it manually — giving you speed without losing control."},"typeVersion":1},{"id":"056cf72d-bf68-44b6-a351-30ecc0d77f89","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-1168,-320],"parameters":{"width":768,"height":1296,"content":"\n# 🧠 **How This Lead Qualifier + Draft Reply Agent Works**\n\n1. **Form Submission**\n A lead fills your website form with their details and project information.\n\n2. **Webhook Trigger**\n The form sends data into this workflow instantly through a webhook.\n\n3. **Clean & Normalize Data**\n We extract and format the fields (name, email, website, message, etc.) so the AI can understand them clearly.\n\n4. **AI Lead Qualification**\n The AI analyzes the lead’s message and returns structured data:\n\n * Lead Score (1–10)\n * Priority (High / Medium / Low)\n * Business Type\n * Use Case Summary\n * Budget (estimated)\n * Timeline\n * AI Notes for Sales\n\n5. **Save to Airtable CRM**\n The full lead + AI insights are stored inside Airtable for tracking and follow-up.\n\n6. **Hot Lead Routing**\n If the lead is high quality (score ≥ 7), the workflow triggers:\n\n * Instant email alert to you\n * Auto-reply sent to the lead\n\n7. **Low-Priority Leads**\n Lower-score leads are still saved but not routed, so you only focus on high-value opportunities.\n\n\n"},"typeVersion":1}],"active":false,"pinData":{"Send a message1":[{"json":{"id":"19a8de433777146c","labelIds":["UNREAD","SENT","INBOX"],"threadId":"19a8de433777146c"}}],"On form submission":[{"json":{"Name":"Kevin Hart","Email":"shri.deshmukh@simcorner.com","formMode":"production","submittedAt":"2025-11-16T13:29:56.215-05:00","Website (URL)":"www.simcorner.com","Company / Business Name":"Simcorner","What do you need help with ?":"I need some help with project ocnsulation with AI for a consultion youtube channel"}}]},"settings":{"executionOrder":"v1"},"versionId":"dd3e29bb-1032-4028-bdb1-8ab05d4dc131","connections":{"If":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Create a record","type":"main","index":0}]]},"Gmail Trigger":{"main":[[{"node":"If","type":"main","index":0}]]},"Send a message":{"main":[[]]},"Basic LLM Chain":{"main":[[{"node":"Create a draft","type":"main","index":0}]]},"Create a record":{"main":[[{"node":"Quality Leads Based On Score","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"On form submission":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"AI Agent","type":"ai_outputParser","index":0}]]},"Quality Leads Based On Score":{"main":[[{"node":"Send a message1","type":"main","index":0}]]}}} \ No newline at end of file