Templates / Check consent before pgvector indexing in Postgres with OpenAI and Slack

Check consent before pgvector indexing in Postgres with OpenAI and Slack

Ready for 3.0

by Melbin Francis ✓ · 0 views · created 2026-09-16 · Document Extraction, AI RAG

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 21 nodes and runs on a schedule (every day at 02:00). Along the way it connects Postgres, Postgres PGVector Store, Embeddings OpenAI and Slack.

How it runs

Trigger: On a schedule (every day at 02:00).

  1. Consent Rules (Edit Fields (Set)): sets 5 fields: required_purpose, documents_query, register_query…
  2. Read The Records Waiting To Be Indexed (Postgres): run a query
  3. Read The Consent Register (Postgres): run a query
  4. Match Each Record To Its Consent (Code): runs custom JavaScript code
  5. Decide If This Record May Be Embedded (Code): runs custom JavaScript code
  6. Where Does This Record Go? (Switch): routes items into 3 branches
  7. Embed In Batches (Loop Over Items (Split in Batches)): loops over the items in batches
  8. Record Why It Was Refused (Postgres): run a query
  9. Hold It For A Human (Postgres): run a query
  10. Gather Every Outcome (Merge): merges the data from its input branches

…plus 6 more steps. See the full node list below.

Services it uses

PostgresPostgres PGVector StoreEmbeddings OpenAISlack

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (14)

From the author

Quick overview This workflow runs nightly to read unindexed knowledge base records from Postgres, checks each record against a Postgres consent register, and only embeds eligible text with OpenAI into a pgvector index while logging decisions to a manifest and…

Excerpt from Melbin Francis's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.