Automation library · Data collection

Gmail to vector embeddings with PGVector and Ollama

Started by an arriving email, and works across Gmail and Postgres. 16 steps, 1 branch, 1 loop or waits: a working afternoon to understand properly.

MediumRetrieval

16 stepsMedium: a working afternoon
1Branch: places the flow splits
1Loop or waits
2Services it connects to

The flow

Starts it 2Model 4Logic 7Service 3

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

  1. 1Embeddings OllamaEmbeddings OllamaModel
  2. 2Recursive Character Text SplitterText Splitter Recursive Character Text SplitterModel
  3. 3Gmail TriggerGmail triggerStarts it
  4. 4Manual TriggerManual triggerStarts it
  5. 5Store vectorizedVector Store PGVectorModel
  6. 6Default Data LoaderDocument Default Data LoaderModel
  7. 7Extract email fieldsSetLogic
  8. 8Create the tablePostgresService
  9. 9Was manually triggered?IfLogic
  10. 10Store structuredPostgresService
  11. 11Explode interval into weeksCodeLogic
  12. 12No Operation, do nothingNo OpLogic
  13. 13Loop Over ItemsSplit In BatchesLogic
  14. 14Split OutSplit OutLogic
  15. 15Set before and after datesSetLogic
  16. 16Get a batch of messagesGmailService

How it's built

Starts on
An arriving email
Steps
16, with 1 branch, 1 loop or waits
Size
Medium: a working afternoon
Connects to
Gmail, Postgres
Model
None. This is plumbing, not judgement
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 and Postgres accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 16 steps is enough that you should read each one before running it.

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 16 steps before you point it at anything that matters.