How we created a customer support AI Agent in one week using n8n
September 30, 2025
Our customer has approached us with a request to automate their customer support process for their Online Tutoring Platform, which was getting hundreds of similar customer support questions. Their main source of questions was Gmail, and the request was to analyze and draft ready-to-send email responses, which would help to reduce customer support time significantly.
Our Approach
After detailed research, we have decided to use n8n for this workflow automation. We have selected n8n for its no-code approach, wide variety of existing integrations, and ability to add custom code if necessary.
This guide explains our process and how you can set up something similar for your team. Check out our workflows in the public GitHub repository. It’s practical automation that’s easy to use and grow.
Version 1: A Basic Email Automation
We started with a straightforward setup: watch for new emails, generate a reply with AI, and save it as a Gmail draft for review.
In n8n, this uses just three parts: Gmail Trigger → LLM Chain → Create Gmail Draft.
Here’s the flow:
- The Gmail Trigger spots new messages in the support inbox.
- An LLM Chain, powered by a simple model like GPT-5-mini, creates a response. The instructions focus on a helpful tone, short answers, and company rules.
- The Create Gmail Draft saves it for the team to check and send.

For common issues like password resets or billing questions, this sped things up right away. Drafts were ready in moments, easing the daily workload.
That said, it had limits. Simple replies worked well, but in trickier cases, the reply quality mostly looked like AI hallucinations rather than an answer written by the customer support team. Support inboxes build up detailed, unique knowledge over time, and a basic AI setup couldn’t tap into it fully. We knew we needed to improve.
This simple automation took less than a day to implement, but it was only good for demo purposes and simple scenarios.
Version 2: Context-aware (RAG-Agent) workflow automation
The problem with the first version was the lack of context and domain knowledge.
Unfortunately, there was no solid product documentation, and the only knowledge source was more than 5000 customer support email threads. Our next goal was to feed those emails into our Agent workflow.
In n8n to achieve this we needed to setup two different workflow automations:
- Create a knowledge base from the past Gmail inbox
- Final workflow – knowledge-based email automation
Creating the Knowledge Base: Turning History into Searchable Data
RAG (Retrieval-Augmented Generation) is a way for AI to look up facts before answering. It first finds relevant documents, then uses them to write a more accurate, grounded reply.
To achieve that, we decided to create an n8n workflow that’ll create a knowledge base from the customer support Gmail inbox. RAG systems also require Vector databases to store an indexed knowledge base.
In this article, we will not get deeper into the RAG and Vector databases, but luckily, you don’t need all these details to set up a full workflow automaton using n8n.
We decided to use Pinecone as our Vector Database, as it has a fast similarity search and has a ready-to-use integration in n8n, and for our use case, the free tier was enough.
This first workflow builds the foundation: it takes resolved emails and turns them into a usable database in Pinecone. Run it once at the start, then update as needed.
The main steps in n8n:
- Get Sent Emails: Pull a list of replies from the support inbox using the Gmail node. These are the team’s trusted responses.
- Grab Full Conversations: For each reply, fetch the whole thread from the Gmail API. This includes the customer’s question for full context.
- Clean the Text: Emails come encoded and messy. We used one short JavaScript step to decode them (with tools like quoted-printable and mime), pull out plain text, and remove extras like old quotes, signatures, or standard notes. The result: tidy question-and-answer pairs in a format like “Question: [user’s message]\nAnswer: [customer support response]”.
- Convert and Save: Turn each pair into a vector with OpenAI’s text-embedding-3-small model – it’s cost-effective for this job. Then add it to Pinecone using its n8n node, also include any metadata that seems reasonable for later searching/filtering.

This handled thousands of threads smoothly, with low costs (around $0.01 per 1,000 embeddings). It created a solid “memory” collection – searchable, organized, and based on actual teamwork.
Final workflow – knowledge-based email automation
With the database ready, the main workflow becomes a smart agent. We switched to n8n’s AI Agent node, which manages tools like Pinecone. A basic model like GPT-5-mini works as the core.
Here’s how it runs:
- Gmail Trigger: Detects new emails.
- Quick Filter: A simple LLM Chain (using GPT-5-mini) checks the message with instructions like: “Does this need a support reply? Skip marketing, alerts, or internal items.” This blocks about 70% of unrelated mail.
- Find Matches: If it’s a real query, turn it into a vector and search Pinecone for the top 3-5 similar question-answer pairs.
- Generate Reply: The AI Agent gets the new query plus the matches. It follows prompts to “Write a clear, professional response in our style [examples], based on these cases.” The output is thoughtful and grounded.
- Save and Track: Store as a Gmail draft, add an “AI-Draft” label for sorting, and log details in Google Sheets (like query type and matches). For easy topics, you can add an option to send automatically, but review stays the default.

Tests showed big improvements: fewer errors, and drafts needing changes only about 15% of the time. n8n’s design makes it simple to adjust things, like prompt details or search settings.
Summary
Here are the key takeaways from this workflow automation task:
- First, we can confirm that the n8n framework selection was a good choice; we didn’t face any unexpected or unsolvable problems during the development. Everything we needed these types of frameworks to have, n8n has supported.
- For this type of automation, you don’t need the most recent and expensive models. The lightweight models perform well enough for this type of task.
- Overall, this n8n-based workflow automation is very cost-efficient. Of course, it will vary depending on the usage, but the overall hosting, licenses, and AI models cost for this automation was less than $50 a month.
- With very rough estimates, it has reduced the customer support team’s effort by nearly 80%.
Share this post