How to Build an AI Email Assistant from Scratch
By David Mansaray
Table of Contents
Imagine opening your inbox and seeing every repetitive question already answered, every customer email drafted, and your unread email count going down instead of up—all without you lifting a finger!
That’s the power of an AI email assistant.
Whether you’re a coach, consultant, founder, or part of a small team drowning in emails, automation is finally able to handle one of the biggest time sinks in business: the inbox.
In this guide, you’ll learn how to combine tools like n8n, OpenAI, and Pinecone to build your own smart system that reads, understands, and drafts replies for you. All without losing your voice or control.
Tools & Accounts You’ll Need

Before you can build an AI email assistant, you’ll need to set up a few tools.
They'll form the foundation of the system, each playing a specific role in how your emails are processed, understood, and responded to. The good news? Most of these tools are free or offer generous usage limits
First, you’ll need n8n, a powerful workflow automation tool. Think of it as the system that connects all the moving parts. It pulls emails from your inbox, processes them through AI, performs checks, and inserts the final draft in your inbox.
Next, you’ll need an account with OpenAI, the company behind models like 4o and o3. Large language models (LLMs) form the intelligence of your assistant. They’ll help classify incoming emails (e.g. spam vs customer query), search your internal knowledge base, and even write full replies.
To give the AI proper context for responding to emails, you’ll also need a vector database. This is where your assistant’s “memory” lives. We’ll be using Pinecone, a popular and developer-friendly option that stores your common questions and answers in a format the AI can understand and search through quickly.
Of course, since this assistant is for handling email, you’ll need an email account—Gmail works perfectly. The automation will monitor your inbox for new messages, draft intelligent replies, and even label or tag conversations as needed.
Finally, you’ll need a simple spreadsheet of your most frequently asked questions and answers. This is the raw material that gets transformed into searchable data for the assistant. A basic CSV file works fine, and you can create it using Excel, Google Sheets, or export it from wherever you store your customer service notes.
Each of these tools has a specific job to do, and once connected, they’ll work together to streamline your inbox with minimal manual effort. Once you’ve set up your accounts, we can move on to preparing the knowledge your assistant will rely on.
Step 1: Capture Your Knowledge Base
Before your AI assistant can begin writing helpful replies, it needs to understand your business, your tone, and the kinds of questions you receive regularly. The simplest way to give it that understanding is by creating a clear, structured knowledge base.
This knowledge base doesn’t need to be complicated. A simple CSV (Comma-Separated Values) file containing common customer questions and their corresponding answers works well. Each row should include a question you frequently receive and the ideal answer you'd like to give. This format is perfect for turning human language into something an AI can process.
Try to write your answers in a tone that reflects you or your brand voice. Keep responses concise, ideally under 200 words and prioritise clarity. The assistant will be using these answers to generate responses on your behalf, so this is your chance to shape how it “speaks.”
If you already have an FAQ page, canned replies, or support docs just copy and paste that content into your spreadsheet. If not, you can create your first version by reviewing past customer emails and pulling out the questions that come up most frequently.
Once your CSV is ready, save it. This file will serve as the raw input for creating AI-friendly representations (called embeddings), which we’ll load into your vector database in the next steps.
Step 2: Create Embeddings the AI Can Understand
Now that you’ve created your question-and-answer CSV, it’s time to make that data useful for the AI. Large Language Models like GPT-4o don’t “read” content the way humans do—they understand and retrieve information mathematically, through a concept known as embeddings.
Embeddings are numerical representations of text. When we convert a question or answer into an embedding, we’re translating human language into a vector—a list of numbers—that captures its meaning. This allows the AI to measure how similar one phrase is to another, even if the words used are different.
To create embeddings, we'll use OpenAI’s Embedding API. This is a simple process where each row in your CSV (usually the question, or both question and answer combined) is sent to OpenAI’s servers, and the resulting vector is returned.
We'll do this with a short Python script.
The script will enrich your original Q&A data with embeddings. We’ll use this file to populate your vector database in the next step.
Step 3: Upload Embeddings to Pinecone
Now that you've created vector embeddings from your questions and answers, the next step is to store them in a system that can quickly and intelligently search through them. This is where Pinecone comes in.
Pinecone is a vector database. It will allows your AI assistant to find the most relevant responses to incoming emails—not by matching exact words, but by understanding meaning through similarity, which is made possible by the vectors.
Start by signing up for a Pinecone account and creating a new index. You’ll want to give it a name and choose appropriate settings.
Upload your CSV of embeddings.
Step 4: Build the Email Assistant Workflow in n8n
With your data stored in Pinecone and your OpenAI API ready, it’s time to build the automation that powers your AI email assistant.
Watch for new emails: Use n8n’s Gmail node to fetch unread emails.
Label processed emails: Mark the thread with a label like “process_attempted”.
Classify email: Send the email body and subject to OpenAI’s chat API with a prompt asking it to classify the email.
Filter non-customer queries: Use an IF node to route only emails marked as "customer query".
Embed the email: Convert the email content into an embedding vector.
Query Pinecone: Use the embedding to search for similar Q&A entries.
Generate a reply: Feed the results and the email into OpenAI with a prompt to generate a draft reply.
Create draft: Save the reply in Gmail as a draft.
Final tag or notify: Add labels or notify your team as needed.
Set up the workflow to run automatically in the background at set intervals.
Step 5: Test, Tweak & Optimise
Send test emails that mimic real-world scenarios and check how your assistant performs. Review each draft:
Is the tone correct?
Is the answer accurate?
Did it use the right context?
Make adjustments to the prompt, Q&A content and Pinecone similarity threshold until your happy.
And that's it!
that's how you build and intelligent assistant that:
Saves hours each week
Responds quickly and consistently
Scales with your inbox
Thanks for following along, this is going to make email so much easier.
If you need help setting it up or refining your workflow, reach out and I'll be happy to support!