Moosa Memon
← Index of work

Drive folder in, cited Slack answers out, all in n8n

DocuQuery: an n8n-orchestrated RAG pipeline that watches a Google Drive folder, keeps a Pinecone index of its PDFs current, and answers plain-language questions in Slack with citations back to the source document and page. 71 nodes across three workflows, 131 tests.

Type
RAG
Stack
n8n / Pinecone / Google Drive / Slack / JavaScript
Status
Complete; sample corpus included so the whole thing demos end to end

Problem

A team keeps its policies in a Drive folder nobody reads, and the same questions get asked in Slack every week. The answer has to be right, cite where it came from, and say “the documents don’t cover that” when they don’t. And the team wants it in the tools they already run, maintained by people who aren’t Python developers.

System

Three n8n workflows: ingestion (Drive → text → chunks → embeddings → Pinecone, 38 nodes, keeps the index in sync as files change), query (Slack /ask → retrieve → cited answer, 25 nodes), and a shared error handler (8 nodes). Answers come back as the answer plus a Sources list with document name, page and department.

Worth knowing

The JavaScript that runs inside the n8n Code nodes is kept as real, testable modules in src/lib/, and a build step assembles one file per Code node from them. That’s how an n8n project gets 131 tests: the chunking, citation formatting and provider logic are tested with plain node --test, and the workflow JSON is generated rather than hand-edited. It’s the answer to the usual objection that n8n automations can’t be engineered properly.

Have a workflow that looks like this?

Most of these start as a messy, manual process someone got tired of. Twenty minutes is usually enough to sketch how I'd approach yours.