Yapay Zeka Ajanları
n8n Learning Path
CHAPTER 14Advanced ~120 min

Real Projects and Case Studies

Bring it all together: three end-to-end projects (WhatsApp AI support bot, lead scraper + CRM, RAG knowledge assistant).

In this chapter

You finished the curriculum: triggers, expressions, logic, loops, HTTP + webhook, DB, email, AI Agent, RAG, error handling, self-host and security. Now you combine everything into 3 real production projects. Each is end-to-end: architecture decisions, node order, critical nuances, deploy notes, monitoring. Adapt them to your sector and put them into your portfolio, a client's stack, or an internal automation. Pick one and finish it — one completed project beats three half-finished ones.

Topics

  • Project 1: WhatsApp AI Support Bot (message → Agent → knowledge base → reply)
  • Project 2: Lead Scraper + Enrichment + CRM (web → AI scoring → HubSpot)
  • Project 3: Internal RAG Knowledge Assistant (PDF → vector → Q&A)
  • Deploy, monitor and iterate

Project 1 — WhatsApp AI Support Bot: architecture & decisions

Scenario: handle customer questions arriving at an e-commerce or service company's WhatsApp Business number with AI; auto-answer the simple ones, escalate the hard ones to an agent. Decisions: (1) WhatsApp Business Cloud API (Meta) vs unofficial wrappers — production is Cloud API only; others get banned. (2) Start with OpenAI gpt-4o-mini — good multilingual, cheap. (3) Knowledge base (catalog, return policy, FAQ) via Chapter 10's RAG — Supabase pgvector is enough. (4) Conversation continuity via Postgres Memory + phone number = Session ID. (5) Human handover: if 'agent please,' 'complaint,' 'refund' appears, ping Slack and the bot steps back.

WhatsApp Webhook
AI Agent
Vector Store Retrieve
Memory (Postgres)
WhatsApp Send

Project 1 — Step-by-step workflow and critical nuances

Two workflows: (A) Ingestion — webhook on Drive change for product PDFs/FAQ → splitter → embeddings → Supabase pgvector. (B) Conversation — WhatsApp Webhook → branch by message type (text/audio/image): audio → Whisper transcribe, image → GPT-4o vision recognition. → AI Agent (system prompt: 'You are X company's customer agent; answer only from context; if asked about price/stock, fetch products from the DB') → vector store and 'order_lookup' tools attached → produce answer → WhatsApp Send. Critical nuances: (1) WhatsApp's 24-hour window — if the customer hasn't messaged in, you need a template. (2) Message bursting — if the user sends 3 messages in a row, Wait + Aggregate, then hand the agent all at once. (3) Cost guard — track per-user daily token budget in the DB; over the limit, reply 'system busy.'

Project 1 — Deploy, test and going live

Sequence: (1) In Meta Business Manager create a WhatsApp Cloud API app and get a test number. (2) In n8n's WhatsApp Trigger, set the webhook URL and verify token. (3) Test only with your own phone first — ask 20+ different questions (easy/hard/tricky). (4) Apply Chapter 13's security checklist (Meta already HMAC-signs; add Raw Body + signature verify in n8n). (5) Limited beta: 5-10 friendly customers, log for a week, collect the questions where the agent said 'I don't know' or got it wrong. (6) Refine the system prompt + RAG docs based on those logs (2-3 iterations minimum). (7) Soft launch: 10% of customers, then 50%, then 100%. At each stage track error rate, escalation rate and CSAT.

Project 2 — Lead Scraper + AI Enrichment + CRM: architecture

Scenario: for a B2B sales team find prospects, enrich them, push into the CRM. From a 'sector + location' input, generate 50-100 qualified leads per day, score them and load them into HubSpot. Decisions: (1) Data sources: Apollo.io, Apify (LinkedIn scraper), Google Maps API, sector-specific sites (Yelp, local directories). (2) Enrichment: Clearbit/Apollo enrichment API for email + phone + company size + tech stack. (3) AI scoring: an OpenAI Agent gets your ICP (Ideal Customer Profile) definition + lead data; returns a 0-100 score + one-sentence rationale. (4) CRM: HubSpot/Pipedrive — score > 70 → 'Hot Lead' list, 40-70 → 'Nurture,' < 40 → reject. (5) Trigger: Schedule Trigger at 09:00 daily, cap at 100 leads/day (rate + cost).

Schedule (daily 09:00)
{ }Apify Scraper
Apollo Enrichment
AI Agent (score 0-100)
IF (>70)
HubSpot Create

Project 2 — Scoring prompt, deduplication and cost

Scoring prompt template: 'You are a B2B sales expert. Our ICP: [company size, sector, technology, geography]. Score the lead below from 0 to 100. Output JSON: { score: number, fit_reason: string (1 sentence), red_flags: string[] }.' Use Structured Output Parser to constrain to schema. Deduplication: before writing to HubSpot check 'company_domain' or 'email' in the DB — skip if added in the last 30 days. Cost: 100 leads × 500 tokens = 50K tokens/day × gpt-4o-mini ≈ $0.03/day — practically free. Apollo enrichment is paid (~$0.05/lead) — enrich only leads with score > 50; unnecessary enrichment is 80% of your spend.

Project 2 — Outreach automation and feedback loop

Don't stop once the lead is in the CRM — automate outreach. Workflow: new Hot Lead in HubSpot → AI Agent drafts a personalised first email (scrape the company site, include one sentence about what they do) → send to Slack for approval ('Approve / Edit / Reject') → on approve, send via Gmail → no reply in 3 days, automatic follow-up. Feedback loop: at the end of each workflow log to Postgres (lead_id, sent_at, opened, replied, demo_booked). A weekly Schedule Trigger summarises this table to Slack. Update your ICP every quarter based on those numbers — the scoring prompt is a living document.

Project 3 — Internal RAG Knowledge Assistant: architecture

Scenario: the company has 1,000+ pages of internal docs (policies, procedures, product manuals, contracts). When an employee asks 'How does leave work in HR?' or 'What's the rate limit on product X's API?', they get a cited answer in seconds. Architecture: (1) Sources: Google Drive folders, Notion workspace, Confluence, Postgres tables, SharePoint. (2) Ingestion workflow: daily Schedule + file-change webhook (Drive/Notion) → text extract → splitter (1,000 tokens + 150 overlap) → Cohere embed-multilingual (better than OpenAI for non-English) → Pinecone. (3) Interface: Slack bot — user runs /ask, n8n replies. (4) Audit: log every Q&A with user_id — who asked what is on record.

Slack /ask
AI Agent
Pinecone Retrieve (top_k=5)
Slack Reply (with sources)

Project 3 — Permissions, citations and hallucination control

The biggest risk on an internal knowledge base: an employee reaches information they shouldn't (e.g. a CFO-level finance doc). Fix: tag every chunk with metadata 'permission_level: hr|finance|engineering|public,' check the user's Slack group memberships, retrieve only chunks they're allowed to see. System prompt: 'Use only the information in <context>; if not present, say "I don't have that in my docs — ask HR". End every answer with a sources list.' Structured output: { answer, sources: [{title, link}], confidence }. If confidence < 0.7, fall back to a no-answer message. These three layers (permissions + 'I don't know' + required citations) bring hallucinations near zero in practice.

Going to production: monitoring, iteration and sustainability

The real work starts after the three projects go live. Weekly rhythm: (1) Monday — last week's metric report: runs, successes, failures, average latency, total spend. (2) Tuesday — user feedback review: questions the WhatsApp bot couldn't answer, leads sales rejected, queries the assistant got wrong. (3) Wednesday — fixes: update the RAG corpus, improve system prompts, add new edge cases to the workflow. (4) Monthly — dependency updates, model version checks (A/B when a new Claude/GPT ships), cost optimisation. (5) Quarterly — re-run the security checklist, review the ICP, re-archive and re-index the RAG knowledge base. Sustainable AI automation = constant small improvements. A one-shot setup doesn't reach production quality.

Conclusion and what to do next

Anyone who finishes this 14-chapter path can: build end-to-end production automations with n8n, design AI agents and RAG architectures, run them safely on their own server. Next steps: (1) Pick ONE of the three projects and adapt it to a real scenario of yours — one finished project beats ten half-done ones. (2) Join the n8n Community Forum — real Q&A and edge-case fixes live there. (3) Download 5-10 community workflows from n8n.io/workflows, study them, build your own variant. (4) If you're building a SaaS or an agency: pick 3 sectors (e-commerce, real estate, education etc.), package a specialised workflow set per sector, price it. (5) Track new model releases (Claude, GPT, Gemini, Llama) — once n8n adapters land, swapping models is 3-4 config lines. The learning path ends here; your shipping path starts today.

This chapter's workflow (n8n editor view)

Webhook
AI Agent
Vector Store
HubSpot
Respond