Automation library · Content

Gate pgvector indexing by checking consent in Postgres

Started by a clock, and works across Postgres and Slack. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 21 steps, 2 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAIRetrieval

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

The flow

Starts it 1Model 4Logic 9Service 7

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

  1. 1Index Run Every NightSchedule triggerStarts it
  2. 2Turn The Text Into VectorsEmbeddings Open AiModel
  3. 3Split Long RecordsText Splitter Recursive Character Text SplitterModel
  4. 4Consent RulesSetLogic
  5. 5Add To The IndexVector Store PGVectorModel
  6. 6Load The Record TextDocument Default Data LoaderModel
  7. 7Read The Records Waiting To Be IndexedPostgresService
  8. 8Mark The Record As IndexedPostgresService
  9. 9Read The Consent RegisterPostgresService
  10. 10Write The Inclusion ManifestPostgresService
  11. 11Match Each Record To Its ConsentCodeLogic
  12. 12Embed In BatchesSplit In BatchesLogic
  13. 13Decide If This Record May Be EmbeddedCodeLogic
  14. 14Gather Every OutcomeMergeLogic
  15. 15Where Does This Record Go?SwitchLogic
  16. 16Summarise This Index RunCodeLogic
  17. 17Record Why It Was RefusedPostgresService
  18. 18Hold It For A HumanPostgresService
  19. 19Anything Refused Or Held?IfLogic
  20. 20Tell The Data Protection OwnerSlackService
  21. 21Everything Was EligibleNo OpLogic

How it's built

Starts on
A clock
Steps
21, with 2 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Postgres, Slack
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 Postgres and Slack accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

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