Back to all articles
AI in production
RAGn8nNo-codeAutomation

How to Build a RAG Chatbot with n8n and Google Drive

Janahan Thavendran7 min read

TL;DR

  • Load a product user manual into Pinecone with n8n, then answer questions through an AI agent that retrieves the three best chunks.
  • Memory keeps follow-up questions in context, and the tool description tells the agent when to search the manual.
  • A Google Drive trigger re-indexes the manual on change; remove old chunks first so the bot never mixes versions.
In this article

A customer asks support how to export a report. The agent opens the user manual, a PDF of 120 pages, and searches for "export". Eleven results. None of them say which plan includes it.

This happens in every company that ships a product with documentation. The answer exists. Finding it takes longer than the question deserved.

A RAG chatbot fixes the finding part. You give it the manual, and it answers in plain language using only what the manual says. This post walks through building one in n8n, with no code, and then connecting it to Google Drive so the chatbot stays current without anyone uploading files by hand.

The example is a product user manual. A fictional product, "Acme Scheduler", stands in for yours.

What you need

  • n8n account. The cloud version has a 14-day free trial.
  • Pinecone account. The free tier is enough. This is the vector database that stores your manual.
  • OpenAI API key. Used for the embedding model and the chat model.
  • Google account. For the Drive folder that holds the manual.

How it works

Two workflows, one job each.

The first one prepares the manual. It takes the PDF, splits it into chunks, turns each chunk into a vector with an embedding model, and stores them in Pinecone.

The second one answers questions. A user asks something in a chat window. An AI agent searches Pinecone for the three most relevant chunks, reads them, and writes the answer.

The agent never answers from memory. If the manual does not contain the answer, it should say so. That is the whole point of RAG.

Stage 1: Load the manual into Pinecone

Create the index

In Pinecone, create a new index and name it product-manual. Choose OpenAI's text-embedding-3-small as the embedding model. It uses 1536 dimensions, which is how Pinecone knows the shape of the vectors it will store.

Build the workflow in n8n

Start with a manual version, so you can see the pipeline work before you automate it.

  1. Add an n8n Form trigger. Title it "Product User Manual". Add one file field named product_manual, restricted to .pdf.
  2. Add a Pinecone Vector Store node and set the operation to insert documents. Point it at the product-manual index.
  3. Attach the OpenAI Embeddings node and select text-embedding-3-small. It must be the same model you chose for the index.
  4. Attach the Default Data Loader. Set it to read binary data. It picks up the PDF straight from the form.

Run the workflow, upload the manual, and submit. When the run finishes, open Pinecone. You will see the records sitting in the index.

That is stage one. The manual is now searchable by meaning, not just by keyword.

Stage 2: Build the chatbot

  1. Add a Chat Trigger. Switch it to public so it gets a hosted URL you can share, or embed on your website. Set a greeting such as "Hi, I can answer questions about Acme Scheduler. What do you want to know?"
  2. Add an AI Agent node and connect it to the trigger.
  3. Give the agent a chat model. A GPT-4 class model works well.
  4. Give it Simple Memory, so follow-up questions make sense. Without it, "What about the Pro plan?" has nothing to refer to.
  5. Add a Vector Store Question Answer Tool as the agent's tool.

Configure the tool carefully, because the agent decides when to use it based on its description. Write it like an instruction:

Use this to answer questions about the Acme Scheduler product user manual.

Set the limit to 3, so the tool retrieves the top three matching chunks. Connect it to the product-manual index and the same text-embedding-3-small embedding model.

One more thing worth knowing. An agent can hold several tools at once. You could add a pricing tool or a release notes tool next to the manual tool, and the agent picks the right one for each question. You do not have to build separate bots.

Test it

Activate the workflow and open the public chat URL. Say the manual contains these two passages:

  • Reports can be exported as CSV or PDF. CSV export is available on Pro and Enterprise plans.
  • Deleted bookings are kept in the Trash for 30 days, then removed permanently.

Question: How do I export a report?

Answer: Open the report and choose Export. You can export as CSV or PDF. CSV export is only available on the Pro and Enterprise plans.

Question: I deleted a booking by mistake. Can I get it back?

Answer: Yes, if it was deleted in the last 30 days. Deleted bookings stay in the Trash for 30 days and are then removed permanently.

Question: And what about a booking I deleted two months ago?

Answer: It has been permanently removed, so it cannot be restored.

The third question is the one to watch. It relies on memory, since the bot has to remember we were talking about deleted bookings. And it tests whether the answer stays inside the manual.

Also ask something the manual does not cover. A good setup says it does not have that information. If it invents an answer, tighten the agent's system message to say it must answer only from the tool's results.

Stage 3: Connect Google Drive

A form upload is fine for a demo. In a real company the manual changes with every release, and nobody remembers to re-upload it.

Replace the form with a Google Drive Trigger.

  1. Create a folder in Google Drive, for example "Product Manuals".
  2. In n8n, add a Google Drive Trigger. Connect your Google account and watch that folder for new files and for changed files. Create two trigger events if your version of the node handles them separately.
  3. Add a Google Drive node after it, set to download the file, so the workflow has the PDF as binary data.
  4. Connect the same Pinecone insert node, with the same embeddings and data loader as before.

Now the flow is: someone saves a new version of the manual into the folder, the workflow starts, the content is vectorized, and Pinecone is updated. No one touches n8n.

One caution. If a manual is edited and re-indexed, the old chunks stay in Pinecone unless you remove them. Otherwise the chatbot can retrieve text from last quarter's version and from this one, and give two different answers. Either store the Drive file ID in each chunk's metadata and delete matching records before inserting, or use a fresh namespace for each version. Plan for this on day one. It is much harder to clean up after customers have seen the wrong answer.

What this setup does not do

  • It answers only from what is in the manual. If the manual is vague, the answers will be vague.
  • Scanned PDFs with no text layer will not index properly. Run OCR first.
  • Three chunks is a starting point. If answers feel incomplete, raise the limit and test again.

The part that matters

The tooling took an afternoon. n8n, Pinecone and OpenAI each have one job here, and none of them is hard.

The real work is the manual itself. The chatbot makes a good document more useful and a bad one more visibly bad. If you want better answers, start by fixing the pages people ask about most.