Assignment
Assignment Overview
This assignment draws from an X client scenario: a B2B SaaS company receives
50-100 lead inquiries daily via email or forms, but manually qualifying them
(e.g., scoring based on intent, budget, and fit) takes 2-3 hours per day. Your task
is to automate this with n8n, incorporating AI for smarter processing.
Resources Required:
● Free n8n account (self-hosted or cloud—your choice).
● Test data: Use this public Google Sheet as a mock "inquiry database"
(columns: Timestamp, Email, Company, Message, Budget
Mentioned?).
● APIs: Free tiers of OpenAI/Groq for LLM, Google Sheets, and Slack (or
email) for notifications.
Problem Statement
Client Context: Imagine a SaaS company selling marketing tools. Leads come in
via a Google Form (simulated by adding rows to the Sheet). The system needs to:
1. Detect new inquiries.
2. Use AI to analyze and score them.
3. Route high-quality leads to sales (e.g., Slack notification).
4. Log everything for reporting.
Core Requirements (Must-Have):
1. Trigger & Data Fetch: Start the workflow on a schedule (every 15 minutes)
or webhook. Pull new rows from the Google Sheet (use the Sheet's
"Timestamp" to filter unseen entries).
2. AI Analysis Node: Use an LLM (e.g., Groq Llama-3 or OpenAI GPT-3.5) to:
○ Classify the lead's intent (e.g., "Demo Request", "Pricing Inquiry",
"General Question").
○ Score the lead (0-10) based on factors like budget mention,
company size hint, and urgency.
○ Extract key details (e.g., contact name, pain points).
○ Prompt example: "Analyze this lead message: [Message]. Output
JSON with:
{intent: str, score: int, key_details: dict}."
3. Branching Logic:
○ If score ≥7: Send a formatted Slack message (or email) to "sales
team" with details.
○ If score <7: Add a note to the Sheet row (e.g., "Low priority - follow
up later").
4. Error Handling: If the LLM call fails (e.g., rate limit), retry once or log to a
"failures" Sheet tab.
5. Logging: Append a summary row to a "Processed Leads" tab in the
same Sheet (include original data + AI outputs).