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 →
{
"name": "Chat with docs - 5minAI New version",
"nodes": [
{
"parameters": {
"method": "POST",
"url": "=https://<project_id>.supabase.co/storage/v1/object/list/private",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "supabaseApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"prefix\": \"\",\n \"limit\": 100,\n \"offset\": 0,\n \"sortBy\": {\n \"column\": \"name\",\n \"order\": \"asc\"\n }\n}",
"options": {}
},
"id": "003915bb-a2e9-42b0-b81f-5bb5bf0c8cb4",
"name": "Get All files",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1180,
1280
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsonMode": "expressionData",
"jsonData": "={{ $('Merge Text').item.json.text }}",
"options": {
"metadata": {
"metadataValues": [
{
"name": "=file_id",
"value": "={{ $json.id }}"
}
]
}
}
},
"id": "f46e056d-8311-4951-ad38-21759fabdaf7",
"name": "Default Data Loader",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1,
"position": [
3500,
1820
]
},
{
"parameters": {
"chunkSize": 500,
"chunkOverlap": 200,
"options": {}
},
"id": "3cfdcacb-d0ef-422b-9048-a64e5f0dac66",
"name": "Recursive Character Text Splitter",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"typeVersion": 1,
"position": [
3520,
1960
]
},
{
"parameters": {
"model": "text-embedding-3-small",
"options": {}
},
"id": "3056ea0a-b788-43c7-a070-f40bd1ad3356",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1,
"position": [
3320,
1800
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"tableId": "files",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "name",
"fieldValue": "={{ $('Loop Over Items').item.json.name }}"
},
{
"fieldId": "storage_id",
"fieldValue": "={{ $('Loop Over Items').item.json.id }}"
}
]
}
},
"id": "e6ad8067-0468-440d-a322-2a3de8851431",
"name": "Create File record2",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
3260,
1620
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2",
"leftValue": "={{ \n !$('Aggregate').item.json.data || \n !Array.isArray($('Aggregate').item.json.data) || \n !$('Aggregate').item.json.data.some(item => \n item.storage_id === $('Loop Over Items').item.json.id \n ) \n}}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
},
{
"id": "c3c0af88-9aea-4539-8948-1b69e601c27c",
"leftValue": "={{ $json.name }}",
"rightValue": ".emptyFolderPlaceholder",
"operator": {
"type": "string",
"operation": "notEquals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "53ac0d69-d935-48a0-8fb8-5cc8f591dbb8",
"name": "If",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1500,
1280
]
},
{
"parameters": {
"operation": "getAll",
"tableId": "files"
},
"id": "f57e857a-094f-470c-ad27-9fc29466ab0e",
"name": "Get All Files",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
800,
1280
],
"alwaysOutputData": true,
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "=https://<project_id>.supabase.co/storage/v1/object/private/{{ $json.name }}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "supabaseApi",
"options": {}
},
"id": "4484ca47-6879-43b7-8879-261f409014e1",
"name": "Download",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1660,
1280
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"batchSize": "=1",
"options": {}
},
"id": "f81d2f91-d665-4217-8955-a308ef2b37be",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
1340,
1280
]
},
{
"parameters": {},
"id": "8857a553-37aa-4ac2-ac4d-e5402849cb2e",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
620,
1280
],
"disabled": true
},
{
"parameters": {
"aggregate": "aggregateAllItemData",
"options": {}
},
"id": "e967af7e-43bd-47cb-8b04-eb431a82c93b",
"name": "Aggregate",
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [
1000,
1280
],
"alwaysOutputData": true
},
{
"parameters": {
"options": {}
},
"id": "8abdb8f6-e31d-48cf-8189-831adf7d4889",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
1420,
300
]
},
{
"parameters": {
"mode": "insert",
"tableName": {
"__rl": true,
"value": "documents",
"mode": "list",
"cachedResultName": "documents"
},
"options": {
"queryName": "match_documents"
}
},
"id": "75cf7f9e-d8f6-4a7a-b464-d152fd025188",
"name": "Insert into Supabase Vectorstore",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1,
"position": [
3420,
1620
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "### Replace Storage name, database ID and credentials.",
"height": 89.3775420487804
},
"id": "b3ceb557-53c6-4d19-ac97-c999ba87c7f5",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1120,
1160
]
},
{
"parameters": {
"content": "### Replace credentials.",
"height": 80
},
"id": "a81fe332-86ea-46aa-b140-ee5745f0b0e0",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
760,
1160
]
},
{
"parameters": {
"content": "### Replace credentials.",
"height": 80
},
"id": "44070cd1-0f4d-48ea-8ce0-8d59f94133e7",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
3260,
1500
]
},
{
"parameters": {
"content": "### Replace Storage name, database ID and credentials.",
"height": 89.3775420487804
},
"id": "3fed931d-69de-4c1b-a951-5e49c683f551",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1620,
1160
]
},
{
"parameters": {
"content": "### Replace credentials.",
"height": 80
},
"id": "d462978c-7ea3-4b92-a940-64756377c461",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
3220,
1940
]
},
{
"parameters": {
"content": "### Replace credentials.",
"height": 80
},
"id": "6f0a219d-4258-4982-b912-784a850ef308",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
2080,
800
]
},
{
"parameters": {
"content": "\n## AI Agent To Chat With Files In Supabase Storage\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowcoding/) from community [5minAI](https://www.skool.com/5minai-2861)**\n\nManually retrieving and analyzing specific information from large document repositories is time-consuming and inefficient. This workflow automates the process by vectorizing documents and enabling AI-powered interactions, making it easy to query and retrieve context-based information from uploaded files.\n\nThe workflow integrates Supabase with an AI-powered chatbot to process, store, and query text and PDF files. The steps include:\n- Fetching and comparing files to avoid duplicate processing.\n- Handling file downloads and extracting content based on the file type.\n- Converting documents into vectorized data for contextual information retrieval.\n- Storing and querying vectorized data from a Supabase vector store.\n\n",
"height": 497.1532689930921,
"width": 636.2128494576581,
"color": 7
},
"id": "469b3caf-c9a8-4f8b-a745-c672e2b1089f",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
40
],
"typeVersion": 1
},
{
"parameters": {
"content": "## Scenario 2 - AI agent",
"height": 890,
"width": 1112,
"color": 5
},
"id": "cb6664f2-0a05-4abb-818d-d72536b57bac",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1360,
40
]
},
{
"parameters": {
"content": "## Scenario 1 - Flow for adding new files from Supabase storage",
"height": 1139,
"width": 3285,
"color": 5
},
"id": "a825794d-e7f3-41ba-a113-8503ebaf2be7",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
540,
1000
]
},
{
"parameters": {
"promptType": "define",
"text": "={{ $('Merge').item.json.message }}",
"options": {
"systemMessage": "You are a helpful assistant.\n\nIMPORTANT Always use knowledge base to respond users.",
"passthroughBinaryImages": false
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.8,
"position": [
1960,
260
],
"id": "1d44ef3b-b1d9-481c-8078-2f0d8d586247",
"name": "AI Agent1"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
1880,
480
],
"id": "d1da58a8-e6c0-4a6d-aa53-88c223a97f0a",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Merge').item.json.session_id }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
2020,
480
],
"id": "acb2de9b-a9fa-4934-9759-b84b067dc26a",
"name": "Simple Memory"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
2160,
660
],
"id": "4d91a4e9-e381-485a-847e-50b5dcc43f6b",
"name": "Embeddings OpenAI1",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolName": "knowledge_base",
"toolDescription": "Gather facts from knowledge base to respond user.",
"tableName": {
"__rl": true,
"value": "documents",
"mode": "list",
"cachedResultName": "documents"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1.1,
"position": [
2160,
500
],
"id": "19b5a9a8-7407-4a1c-822f-3000b67da99b",
"name": "Supabase Vector Store",
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"value": "1rFIHlWMlbt0vAh1CWjcmNOmJYk_8jUIb",
"mode": "list",
"cachedResultName": "Case - dentist",
"cachedResultUrl": "https://drive.google.com/drive/folders/1rFIHlWMlbt0vAh1CWjcmNOmJYk_8jUIb"
},
"event": "fileCreated",
"options": {}
},
"id": "0b48a55c-9b47-4913-9aec-264d3932c533",
"name": "File Created",
"type": "n8n-nodes-base.googleDriveTrigger",
"typeVersion": 1,
"position": [
600,
2480
],
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "={{ $('Set File ID').last().json.file_id }}",
"mode": "id"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "application/pdf",
"drawingsToFormat": "application/pdf",
"slidesToFormat": "application/pdf",
"sheetsToFormat": "application/pdf"
}
}
}
},
"id": "fd7a9260-7d85-4129-bf2d-f7700781091b",
"name": "Download File",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
1200,
2580
],
"executeOnce": true,
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"value": "1rFIHlWMlbt0vAh1CWjcmNOmJYk_8jUIb",
"mode": "list",
"cachedResultName": "Case - dentist",
"cachedResultUrl": "https://drive.google.com/drive/folders/1rFIHlWMlbt0vAh1CWjcmNOmJYk_8jUIb"
},
"event": "fileUpdated",
"options": {}
},
"id": "e17a7bc1-6483-439b-acb0-2b13f66466e5",
"name": "File Updated",
"type": "n8n-nodes-base.googleDriveTrigger",
"typeVersion": 1,
"position": [
620,
2660
],
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "delete",
"tableId": "documents",
"filterType": "string",
"filterString": "=metadata->>drive_file_id=like.*{{ $json.file_id }}*"
},
"id": "b0e5b639-cf0e-4289-8ce7-96e6fd1e831f",
"name": "Delete Old Doc Rows",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
1020,
2580
],
"alwaysOutputData": true,
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "10646eae-ae46-4327-a4dc-9987c2d76173",
"name": "file_id",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "7d0b3a5e-9dfa-46d3-bf16-f6fc1d44f242",
"name": "extension",
"value": "={{ $json.fileExtension }}",
"type": "string"
}
]
},
"options": {}
},
"id": "c583b665-b756-4b8c-8150-34f559df9007",
"name": "Set File ID",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
860,
2580
]
},
{
"parameters": {
"tableId": "files",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "name",
"fieldValue": "={{ $('Download File').item.binary.data.fileName }}"
},
{
"fieldId": "google_drive_id",
"fieldValue": "={{ $('Set File ID').item.json.file_id }}"
}
]
}
},
"id": "558473fe-cc06-41d8-ab06-cc6c03a8c40e",
"name": "Create File record1",
"type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
2380,
2780
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsonMode": "expressionData",
"jsonData": "={{ $('Set Text3').item.json.text }}",
"options": {
"metadata": {
"metadataValues": [
{
"name": "=file_id",
"value": "={{ $json.id }}"
},
{
"name": "drive_file_id",
"value": "={{ $('Set File ID').item.json.file_id }}"
}
]
}
}
},
"id": "87e490c4-f9cb-4821-a234-a9c9d2c93836",
"name": "Default Data Loader1",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1,
"position": [
2640,
2980
]
},
{
"parameters": {
"model": "text-embedding-3-small",
"options": {}
},
"id": "373efd3c-f7dd-4efc-a268-ed05d8b2e309",
"name": "Embeddings OpenAI3",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1,
"position": [
2480,
2960
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chunkSize": 500,
"chunkOverlap": 200,
"options": {}
},
"id": "17daf2dd-1d4c-498e-8404-7cc371f81894",
"name": "Recursive Character Text Splitter1",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"typeVersion": 1,
"position": [
2660,
3180
]
},
{
"parameters": {
"mode": "insert",
"tableName": {
"__rl": true,
"value": "documents",
"mode": "list",
"cachedResultName": "documents"
},
"options": {
"queryName": "match_documents"
}
},
"id": "afcfc728-9798-4703-998d-edc535eb859e",
"name": "Insert into Supabase Vectorstore1",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1,
"position": [
2580,
2780
],
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "## Scenario 3 - Flow for adding new files from Supabase storage",
"height": 1139,
"width": 2465,
"color": 5
},
"id": "78e7d15c-5797-488c-b869-bb887878e930",
"name": "Sticky Note11",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
540,
2240
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "ad3055e5-41eb-4e00-9f55-dbcde47a03c7",
"name": "session_id",
"value": "={{ $('When chat message received').item.json.sessionId }}",
"type": "string"
},
{
"id": "56126e31-5fe0-4a9c-b9c9-d62fcb8bd469",
"name": "message",
"value": "={{ $('When chat message received').item.json.chatInput }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1600,
300
],
"id": "f572511d-6374-4b0b-8907-9f6c82179feb",
"name": "Edit Fields"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "5e5fbeb0-d866-40fe-8c1b-66b946bd1cec",
"name": "session_id",
"value": "={{ $('Webhook').item.json.body.session_id }}",
"type": "string"
},
{
"id": "28ec27a5-f814-435c-a5bf-df92160eee3e",
"name": "message",
"value": "={{ $('Webhook').item.json.body.message }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1600,
140
],
"id": "be2de117-410c-49c2-b95c-45b4a0e036d6",
"name": "Edit Fields1"
},
{
"parameters": {
"method": "POST",
"url": "https://api.cloud.llamaindex.ai/api/parsing/upload",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "file",
"inputDataFieldName": "data"
},
{
"name": "do_not_cache",
"value": "=true"
}
]
},
"options": {}
},
"id": "ce8790a1-55a5-4583-8301-03bbde363ee2",
"name": "Upload File",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2040,
1280
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "=https://api.cloud.llamaindex.ai/api/parsing/job/{{ $json.id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"options": {}
},
"id": "10b8cf52-4301-40a2-a27d-9952f1d3bcda",
"name": "Get Processing Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
2240,
1280
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"amount": 7
},
"id": "c0fc7854-1d04-492d-9541-389356333efd",
"name": "Wait to stay within service limits",
"type": "n8n-nodes-base.wait",
"position": [
2660,
1040
],
"typeVersion": 1.1
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "0fa97d86-432a-409a-917e-5f1a002b1ab9",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "PENDING"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "PENDING"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "e6058aa0-a3e2-4ce3-9bed-6ff41a5be052",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "ERROR"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "ERROR"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "ceb6338f-4261-40ac-be11-91f61c7302ba",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "CANCELED"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "CANCELED"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "300fce8c-b19a-4d0c-86e8-f62853c70ce2",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "SUCCESS"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "SUCCESS"
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"id": "971b40d2-a320-4815-9ccc-27de52b58bbd",
"name": "Is Job Ready?",
"type": "n8n-nodes-base.switch",
"position": [
2420,
1280
],
"typeVersion": 3
},
{
"parameters": {
"errorMessage": "Problem with Llamaparser. Error during parsing."
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
2660,
1300
],
"id": "c8f65cc5-e67a-47ae-b43a-fc065fb4900e",
"name": "Stop and Error"
},
{
"parameters": {
"url": "=https://api.cloud.llamaindex.ai/api/parsing/job/{{ $json.id }}/result/markdown",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"redirect": {
"redirect": {}
}
}
},
"id": "90658f0a-7236-493d-8dd0-fdad64196753",
"name": "Get Parsed Data",
"type": "n8n-nodes-base.httpRequest",
"position": [
2660,
1480
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "### Add Llamaparse Header auth\nAuthorization: Bearer <api_key>",
"height": 80,
"width": 280
},
"type": "n8n-nodes-base.stickyNote",
"position": [
2060,
1460
],
"typeVersion": 1,
"id": "810aad96-7677-4c27-b3b2-25106b70083a",
"name": "Sticky Note12"
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.1,
"position": [
1800,
260
],
"id": "a0fd62b8-219e-4eb7-b274-1344b0042fac",
"name": "Merge"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "f05d708d-f36e-4c6d-8753-81a61ae42546",
"leftValue": "={{ $json.data }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1820,
1280
],
"id": "e5356266-5e4a-41a2-8151-95f994435560",
"name": "If1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "e9bbecd9-3d40-4a6a-9401-94daab15cde0",
"name": "text",
"value": "={{ $('If1').item.json.data }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2060,
1600
],
"id": "c04fa3f9-74c6-4c7c-ae2a-46a797db0e55",
"name": "Set Text"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "e9bbecd9-3d40-4a6a-9401-94daab15cde0",
"name": "text",
"value": "={{ $('Get Parsed Data').item.json.markdown }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2840,
1480
],
"id": "2f41ef18-6229-4d3c-9a3c-8b02ec3c60b2",
"name": "Set Text1"
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.1,
"position": [
3060,
1620
],
"id": "9c92b25b-7762-4465-878f-6568073ba521",
"name": "Merge Text"
},
{
"parameters": {
"method": "POST",
"url": "https://api.cloud.llamaindex.ai/api/parsing/upload",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "file",
"inputDataFieldName": "data"
},
{
"name": "do_not_cache",
"value": "=true"
}
]
},
"options": {}
},
"id": "4a523ad6-d74d-4207-8347-facc7f313fdd",
"name": "Upload File1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1380,
2580
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "=https://api.cloud.llamaindex.ai/api/parsing/job/{{ $json.id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"options": {}
},
"id": "c0a43e5e-ec2b-49f5-bbc0-cef914c68c4c",
"name": "Get Processing Status1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1580,
2580
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"amount": 7
},
"id": "68cc70a4-dba0-4ec9-8506-88bb20b37e87",
"name": "Wait to stay within service limits1",
"type": "n8n-nodes-base.wait",
"position": [
2000,
2340
],
"typeVersion": 1.1
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "0fa97d86-432a-409a-917e-5f1a002b1ab9",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "PENDING"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "PENDING"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "e6058aa0-a3e2-4ce3-9bed-6ff41a5be052",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "ERROR"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "ERROR"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "ceb6338f-4261-40ac-be11-91f61c7302ba",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "CANCELED"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "CANCELED"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "300fce8c-b19a-4d0c-86e8-f62853c70ce2",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "SUCCESS"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "SUCCESS"
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"id": "aef3b805-166e-47a8-a81c-900f999ae045",
"name": "Is Job Ready?1",
"type": "n8n-nodes-base.switch",
"position": [
1760,
2580
],
"typeVersion": 3
},
{
"parameters": {
"errorMessage": "Problem with Llamaparser. Error during parsing."
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
2000,
2600
],
"id": "5233be31-2ecf-4ddd-96e2-b0fd614f535f",
"name": "Stop and Error1"
},
{
"parameters": {
"url": "=https://api.cloud.llamaindex.ai/api/parsing/job/{{ $json.id }}/result/markdown",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"redirect": {
"redirect": {}
}
}
},
"id": "09283faa-4ab9-4d59-a610-3491d7f2daf8",
"name": "Get Parsed Data1",
"type": "n8n-nodes-base.httpRequest",
"position": [
2000,
2780
],
"typeVersion": 4.2,
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "### Add Llamaparse Header auth\nAuthorization: Bearer <api_key>",
"height": 80,
"width": 280
},
"type": "n8n-nodes-base.stickyNote",
"position": [
1400,
2760
],
"typeVersion": 1,
"id": "5ef6959d-1eb4-49cd-9b19-3b0e1aaa0eb7",
"name": "Sticky Note13"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "e9bbecd9-3d40-4a6a-9401-94daab15cde0",
"name": "text",
"value": "={{ $('Get Parsed Data1').item.json.markdown }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2180,
2780
],
"id": "18fd1d0f-664e-4584-8154-794ca8aad768",
"name": "Set Text3"
},
{
"parameters": {
"httpMethod": "POST",
"path": "05979e87-19bc-4e8b-adbb-7e04808f8b21",
"responseMode": "lastNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
1420,
140
],
"id": "337b8593-8f5a-47b2-8b75-f5b3b4195fe8",
"name": "Webhook"
},
{
"parameters": {
"content": "### Replace credentials.",
"height": 80,
"width": 480
},
"id": "7911c133-f998-4efd-a9c8-9c52c8e545c4",
"name": "Sticky Note14",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
2380,
2660
]
}
],
"connections": {
"Get All files": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_document",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Create File record2": {
"main": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Download",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Get All Files": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Download": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "Get All Files",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Get All files",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Insert into Supabase Vectorstore": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"File Created": {
"main": [
[
{
"node": "Set File ID",
"type": "main",
"index": 0
}
]
]
},
"Download File": {
"main": [
[
{
"node": "Upload File1",
"type": "main",
"index": 0
}
]
]
},
"File Updated": {
"main": [
[
{
"node": "Set File ID",
"type": "main",
"index": 0
}
]
]
},
"Delete Old Doc Rows": {
"main": [
[
{
"node": "Download File",
"type": "main",
"index": 0
}
]
]
},
"Set File ID": {
"main": [
[
{
"node": "Delete Old Doc Rows",
"type": "main",
"index": 0
}
]
]
},
"Create File record1": {
"main": [
[
{
"node": "Insert into Supabase Vectorstore1",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader1": {
"ai_document": [
[
{
"node": "Insert into Supabase Vectorstore1",
"type": "ai_document",
"index": 0
}
]
]
},
"Embeddings OpenAI3": {
"ai_embedding": [
[
{
"node": "Insert into Supabase Vectorstore1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Recursive Character Text Splitter1": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader1",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Upload File": {
"main": [
[
{
"node": "Get Processing Status",
"type": "main",
"index": 0
}
]
]
},
"Get Processing Status": {
"main": [
[
{
"node": "Is Job Ready?",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
]
]
},
"Wait to stay within service limits": {
"main": [
[
{
"node": "Get Processing Status",
"type": "main",
"index": 0
}
]
]
},
"Is Job Ready?": {
"main": [
[
{
"node": "Wait to stay within service limits",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Parsed Data",
"type": "main",
"index": 0
}
]
]
},
"Get Parsed Data": {
"main": [
[
{
"node": "Set Text1",
"type": "main",
"index": 0
}
]
]
},
"Supabase Vector Store": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Upload File",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Text",
"type": "main",
"index": 0
}
]
]
},
"Set Text": {
"main": [
[
{
"node": "Merge Text",
"type": "main",
"index": 1
}
]
]
},
"Set Text1": {
"main": [
[
{
"node": "Merge Text",
"type": "main",
"index": 0
}
]
]
},
"Merge Text": {
"main": [
[
{
"node": "Create File record2",
"type": "main",
"index": 0
}
]
]
},
"Upload File1": {
"main": [
[
{
"node": "Get Processing Status1",
"type": "main",
"index": 0
}
]
]
},
"Get Processing Status1": {
"main": [
[
{
"node": "Is Job Ready?1",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error1",
"type": "main",
"index": 0
}
]
]
},
"Wait to stay within service limits1": {
"main": [
[
{
"node": "Get Processing Status1",
"type": "main",
"index": 0
}
]
]
},
"Is Job Ready?1": {
"main": [
[
{
"node": "Wait to stay within service limits1",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error1",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error1",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Parsed Data1",
"type": "main",
"index": 0
}
]
]
},
"Get Parsed Data1": {
"main": [
[
{
"node": "Set Text3",
"type": "main",
"index": 0
}
]
]
},
"Set Text3": {
"main": [
[
{
"node": "Create File record1",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "08cc985e-953e-4e1e-ba91-d9dc7b6e981e",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "hLmhKPuWJEjRRWoW",
"tags": []
}
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.
googleDriveOAuth2ApihttpHeaderAuthopenAiApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
Easily query your documents through natural language conversations, receiving precise answers backed by your own files without sifting through pages manually. This workflow suits teams handling knowledge bases, support docs, or research materials, enabling quick insights for non-technical users. It starts by fetching files via HTTP requests, loading and splitting the content with the default data loader and recursive text splitter, then generating embeddings using OpenAI to power intelligent searches stored in Supabase.
Use this when you need an interactive chat interface for document retrieval in apps or chatbots, especially with event-driven triggers for real-time queries. Avoid it for massive document sets exceeding Supabase limits or non-text files like images, where specialised loaders are needed. Common variations include swapping OpenAI for other embedding providers or adding vector stores like Pinecone for larger scales.
About this workflow
Chat with docs - 5minAI New version. Uses httpRequest, documentDefaultDataLoader, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Event-driven trigger; 62 nodes.
Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
📌 Overview
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
Your AI workforce is ready. Are you?
This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an
Agent IA Projet Client. Uses executeWorkflowTrigger, lmChatOpenAi, toolWorkflow, vectorStoreQdrant. Event-driven trigger; 79 nodes.