AI AUTOMATION / CUSTOMER SUPPORT

CUSTOMER SUPPORT
RAG AGENT

Customer emails come in. The agent checks the knowledge base, the thread, and the order sheet. Then it drafts the reply. Nobody sends anything blind.

THIS IS THE SYSTEM.

The actual customer-support-rag-agent n8n canvas: Gmail trigger, Prepare Data, AI Agent with vector store, orders sheet and memory tools, structured output, Gmail draft, plus the Drive to vector store ingestion branch
THE ACTUAL WORKFLOW

Mail goes in, a draft comes out. In between, the agent decides what it needs to know and where to find it.

  1. CUSTOMER EMAIL
  2. PREPARE DATA
  3. AI AGENT
  4. KNOWLEDGE / MEMORY / ORDER DATA
  5. STRUCTURED RESPONSE
  6. GMAIL DRAFT

IT LOOKS FOR THE ANSWER.

  1. Watches the inbox, polling Gmail every minute.
  2. Pulls the sender address and message, builds a session ID from the message.
  3. The agent routes the question: general, or order.
  4. Retrieves from the source that fits. Supabase for general, Sheets for orders.
  5. Shapes a subject and message, saves a Gmail draft. A person sends it. Nothing sends itself.

THE MODEL DOES NOT MEMORIZE THE BUSINESS.

Models know a lot about everything and nothing about your company. So the docs get embedded into Supabase, and the agent searches them.

  1. GOOGLE DRIVE
  2. PDF
  3. DEFAULT DATA LOADER
  4. OPENAI EMBEDDINGS
  5. SUPABASE VECTOR STORE

General questions hit Supabase. Order questions hit Sheets. Never crossed.

OLD CONTEXT. LIVE FACTS.

MEMORY

Postgres, keyed by Gmail message ID. Same thread, same context. Session memory, not a CRM. It remembers what was said, nothing about who the customer is outside the thread.

LIVE ORDER DATA

Sheets, found by customer email. Financial status first: cancelled means no shipping story, refunded means explain the refund, pending means say so. Paid moves on to shipping.

  1. FINANCIAL STATUS
  2. VALID / PAID?
  3. SHIPPING STATUS
  4. RESPOND

Fixed rules beat model judgment here. The rule decides, the model phrases.

SOURCE NOTE / UPSTREAM HEADERS ARE FRENCH. KEEP OR REMAP THEM WITH THE SYSTEM MESSAGE.

THREE EMAILS.

“Do you offer replacement filters?”

General question. Searches the docs, drafts the answer.

“Where is my order?”

Order question. Finds the row by email, checks money first, then shipping.

“Where is my order, and do you sell filters?”

Both at once. Sheet plus knowledge base, one response. Neither source does the other's job.

THE MODEL IS THE SMALLEST PART.

Everything around it decides what it gets to know.

  • N8N

    Triggers, prep, agent calls, drafts. The logic, in the open.

  • OPENAI

    GPT-5.6 Luna reasons and writes. Its embeddings feed ingestion.

  • POSTGRES

    Thread memory by session key.

  • SUPABASE

    The documents table behind general answers.

  • GOOGLE SHEETS

    Order facts by customer email.

  • GOOGLE DRIVE

    Source PDFs in.

  • GMAIL

    Messages in, drafts waiting for review.

SIX CREDENTIALS.

Each one names a part of the system. When something breaks, the failing credential usually names the broken part.

CREDENTIAL SUMMARY
ServiceCredentialUsed for
GmailGmail OAuth2Receive emails + create drafts
OpenAIAPI keyGPT-5.6 Luna + embeddings
SupabaseSupabase credentialVector store / knowledge
PostgreSQLPostgres credentialConversation memory
Google DriveGoogle Drive OAuth2Source PDF ingestion
Google SheetsGoogle Sheets OAuth2Order lookup
  • Import workflow.json, connect all six.
  • Swap the sample Drive file ID, point the sheet at your spreadsheet.
  • Run ingestion once by hand, then activate.

DO NOT MAKE IT GUESS.

A model writes language. It does not know your policies or anyone's order. Every guess sounds confident. This setup exists to stop that.

  • KNOWLEDGEretrieval
  • CONTEXTmemory
  • LIVE DATAbusiness tools
  • RULESdeterministic logic
  • MODELlanguage + reasoning

09 / WORK WITH ZOLINE

HAVE SOMETHING WORTH AUTOMATING?

n8n when n8n fits. Custom code when it does not. Either way, it stops being your problem. Want to talk?