Generate Lookio RAG-backed Gmail drafts from incoming emails with GPT-4.1
This n8n template automatically generates knowledge-backed draft email replies when a new message arrives in a connected Gmail account. The workflow extracts a clean question from the incoming email using an LLM, quer...
Template notes
This n8n template automatically generates knowledge-backed draft email replies when a new message arrives in a connected Gmail account. The workflow extracts a clean question from the incoming email using an LLM, queries a [Lookio](https://lookio.app/) assistant (your RAG knowledge base) for verified context, then writes a subject and body draft with an AI writer and saves it as a Gmail draft so a human agent can review and send.
Watch the full tutorial here: https://www.youtube.com/watch?v=VLz3pCXDGd4&t=1s
Who is this for?
Customer support teams: Produce fast, fact-based draft replies for support tickets referencing internal docs. Sales teams: Auto-generate informed responses to product or pricing questions using your product docs. Ops & onboarding teams: Create consistent, accurate answers to frequent procedural questions. No-code automators: Quickly add RAG-backed email automation without building your own retrieval stack.
What it does / What problem does this solve?
Saves time: Reduces manual drafting by producing a polished draft a human can review and send. Ensures factual answers: Uses your Lookio assistant so replies are grounded in your uploaded documents and resources. Maintains human oversight: Messages are created as Gmail drafts (not sent) so agents can edit tone and details. Flexible filtering: You can restrict which emails trigger the template (labels, senders, or patterns) to avoid unnecessary drafts.
How it works
1. Trigger: New email incoming (Gmail Trigger) detects a new message. 2. Clean question: OpenAI Chat Model formats the email into a concise question for lookup. 3. RAG lookup: Lookio API call posts the question to your Lookio Assistant and returns research-backed output. 4. Draft generation: Write email draft LLM composes an email subject and body based on the Lookio output. 5. Save draft: Create email draft (Gmail node) saves the message as a draft in the original thread.