AutomationFlowsAI & RAG › RAG AI Chatbot with OpenAI & Supabase

RAG AI Chatbot with OpenAI & Supabase

Original n8n title: RAG Agent Supabase

RAG Agent supabase. Uses chatTrigger, lmChatOpenAi, embeddingsOpenAi, formTrigger. Chat trigger; 23 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered23 nodesChat TriggerOpenAI ChatOpenAI EmbeddingsForm TriggerMemory Postgres ChatDocument Default Data LoaderAgentGoogle Drive Trigger
AI & RAG Trigger: Chat trigger Nodes: 23 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger 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
{
  "createdAt": "2025-08-27T05:44:11.514Z",
  "updatedAt": "2025-09-02T09:53:18.402Z",
  "id": "6PwOxzbr8q0h7QF7",
  "name": "RAG Agent supabase",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -560,
        592
      ],
      "id": "8119fdb1-f901-45e0-98cb-0b50fd398167",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "o3-mini-2025-01-31",
          "mode": "list",
          "cachedResultName": "o3-mini-2025-01-31"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -464,
        800
      ],
      "id": "3c0faa42-a901-4a7f-9d20-90b908e9f73f",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -976,
        864
      ],
      "id": "78fbc636-178c-48ae-a503-f479ab371b5b",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "RAG documents",
        "formFields": {
          "values": [
            {
              "fieldLabel": "pdf documents ",
              "fieldType": "file",
              "multipleFiles": false,
              "acceptFileTypes": "pdf",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -1184,
        800
      ],
      "id": "61c7857c-0ca6-422c-9afd-5b0e9ec3a562",
      "name": "On form submission"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        -272,
        800
      ],
      "id": "a8622bbd-27d7-49f4-82ad-0ebb094c15ff",
      "name": "Postgres Chat Memory",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Supabase RAG \ub9cc\ub4e4\uae30",
        "height": 112,
        "width": 496
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1296,
        -208
      ],
      "id": "c341a9d9-f515-484b-9905-11fd029e741f",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## 1. \uc2e0\uaddc \ubb38\uc11c \ub4f1\ub85d\ud558\uae30.",
        "height": 512,
        "width": 768,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1408,
        496
      ],
      "id": "9ba9eba1-2aa9-4657-8fb4-ca9e2f2a84a8",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "dataType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        -768,
        864
      ],
      "id": "300bbbda-c105-476a-ade1-c5fc78899b08",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "## 2. RAG Agent",
        "height": 560,
        "width": 768,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -608,
        496
      ],
      "id": "0bb147c8-f003-4109-9f38-6aaeec8725c9",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        -368,
        592
      ],
      "id": "1c06d4ec-ac31-4a37-b34d-a26f5653fafc",
      "name": "RAG Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        -112,
        912
      ],
      "id": "8161fbb2-d342-48a7-84b9-4476ed7b681a",
      "name": "text-embedding-3-small",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "1Cj4QL6Irx7haS9qPi-ds_3VhduIkVZiI",
          "mode": "list",
          "cachedResultName": "obsidian_drive",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1Cj4QL6Irx7haS9qPi-ds_3VhduIkVZiI"
        },
        "event": "fileCreated",
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -1376,
        592
      ],
      "id": "b105fa9e-df6a-4d42-8a9d-aa12926402fe",
      "name": "File uploaded",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "url"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1168,
        592
      ],
      "id": "8f21e1fb-7132-416f-9577-b1e4119cb4c1",
      "name": "Download file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        -752,
        352
      ],
      "id": "f6caf25c-ea5c-4a76-bb48-ebcc36d67419",
      "name": "Supabase Vector Store - Doc",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "disabled": true
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1376,
        784
      ],
      "id": "003f6680-cbfe-4f45-8117-e3124f909016",
      "name": "When clicking \u2018Execute workflow\u2019",
      "disabled": true
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "\uc560\ud50c 3\ubd84\uae30 \uc601\uc5c5\uc2e4\uc801\uc744 \ud638\ucd9c\ud558\uae30.",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        -96,
        736
      ],
      "id": "236e012b-1de6-401f-8089-7d0ff77ece84",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## \uc560\ud50c 3\ubd84\uae30 \uc2e4\uc801 PDF\n- https://www.apple.com/kr/newsroom/2025/07/apple-reports-third-quarter-results/",
        "width": 320
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1408,
        304
      ],
      "id": "d22c278c-5767-4abe-9940-306b1b51d8ad",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        -928,
        672
      ],
      "id": "fddd6416-490c-4bb9-acc4-58212d200f63",
      "name": "Supabase Vector Store1",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        480,
        512
      ],
      "id": "ec726370-1ca2-4d95-a317-e54a2fdf5865",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        304,
        736
      ],
      "id": "c1866c3d-ca5d-4da0-9ba1-2d71ab453155",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        480,
        736
      ],
      "id": "8e0ff2d9-4dcf-4e82-9d12-38a3ae2153b1",
      "name": "Postgres Chat Memory1",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "\uc560\ud50c 3\ubd84\uae30 \uc2e4\uc801\uc744 \ubd88\ub7ec\uc624\ub294 \ubb38\uc11c",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        704,
        704
      ],
      "id": "fecdbe45-8f56-4f06-a520-60faa4484e33",
      "name": "Supabase Vector Store2",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        624,
        880
      ],
      "id": "992454e3-e549-4cf9-a386-23bb04ceebdb",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "RAG Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "text-embedding-3-small": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "File uploaded": {
      "main": [
        []
      ]
    },
    "Download file": {
      "main": [
        []
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_tool": [
        [
          {
            "node": "RAG Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store - Doc": {
      "main": [
        []
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": {
    "node:File uploaded": {
      "lastTimeChecked": "2025-09-02T05:17:37Z"
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "a744175a-ca21-430f-8ec6-5c0944a2e0af",
  "triggerCount": 2,
  "shared": [
    {
      "createdAt": "2025-08-27T05:44:11.514Z",
      "updatedAt": "2025-08-27T05:44:11.514Z",
      "role": "workflow:owner",
      "workflowId": "6PwOxzbr8q0h7QF7",
      "projectId": "sjNgDrdbhRMMF6SK"
    }
  ],
  "tags": [
    {
      "createdAt": "2025-06-25T04:00:38.130Z",
      "updatedAt": "2025-06-25T04:00:38.130Z",
      "id": "EyGUZypc5DKHVUyY",
      "name": "\ud328\uc2a4\ud2b8\ucea0\ud37c\uc2a4"
    }
  ]
}

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 Agent supabase. Uses chatTrigger, lmChatOpenAi, embeddingsOpenAi, formTrigger. Chat trigger; 23 nodes.

Source: https://github.com/2innnnn0/fastcampus-n8n-data-analysis-agent/blob/main/workflows/[6PwOxzbr8q0h7QF7]rag-agent-supabase.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

This workflow acts as a 24/7 sales agent, engaging leads across WhatsApp, Instagram, Facebook, Telegram, and your website. It intelligently transcribes audio messages, answers questions using a knowle

Chat Trigger, Memory Postgres Chat, Tool Workflow +20
AI & RAG

• Create a Google Drive folder to watch. • Connect your Google Drive account in n8n and authorize access. • Point the Google Drive Trigger node to this folder (new/modified files trigger the flow).

Agent, Chat Trigger, Memory Buffer Window +14
AI & RAG

The workflow operates through a three-step process that handles incoming chat messages with intelligent tool orchestration: Message Trigger: The node triggers whenever a user message arrives and passe

Chat Trigger, Memory Postgres Chat, OpenAI Embeddings +16
AI & RAG

This workflow transforms a Google Drive folder into an intelligent, searchable knowledge base and provides a chat agent to query it. It’s composed of two distinct flows: An ingestion pipeline to proce

OpenAI Embeddings, OpenAI Chat, Tool Http Request +10
AI & RAG

This n8n workflow automates the entire process, from learning based on your website data, documents to a multi-channel chatbot with automated ticket creation. It's the perfect solution for businesses

Chat Trigger, Agent, Form Trigger +10