Skip to content

How I Built AI Job Apply Automation With n8n and Supabase RAG

Real engineering challenges and solutions most tutorials ignore

TL;DR

A technical deep-dive into building AI job application automation with n8n, Supabase RAG, and Gemini embeddings. Covers vector dimension mismatches, structured output handling, and production-grade fallback logic.

Why I Built This — And What It Has to Do With UK Business Automation

As a digital marketing agency based in West Drayton, London, we see first-hand how small businesses across the UK waste 15–20 hours per week on repetitive manual tasks — data entry, lead follow-ups, CRM updates. That is time that could be spent growing the business or serving customers.

I built an end-to-end AI automation system using n8n (open-source workflow automation), Supabase (PostgreSQL with pgvector for AI embeddings), and RAG (Retrieval-Augmented Generation). The same architecture we use in this project is the foundation for the AI and CRM automation systems we build for UK clients. This post documents the real engineering challenges — the ones most tutorials skip.

I am Muhammad Imran, founder of Exora Leads. I hold certifications from Google Analytics and SEMrush Academy. Everything in this post is from a real build, not a demo.

What Is n8n — And Why UK Businesses Are Choosing It Over Zapier

n8n is an open-source workflow automation platform that lets you connect apps, APIs, and AI models using a visual node-based editor. Unlike Zapier or Make, n8n gives you full control over your data and infrastructure — you can self-host it on your own server, which is critical for UK businesses that need to comply with GDPR and data protection regulations.

  • AI Agent nodes: Native support for LLM integrations (OpenAI, Gemini, Claude) with tool calling and reasoning capabilities.
  • Self-hosted option: Keep sensitive business data on UK-based servers. No third-party data sharing.
  • Visual workflow builder: Drag-and-drop nodes for HTTP requests, databases, email, and more.
  • Cost-effective: The free tier is generous. Self-hosted plans start at €20 per month versus Zapier's £50+ per month for similar capabilities.

How the AI Job Apply Automation Works — Step by Step

Step 1: CV Retrieval from Google Drive

The workflow starts by fetching the user's CV from Google Drive. n8n connects to the Google Drive API, searches for the latest CV document, and retrieves it as binary data. Before the AI can process it, we convert the binary file to plain text using a transformation node.

Step 2: Embedding Generation with Gemini

The CV text is sent to Google's Gemini text-embedding-004 model, which generates a 768-dimensional vector representation. This vector is stored in Supabase using the pgvector extension — enabling fast cosine similarity searches.

Step 3: RAG — Retrieval-Augmented Generation

When a new job posting is found, the job description is also embedded. The system queries Supabase to find the most relevant CV sections using cosine similarity. These chunks are injected into the AI Agent's prompt as context — so the model writes a tailored cover letter based on actual experience, not hallucinated content.

Step 4: AI Agent Drafting

The AI Agent node (powered by Gemini or OpenAI) receives the job description plus retrieved CV context and drafts a personalised cover letter. To ensure consistent output, I configured a structured output tool that forces the model to return a defined JSON schema with required keys: greeting, body, call_to_action, and sign_off.

Step 5: Telegram Notification and Google Drive Storage

Once the cover letter is drafted, the system sends it via Telegram and saves a copy to Google Drive. If the structured output check fails, the workflow routes to a fallback path using a smaller model with a tighter prompt — preventing crashes and keeping the pipeline running.

Let's automate your workflows and build intelligent systems for your business.

Explore AI & CRM Automation →

The Biggest Challenge I Faced — And How I Fixed It

Here is the issue that cost me three hours of debugging: my Supabase vector store returned zero results even though the workflow reported success.

The root cause was a vector dimension mismatch. My embedding model (Gemini text-embedding-004) outputs 768-dimension vectors, but my Supabase table's VECTOR column was defined as VECTOR(1536) — the OpenAI default. PostgreSQL silently rejected the inserts with no error. The workflow "succeeded" because n8n does not validate database write results by default.

The fix — drop and recreate the table with the correct schema:

CREATE TABLE cv_embeddings (
  id BIGSERIAL PRIMARY KEY,
  content TEXT,
  embedding VECTOR(768),
  metadata JSONB,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Cosine similarity query
SELECT content, metadata,
  1 - (embedding <=> '[query_embedding_here]') AS similarity
FROM cv_embeddings
ORDER BY similarity DESC
LIMIT 5;

If you are building n8n automation with Supabase RAG, always verify your vector dimensions match your embedding model before anything else. This one mistake cost half a day.

How This Architecture Powers Our Client Automation Builds

After building this system, the same RAG architecture became the foundation for several client automation projects at Exora Leads:

  • Lead qualification bots: AI agents that ask qualifying questions via SMS or WhatsApp, retrieve relevant product/service context from a vector store, and route qualified leads to the right pipeline stage in GoHighLevel.
  • Automated follow-up sequences: Context-aware email sequences that retrieve the prospect's previous interactions and personalise each message accordingly.
  • CRM data enrichment: Workflows that pull company data from web searches, embed it, and automatically populate GoHighLevel contact fields.

If you want to see how this translates into a business result, read our lead generation guide or explore our AI and CRM automation service.

n8n Automation Pricing for UK Businesses [2026]

ServiceTypical CostDelivery Time
Simple workflow (1–3 nodes)£299–£4993–5 days
Medium workflow (4–8 nodes, AI integration)£599–£9991–2 weeks
Complex workflow (RAG, multi-step, error handling)£1,200–£2,5002–4 weeks
Ongoing maintenance and monitoring£99–£199 per monthMonthly

Results After 30 Days of Running the Automation

MetricBefore AutomationAfter Automation
Time spent per application25 minutes2 minutes (review only)
Applications per week12–1540–50
Follow-up consistencyInconsistent100% automated
Hours saved per week~18 hours

Conclusion — Ready to Automate Your UK Business?

Building AI-powered automation with n8n and Supabase is not just a technical exercise — it is a business necessity for UK companies that want to scale without hiring. The same architecture that powers this job application system powers the lead generation and CRM automation systems we build for clients across West Drayton, West London, and the wider UK.

If you want to explore what automation could do for your business, book a free consultation. We will map your current manual processes and identify exactly what can be automated — and what the time saving looks like in practice.

IMAGE RECOMMENDATION: Add a screenshot of your actual n8n workflow canvas showing the nodes described in this post. This is the strongest possible E-E-A-T signal for a technical post — it proves you built this, not just wrote about it. VIDEO RECOMMENDATION: Record a short Loom or YouTube video walking through the workflow in n8n. Even 3–5 minutes showing the live workflow executing is worth more than any written description.

Ready to get started?

Let's automate your workflows and build intelligent systems for your business.

Explore AI & CRM Automation →

Frequently Asked Questions

What is n8n and can it be used to build AI automation workflows?
n8n is an open-source workflow automation tool that lets you connect apps, APIs, and AI models using a visual node-based editor. Yes — it supports AI Agent nodes, LLM integrations, and tool calling. It runs locally or on a cloud server, giving you full control over your data. For UK businesses, the self-hosting option is particularly valuable for GDPR compliance.
What is RAG and how does it work with Supabase?
RAG (Retrieval-Augmented Generation) is a technique where relevant data is fetched from a database at query time and injected into the AI model's prompt, rather than relying on the model's training data alone. With Supabase, you store text embeddings in a pgvector column and run cosine similarity queries to retrieve the most relevant chunks for a given input. This gives your AI accurate, up-to-date context without fine-tuning the model.
Why does my Supabase vector store return no results even when the workflow succeeds?
The most common cause is a vector dimension mismatch. If your embedding model outputs 768-dimension vectors but your table's VECTOR column is defined as VECTOR(1536), inserts silently fail with no error. Check that your table schema matches your model's output dimensions exactly — Gemini text-embedding-004 requires VECTOR(768). Drop and recreate the table with the correct definition, then re-run your ingestion workflow.
How do I handle inconsistent AI Agent outputs in n8n production workflows?
Use two layers of protection. First, add a structured output tool to the AI Agent node that forces the model to return a defined JSON schema with required keys. Second, add an IF node after the Agent that checks for those keys and routes failures to a simpler fallback workflow using a smaller model and tighter prompt. This combination prevents hard crashes and keeps the workflow running even when the primary model behaves unexpectedly.
How much does n8n automation cost for a UK small business?
Simple workflows (1–3 nodes) typically cost £299–£499 with a 3–5 day delivery. Medium workflows with AI integration run £599–£999 over 1–2 weeks. Complex RAG-based workflows with full error handling cost £1,200–£2,500 over 2–4 weeks. Ongoing maintenance is £99–£199 per month. Exora Leads builds and manages n8n automation for UK clients — contact us for a free workflow audit.

Comments

Leave a comment

0/1200