AutomationFlowsAI & RAG › AI Chatbot with Openai Gpt-4.1-mini and Supabase Database Knowledge Base

AI Chatbot with Openai Gpt-4.1-mini and Supabase Database Knowledge Base

ByGegenfeld @gegenfeld on n8n.io

This workflow creates an intelligent chatbot that uses your Supabase database as a knowledge base. The AI agent can automatically query your Supabase tables to provide accurate, contextual responses based on your stored data.

Chat trigger trigger★★★☆☆ complexityAI-powered9 nodesOpenAI ChatChat TriggerAgentMemory Buffer WindowSupabase Tool
AI & RAG Trigger: Chat trigger Nodes: 9 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6604 — we link there as the canonical source.

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
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f9bc9b12-0cbd-4be4-8408-ce69ee0dfc37",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        736
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a0cc3e0b-3f9d-4706-b37d-85ad3be5d22a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        736
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "67525380-20cc-4c60-b9eb-6642839e689c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        736
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bf56dce1-994a-4ed2-9b98-a1ae5d653c03",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        96
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f97b26e5-704c-48b1-9555-ac4269e663a1",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        96,
        576
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "53eabcc1-995e-4c43-8431-cc7b008006e1",
      "name": "Start Chat Conversation",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        48,
        352
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "4c6e4420-ba39-421a-a946-4722e0be7fe3",
      "name": "Smart AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        304,
        352
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "9e5fdb8d-5b4f-4681-86c1-2bf0c966c3b5",
      "name": "Remember Chat History",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        416,
        576
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "39af080d-d85f-48b9-831b-d0ead3079fdc",
      "name": "Supabase Database",
      "type": "n8n-nodes-base.supabaseTool",
      "position": [
        752,
        576
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Database": {
      "ai_tool": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Remember Chat History": {
      "ai_memory": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Start Chat Conversation": {
      "main": [
        [
          {
            "node": "Smart AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

This workflow creates an intelligent chatbot that uses your Supabase database as a knowledge base. The AI agent can automatically query your Supabase tables to provide accurate, contextual responses based on your stored data.

Source: https://n8n.io/workflows/6604/ — 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

Generate Sql Queries From Schema Only Ai Powered. Uses lmChatOpenAi, memoryBufferWindow, noOp, mySql. Chat trigger; 29 nodes.

OpenAI Chat, Memory Buffer Window, MySQL +3
AI & RAG

Generate SQL queries from schema only - AI-powered. Uses lmChatOpenAi, memoryBufferWindow, noOp, mySql. Chat trigger; 29 nodes.

OpenAI Chat, Memory Buffer Window, MySQL +3
AI & RAG

Generate SQL queries from schema only - AI-powered. Uses lmChatOpenAi, memoryBufferWindow, noOp, mySql. Chat trigger; 29 nodes.

OpenAI Chat, Memory Buffer Window, MySQL +3
AI & RAG

This workflow is a modification of the previous template on how to create an SQL agent with LangChain and SQLite.

OpenAI Chat, Memory Buffer Window, MySQL +3
AI & RAG

This n8n template provides a powerful AI-powered chatbot that acts as your personal Spotify DJ. Simply tell the chatbot what kind of music you're in the mood for, and it will intelligently create a cu

OpenAI Chat, Spotify, Chain Llm +7