Automation library · Data collection

Interactive knowledge base chat with Supabase RAG

Started by someone opening a chat with it, and works across Gmail, Google Drive, Postgres, Supabase and one other. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 43 steps, 3 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAIRetrieval

43 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
1Loop or waits
5Services it connects to

The flow

Starts it 3Model 9Logic 10Service 21

The steps in the order they run, from what starts it.

  1. 1File CreatedGoogle Drive triggerStarts it
  2. 2Update to FileGoogle Drive triggerStarts it
  3. 3Embeddings OpenAIEmbeddings Open AiModel
  4. 4OpenAI Chat ModelLm Chat Open AiModel
  5. 5Postgres Chat MemoryMemory Postgres ChatModel
  6. 6List DocumentsPostgres ToolService
  7. 7Query Document RowsPostgres ToolService
  8. 8Character Text SplitterText Splitter Character Text SplitterModel
  9. 9When chat message receivedChat triggerStarts it
  10. 10Embeddings OpenAI2Embeddings Open AiModel
  11. 11Get Full Document Text - Get File ContentsPostgres ToolService
  12. 12Loop Over ItemsSplit In BatchesLogic
  13. 13Supabase Vector StoreVector Store SupabaseModel
  14. 14RAG AI AgentAgentModel
  15. 15Default Data LoaderDocument Default Data LoaderModel
  16. 16Edit Fields2SetLogic
  17. 17Supabase Vector Store2Vector Store SupabaseModel
  18. 18Set File IDSetLogic
  19. 19Validate FileIfLogic
  20. 20Check for DuplicatesPostgresService
  21. 21Set Error TypeSetLogic
  22. 22IF Duplicate CheckIfLogic
  23. 23Error LoggerSupabaseService
  24. 24Log DuplicateSupabaseService
  25. 25Debug File IDSetLogic
  26. 26Error NotificationGmailService
  27. 27Slack Duplicate NotificationGmailService
  28. 28Delete old DocSupabaseService
  29. 29Delete Old Data RowsSupabaseService
  30. 30Insert MetadataPostgresService
  31. 31Download FileGoogle DriveService
  32. 32SwitchSwitchLogic
  33. 33Extract from File PDFExtract From FileService
  34. 34Extract from TXTExtract From FileService
  35. 35Extract from CSVExtract From FileService
  36. 36Extract from XLSXExtract From FileService
  37. 37Extract from RTFExtract From FileService
  38. 38Extract from DOCExtract From FileService
  39. 39AggregateAggregateLogic
  40. 40Insert Table RowsPostgresService
  41. 41SummarizeSummarizeService
  42. 42Set SchemaSetLogic
  43. 43Schema Document MetadataPostgresService

How it's built

Starts on
Someone opening a chat with it
Steps
43, with 3 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Drive, Postgres, Supabase, Supabase vectors
Model
OpenAI
Retrieval
Answers are drawn from documents you supply, not from the model alone

Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Drive, Postgres, Supabase and Supabase vectors accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 43 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 43 steps before you point it at anything that matters.