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.
pgvector and create the required table and function./ask-workflows:{
"query": "How does my webhook workflow work?"
}
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.
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
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]
1. Workflow Discovery
2. Debugging Assistance
3. Developer Onboarding
4. Reuse Automation Logic
5. Documentation System
| Issue | Possible Cause | Solution |
|---|---|---|
| No workflows fetched | Incorrect API URL or authentication | Verify endpoint and headers |
| Empty responses | No indexed data available | Ensure indexing process has completed successfully |
| Supabase error | Missing table or function setup | Run the required SQL setup scripts properly |
| Duplicate entries | Delete step failed or skipped | Check metadata filter logic in delete node |
| Poor answers | Weak or improper chunking strategy | Improve workflow-to-text transformation logic |
| Embedding errors | OpenAI API issue or invalid key | Check OpenAI credentials and usage limits |
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.