πŸ“– Index n8n workflows and enable semantic AI search with OpenAI and Supabase

⚑ 81 views Β· πŸ“– Internal Wiki & Knowledge Base

Description

n8n Workflow Intelligence (RAG): Auto Indexing & Semantic AI Search with Supabase Vector DB

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 (RAG) to fetch relevant workflow data and generate contextual answersβ€”making it easy to understand, debug and reuse automation logic.

Quick Implementation Steps

  1. Enable n8n API and configure authentication (header-based).
  2. Set up Supabase with pgvector and create the required table and function.
  3. Add OpenAI credentials (for embeddings and chat model).
  4. Import and activate the workflow in n8n.
  5. Send a POST request to /ask-workflows:
    {
      "query": "How does my webhook workflow work?"
    }
  6. Receive AI-powered answers based on your workflows.

What It Does

This workflow creates an intelligent knowledge layer on top of your n8n automations. It automatically fetches workflows from your n8n instance, processes each node and converts them into structured text chunks. These chunks are transformed into vector embeddings using OpenAI and stored in Supabase for semantic search.

Once indexed, users can query workflows through a webhook endpoint using natural language. The AI agent retrieves relevant workflow data using vector similarity search and generates meaningful responses. It can also guide users directly to workflows using links.

In short, it transforms your workflows into a searchable, AI-powered system.

Who It’s For

Requirements

1. n8n API Access

http://YOUR_N8N_HOST:5678/api/v1/workflows

2. Supabase Setups

Enable Extension

create extension if not exists vector;

Create Table

create table if not exists documents (
  id uuid primary key default gen_random_uuid(),
  content text,
  metadata jsonb,
  embedding vector(1536)
);

Create Match Function

create or replace function match_documents (
  query_embedding vector(1536),
  match_count int,
  filter jsonb default '{}'::jsonb
)
returns table (
  id uuid,
  content text,
  metadata jsonb,
  similarity float
)
language plpgsql
as $$
begin
  return query
  select
    documents.id,
    documents.content,
    documents.metadata,
    1 - (documents.embedding <=> query_embedding) as similarity
  from documents
  where (filter = '{}'::jsonb or documents.metadata @> filter)
  order by documents.embedding <=> query_embedding
  limit match_count;
end;
$$;

3.Credentials Required

How It Works & Set Up

Step 1: Auto Sync Trigger

Step 2: Fetch Workflows

Step 3: Split Workflows

Step 4: Clear Existing Data

Step 5: Transform into Chunks

Each workflow node is converted into structured text:

Workflow: "My Workflow". Node Name: "Webhook". Type: "n8n-nodes-base.webhook". Logic: {...}

Step 6: Generate Embeddings

Step 7: Store in Supabase

Step 8: Query via Webhook

Endpoint:

/ask-workflows

Request:

{
  "query": "Find workflows using webhook"
}

Step 9: AI Agent + RAG

Step 10: Return Response

http://YOUR_N8N_HOST:5678/workflow/[ID]

How To Customize Nodes

Add-ons (Enhancements)

Use Case Examples

1. Workflow Discovery

2. Debugging Assistance

3. Developer Onboarding

4. Reuse Automation Logic

5. Documentation System

Troubleshooting Guide

IssuePossible CauseSolution
No workflows fetchedIncorrect API URL or authenticationVerify endpoint and headers
Empty responsesNo indexed data availableEnsure indexing process has completed successfully
Supabase errorMissing table or function setupRun the required SQL setup scripts properly
Duplicate entriesDelete step failed or skippedCheck metadata filter logic in delete node
Poor answersWeak or improper chunking strategyImprove workflow-to-text transformation logic
Embedding errorsOpenAI API issue or invalid keyCheck OpenAI credentials and usage limits

Need Help?

If you need help setting up or extending this workflow with

Contact our n8n workflow developers at WeblineIndia for expert support and custom development.

We can help you scale this into a production-ready AI automation platform.

πŸ”— Nodes Used

HTTP Request, Webhook, Supabase, Schedule Trigger, AI Agent, Embeddings OpenAI

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup