AutomationFlowsAI & RAG › RAG Ingestion Pipeline with Postgres

RAG Ingestion Pipeline with Postgres

Original n8n title: RAG Ingestion Pipeline

RAG Ingestion Pipeline. Uses textSplitterRecursiveCharacterTextSplitter, httpRequest, postgres. Webhook trigger; 5 nodes.

Webhook trigger★★★★☆ complexityAI-powered5 nodesText Splitter Recursive Character Text SplitterHTTP RequestPostgres
AI & RAG Trigger: Webhook Nodes: 5 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "RAG Ingestion Pipeline",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "rag/ingest",
        "responseMode": "lastNode"
      },
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ],
      "id": "node-webhook-ingest"
    },
    {
      "parameters": {
        "resource": "textSplitter",
        "operation": "splitText",
        "text": "={{ $json.body.text }}",
        "chunkSize": 1000,
        "chunkOverlap": 200
      },
      "name": "Split Text",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "id": "node-text-splitter"
    },
    {
      "parameters": {
        "url": "http://litellm-svc:4000/v1/embeddings",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{ $env.LITELLM_MASTER_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "text-embedding-3-small"
            },
            {
              "name": "input",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "name": "Generate Embeddings",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        750,
        300
      ],
      "id": "node-embeddings"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "INSERT INTO documents (content, metadata, embedding) VALUES ($1, $2, $3::vector)",
        "additionalFields": {
          "queryParams": "={{ [$json.text, JSON.stringify($json.metadata || {}), '[' + $json.data[0].embedding.join(',') + ']'] }}"
        }
      },
      "name": "Store in pgvector",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        1000,
        300
      ],
      "id": "node-pgvector-store",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "name": "Success Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "id": "node-respond"
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Split Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Text": {
      "main": [
        [
          {
            "node": "Generate Embeddings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Embeddings": {
      "main": [
        [
          {
            "node": "Store in pgvector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store in pgvector": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "rag"
    },
    {
      "name": "ingestion"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

RAG Ingestion Pipeline. Uses textSplitterRecursiveCharacterTextSplitter, httpRequest, postgres. Webhook trigger; 5 nodes.

Source: https://github.com/Embernet-ai/Ember-AI/blob/3ad03892d9aba348a8b7fcd0b3134f4c2e3c4d39/workflows/rag-ingestion.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Camila IA. Uses postgres, crypto, redis, agent. Webhook trigger; 92 nodes.

Postgres, Crypto, Redis +13
AI & RAG

Hi! I’m Amanda, a creator of intelligent automations using n8n and Make. I’ve been building AI-powered workflows for over 2 years, always focused on usability and innovation. This one here is very spe

OpenAI Chat, Redis, OpenAI +11
AI & RAG

This simple philosophy changes the way we think about automated sales agents. Context changes everything. In this 4-part workflow, we start by creating a knowledge base that will act as context across

Pinecone Vector Store, Document Default Data Loader, Text Splitter Recursive Character Text Splitter +12
AI & RAG

YouTube Agent. Uses supabase, agent, lmChatAnthropic, outputParserStructured. Webhook trigger; 56 nodes.

Supabase, Agent, Anthropic Chat +10
AI & RAG

RAG AI Agent Template V5. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, googleDrive. Event-driven trigger; 56 nodes.

OpenAI Chat, Document Default Data Loader, OpenAI Embeddings +12