AutomationFlowsAI & RAG › Index N8n Workflows and Enable Semantic AI Search with Openai and Supabase

Index N8n Workflows and Enable Semantic AI Search with Openai and Supabase

ByWeblineIndia @weblineindia on n8n.io

This workflow automatically indexes your n8n workflows every 24 hours, converts them into vector embeddings using OpenAI and stores them in Supabase. It exposes a webhook that lets you query your workflows in natural language. The AI agent uses Retrieval-Augmented Generation…

Cron / scheduled trigger★★★★☆ complexityAI-powered26 nodesHTTP RequestSupabaseDocument Default Data LoaderOpenAI EmbeddingsSupabase Vector StoreAgentOpenAI ChatTool Vector Store
AI & RAG Trigger: Cron / scheduled Nodes: 26 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → Documentdefaultdataloader 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
{
  "id": "ShQ4dNJXMTjKQIqd",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n Workflow Intelligence (RAG): Auto Indexing & Semantic AI Search",
  "tags": [],
  "nodes": [
    {
      "id": "77b3b1f6-bfac-4aa9-bb89-c28ca76f284a",
      "name": "Auto Sync Trigger (24h)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        656,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9d7a9bc1-35fc-4458-ad00-c37b7b668094",
      "name": "Fetch n8n Workflows API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        0
      ],
      "parameters": {
        "url": "http://localhost:5678/api/v1/workflows?limit=5",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "6eb7c088-e180-4742-bed0-660b147ef1d9",
      "name": "Extract Workflow List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1264,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "b279d73c-9b65-483d-9969-31d35755e253",
      "name": "Process Each Workflow",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1568,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3,
      "alwaysOutputData": false
    },
    {
      "id": "b329ca65-f003-4792-8254-e84dfc587fb4",
      "name": "Clear Existing Vectors",
      "type": "n8n-nodes-base.supabase",
      "position": [
        1808,
        16
      ],
      "parameters": {
        "tableId": "documents",
        "operation": "delete",
        "filterType": "string",
        "filterString": "=metadata->>workflowId=eq.{{ $json.id }}"
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "08f01e4e-8781-4c9e-a204-268a6cd22ecf",
      "name": "Transform Workflow to Chunks",
      "type": "n8n-nodes-base.code",
      "position": [
        2128,
        16
      ],
      "parameters": {
        "jsCode": "// Convert each node into chunk\nconst workflow = $input.first().json;\nconst allChunks = [];\n\nif (workflow.nodes && workflow.nodes.length > 0) {\n  for (const node of workflow.nodes) {\n    allChunks.push({\n      content: `Workflow: \"${workflow.name}\" (ID: ${workflow.id}). Node Name: \"${node.name}\". Type: \"${node.type}\". Logic: ${JSON.stringify(node.parameters)}`,\n      metadata: {\n        workflowId: workflow.id,\n        nodeType: node.type,\n        nodeName: node.name\n      }\n    });\n  }\n  return allChunks;\n} else {\n  return [{\n    content: \"Empty Workflow\",\n    metadata: { workflowId: workflow.id }\n  }];\n}"
      },
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "d0870700-edce-4116-ba23-8a2e6a4f1520",
      "name": "Prepare Documents",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        2720,
        304
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "metadata",
                "value": "={{ JSON.stringify($json.metadata) }}"
              }
            ]
          }
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a41d5fc3-6c05-483f-89d0-62dfa597f27f",
      "name": "Generate Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2464,
        304
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efd574ea-d4ac-4959-b4f6-67bf596faee6",
      "name": "Store in Vector DB",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        2560,
        16
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "queryName": "match_documents"
        },
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        }
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6beb08f2-d109-4718-8440-431294196fa1",
      "name": "Query Webhook (Ask Workflows)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        656,
        512
      ],
      "parameters": {
        "path": "ask-workflows",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "da7b32ac-52a7-4697-9850-622b7d3f4243",
      "name": "AI Workflow Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1120,
        512
      ],
      "parameters": {
        "text": "={{ $json.body.query }}",
        "options": {
          "systemMessage": "You are an n8n workflow expert. Use the search tool to find configurations in existing workflows.\n\nFormatting Rules:\n\nAlways explain the logic clearly.\n\nWhen you mention a workflow, you must provide a clickable link using this exact format:\nhttp://192.168.101.63:5678/workflow/[ID]\n(Replace [ID] with the actual workflowId found in the metadata).\n\nUse bold text for node names."
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8fb0a5d2-737b-498f-8c93-9effc5f39088",
      "name": "LLM Brain (Agent)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1008,
        752
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "895bbf3d-e976-4bfa-8750-3d2c6eb8c03b",
      "name": "Workflow Search Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        1232,
        768
      ],
      "parameters": {
        "name": "workflow_search",
        "description": "Use this tool to search for existing n8n workflows and their node configurations."
      },
      "typeVersion": 1
    },
    {
      "id": "022a1405-6808-41a6-a360-b83fb95aeb08",
      "name": "Vector DB Search",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        1152,
        1152
      ],
      "parameters": {
        "options": {},
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "documents",
          "cachedResultName": "documents"
        }
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "32826600-b20c-49d5-8854-0fc86a398ea7",
      "name": "Query Embeddings Generator",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1152,
        1360
      ],
      "parameters": {
        "model": "text-embedding-3-small",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "adac0d13-c399-4d8c-8e74-4c442b6da64c",
      "name": "Tool LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1424,
        1152
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "934ef9ed-8983-42a6-be78-f12b6d8c11f3",
      "name": "Return AI Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1712,
        1152
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.5
    },
    {
      "id": "9c8b2ef0-ab26-4f16-a4fa-0e7eb61b2dc6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 512,
        "content": "## Automated Workflow Sync Trigger\nThis section automatically triggers the indexing process every 24 hours. It ensures that newly created or updated workflows in your n8n instance are continuously synced and reflected in the vector database without requiring any manual intervention or re-indexing."
      },
      "typeVersion": 1
    },
    {
      "id": "00dfe159-c586-481a-9e94-0cadffe0cf50",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 512,
        "content": "## Fetch & Prepare Workflows\nThis section retrieves workflows from the n8n API and prepares them for processing. The API response is split into individual workflow items, allowing each workflow to be processed independently in later steps for accurate indexing and transformation."
      },
      "typeVersion": 1
    },
    {
      "id": "19bc7d0b-0ad9-46b4-9c98-536485c948b5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 512,
        "content": "## Iterative Workflow Processing\nEach workflow is processed one at a time using a controlled loop. Before inserting new data, any existing vector entries related to that workflow are deleted to prevent duplication and ensure the vector store always reflects the latest workflow configuration."
      },
      "typeVersion": 1
    },
    {
      "id": "5e7fdcdd-250a-4454-be34-ce1ac93708f3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2016,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 512,
        "content": "## Data Transformation & Chunking\nThis section converts raw workflow JSON into structured textual chunks. Each node within a workflow is transformed into meaningful content, including node name, type and configuration, making it suitable for semantic embedding and retrieval in a RAG system."
      },
      "typeVersion": 1
    },
    {
      "id": "37028b11-528d-4e20-b62e-cb3c07477982",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2384,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 672,
        "content": "## Embedding & Vector Storage\nStructured workflow data is converted into embeddings using OpenAI models and stored in Supabase Vector Store. This enables fast semantic search and retrieval, forming the foundation for the RAG-based AI assistant to understand and query workflows effectively."
      },
      "typeVersion": 1
    },
    {
      "id": "ca047398-4053-4783-98bc-05e39b1aa3c5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 432,
        "content": "## AI Query Entry Point\nThis webhook acts as the entry point for user queries. It receives natural language questions about workflows and forwards them to the AI agent, enabling real-time interaction with the indexed workflow knowledge base."
      },
      "typeVersion": 1
    },
    {
      "id": "ab8cdee2-8a50-437f-989f-dd8b27f9bc1c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 624,
        "content": "## AI Agent & Retrieval (RAG Core)\nThis section powers the RAG system. The AI agent interprets user queries, uses the vector search tool to retrieve relevant workflow data and combines retrieved context with LLM reasoning to generate accurate and context-aware responses."
      },
      "typeVersion": 1
    },
    {
      "id": "17372bdb-b146-42a0-97c1-c4c34d9f638e",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        960
      ],
      "parameters": {
        "color": 7,
        "width": 976,
        "height": 560,
        "content": "## Vector Search + Response Generation\nUser queries are embedded and matched against stored vectors to retrieve relevant workflow chunks. The LLM processes this context and generates a final response, which is then returned to the user via webhook in a structured and readable format."
      },
      "typeVersion": 1
    },
    {
      "id": "9127d0bc-3408-4c3e-bb89-a151cac1d7b9",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -272
      ],
      "parameters": {
        "width": 416,
        "height": 512,
        "content": "## Workflow Overview & Setup Guide\n\nThis workflow implements a complete **Retrieval-Augmented Generation (RAG)** system for n8n workflows. It automatically indexes workflows from your n8n instance, converts them into embeddings and stores them in a Supabase vector database. When a user sends a query via webhook, the AI agent retrieves relevant workflow data and generates intelligent, context-aware responses.\n\nTo set this up, first configure your n8n API access in the \u201cFetch n8n Workflows API\u201d node using proper authentication. Next, connect your Supabase account and ensure a ```documents``` table exists with vector support enabled. Add your OpenAI API credentials for both embeddings and chat models.\n\nOnce configured, activate the workflow. The indexing process will run automatically every 24 hours. You can query your workflows by sending a POST request to the webhook endpoint (```/ask-workflows```) with a ```query``` field.\n\nThis system enables you to \u201cchat with your workflows,\u201d making it easier to debug, understand and reuse automation logic using AI-powered semantic search."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "9cf81adb-df9d-40ea-8c01-2185885003d4",
  "connections": {
    "Tool LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Workflow Search Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector DB Search": {
      "ai_vectorStore": [
        [
          {
            "node": "Workflow Search Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "LLM Brain (Agent)": {
      "ai_languageModel": [
        [
          {
            "node": "AI Workflow Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Documents": {
      "ai_document": [
        [
          {
            "node": "Store in Vector DB",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Store in Vector DB": {
      "main": [
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Store in Vector DB",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Search Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Workflow Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Workflow Assistant": {
      "main": [
        [
          {
            "node": "Return AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Workflow List": {
      "main": [
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Each Workflow": {
      "main": [
        [],
        [
          {
            "node": "Clear Existing Vectors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear Existing Vectors": {
      "main": [
        [
          {
            "node": "Transform Workflow to Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Auto Sync Trigger (24h)": {
      "main": [
        [
          {
            "node": "Fetch n8n Workflows API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch n8n Workflows API": {
      "main": [
        [
          {
            "node": "Extract Workflow List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Embeddings Generator": {
      "ai_embedding": [
        [
          {
            "node": "Vector DB Search",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Transform Workflow to Chunks": {
      "main": [
        [
          {
            "node": "Store in Vector DB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Webhook (Ask Workflows)": {
      "main": [
        [
          {
            "node": "AI Workflow Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

This workflow automatically indexes your n8n workflows every 24 hours, converts them into vector embeddings using OpenAI and stores them in Supabase. It exposes a webhook that lets you query your workflows in natural language. The AI agent uses Retrieval-Augmented Generation…

Source: https://n8n.io/workflows/15274/ — 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 automates patient communication for medical clinics using the WhatsApp Business API. It supports appointment booking, rescheduling, service inquiries, follow-ups, and document submission

Google Sheets, Data Table, Data Table Tool +12
AI & RAG

Overview

Agent, OpenAI Chat, HTTP Request +7
AI & RAG

Supercharge your trading decisions with this end-to-end AI automation that connects market intelligence, technical analysis, and automated trade execution — all without manual intervention.

Tool Think, Supabase Vector Store, OpenAI Embeddings +14
AI & RAG

WooriFisa. Uses agent, httpRequest, documentDefaultDataLoader, vectorStorePinecone. Scheduled trigger; 86 nodes.

Agent, HTTP Request, Document Default Data Loader +14
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