This workflow corresponds to n8n.io template #6706 — 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 →
{
"id": "tOuJ5G8V3Gn5K8S3",
"name": "Peliqan AI Agent with RAG and Text to SQL on all business data",
"tags": [],
"nodes": [
{
"id": "cc63f8f0-11d3-4f4b-aabb-13d2e0259137",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
560,
60
],
"parameters": {
"public": true,
"options": {}
},
"typeVersion": 1.1
},
{
"id": "98843dd9-5249-4312-b9fb-bf0ebcaddd23",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
760,
60
],
"parameters": {
"options": {
"systemMessage": "You are an assistant answering questions on internal business data.\n\nYou can use the Vector Store to find info, which contains all pages of Notion (intranet) with internal knowledge.\n\nYou can also run SQL queries for quantitive questions on tables. To execute an SQL query: send the query to Peliqan tool \"Execute SQL\" in a key SQL_Query__View_. Get the results from key \"detail\".\n\nThis is the data model of tables & columns that can be used in SQL queries:\n\nColumns in table chargebee.customers:\n\ncustomer_id\ncustomer_first_name\ncustomer_last_name\ncustomer_email\ncustomer_phone\n\nColumns in table chargebee.credit_notes:\n\ncredit_note_id\ncredit_note_customer_id\ncredit_note_subscription_id\ncredit_note_reference_invoice_id\ncredit_note_type\n\nColumns in table chargebee.invoices:\n\ninvoice_id\ninvoice_customer_id\ninvoice_subscription_id\n\n(etc. truncated)"
}
},
"typeVersion": 1.6,
"alwaysOutputData": true
},
{
"id": "b11813b4-255b-4fe3-ab4e-a8cc89cc3c47",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
660,
360
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "7ddae437-a9d2-48b0-971a-ef04e524719d",
"name": "Embeddings OpenAI for RAG retrieval",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1460,
340
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b8103994-de99-41ed-ae9f-194c4c27c3ac",
"name": "Default Data Loader",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1240,
880
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "source_url",
"value": "={{ $json._source_url }}"
},
{
"name": "title",
"value": "={{ $json.title }}"
}
]
}
},
"jsonData": "=# {{ $json.title + '\\n' + $json.content }}",
"jsonMode": "expressionData"
},
"typeVersion": 1
},
{
"id": "ffdcccfa-38bf-4a44-b023-5e5f6894b6c9",
"name": "Recursive Character Text Splitter",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1340,
1040
],
"parameters": {
"options": {},
"chunkSize": 500,
"chunkOverlap": 100
},
"typeVersion": 1
},
{
"id": "027cd3b8-ac8c-4823-bec4-88f3283032aa",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 4,
"width": 466,
"height": 568,
"content": "## \u2139\ufe0f Introduction\n\nEnd-to-end demo of a chatbot using business data from multiple sources (e.g. Notion, Chargebee, Hubspot etc.) with RAG + SQL.\n\nPeliqan.io is used as a \"cache\" of all business data. Peliqan uses one-click ELT to sync all your business data to its built-in data warehouse, allowing for fast & accurate RAG and \"Text to SQL\" queries.\n\n## \u2699\ufe0f Setup\n\n* Sign up for a free trial on peliqan.io.\n* Add one or more sources in Peliqan (e.g. Hubspot, Pipedrive...)\n* Copy your Peliqan API key under settings and use it here to add a Peliqan connection\n* Run the \"RAG\" workflow to feed Supabase, change the name of the table in the Peliqan node \"Get table data\".\n* Update the list of tables & columns that can be used for SQL in the System Message of the AI Agent.\n\nVisit peliqan.io/n8n for more information."
},
"typeVersion": 1
},
{
"id": "16a0b8cb-5951-471f-9e52-b64f3402b93f",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1160,
480
],
"parameters": {
"color": 2,
"width": 471,
"height": 80,
"content": "\u26a0\ufe0f To use the Peliqan as tool with Operation \"Execute SQL query\":\nset the below env variable. Run on command line:\n`export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=True`"
},
"typeVersion": 1
},
{
"id": "4de2cc17-0ab2-4151-8ca0-4599bff5f277",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
840,
360
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "d03704ed-4de6-4a4d-b610-ae67e9a49f35",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
660,
680
],
"parameters": {},
"typeVersion": 1
},
{
"id": "110a543f-df76-439b-901f-79e95a1df5eb",
"name": "Supabase Vector Store to store vectors for RAG",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
1060,
680
],
"parameters": {
"mode": "insert",
"options": {},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "a7c489b9-a8d5-4935-a9c6-c4ae688f965f",
"name": "Get table data",
"type": "n8n-nodes-peliqan.peliqan",
"position": [
860,
680
],
"parameters": {
"tableId": "200653"
},
"credentials": {
"peliqanApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "8016626a-ec2b-4f38-b992-54b5ebce288e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1140,
0
],
"parameters": {
"width": 512,
"height": 576,
"content": "## Tools for AI Agent: SQL & RAG"
},
"typeVersion": 1
},
{
"id": "246046cd-c673-44b2-ae62-214a6c930c27",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
500,
0
],
"parameters": {
"color": 3,
"width": 608,
"height": 576,
"content": "## AI Chatbot"
},
"typeVersion": 1
},
{
"id": "bad3518b-e305-4353-99c8-803d8dfd6a7c",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
620,
280
],
"parameters": {
"color": 6,
"width": 384,
"height": 224,
"content": "## Brain"
},
"typeVersion": 1
},
{
"id": "75bece3d-9d7d-40dc-9aab-7c3ef05e072a",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
500,
620
],
"parameters": {
"color": 5,
"width": 1152,
"height": 564,
"content": "## Feed data into Vector Store (for RAG)"
},
"typeVersion": 1
},
{
"id": "e6333a44-3c13-4932-a70e-edce7145746d",
"name": "Execute an SQL query via Peliqan",
"type": "n8n-nodes-peliqan.peliqanTool",
"position": [
1200,
220
],
"parameters": {
"querySql": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('SQL_Query', ``, 'string') }}",
"resource": "query",
"operation": "exec",
"connection": "1163"
},
"credentials": {
"peliqanApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "d9fd10f5-3395-4139-859d-a79cbdecdbad",
"name": "Supabase Vector Store for search",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
1340,
220
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {},
"toolName": "Company_knowledge_base",
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
},
"toolDescription": "Use this to find internal knowledge from e.g. Notion"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "f07d0cf9-4c45-4129-971a-6619355668e9",
"name": "Embeddings OpenAI for RAG",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1100,
880
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "8555c957-842d-42d4-9840-c5edc3892dba",
"connections": {
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Get table data": {
"main": [
[
{
"node": "Supabase Vector Store to store vectors for RAG",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Supabase Vector Store to store vectors for RAG",
"type": "ai_document",
"index": 0
}
]
]
},
"Embeddings OpenAI for RAG": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store to store vectors for RAG",
"type": "ai_embedding",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Execute an SQL query via Peliqan": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Supabase Vector Store for search": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Embeddings OpenAI for RAG retrieval": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store for search",
"type": "ai_embedding",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Get table data",
"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.
openAiApipeliqanApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template is an end-to-end demo of a chatbot using business data from multiple sources (e.g. Notion, Chargebee, Hubspot etc.) with RAG + SQL.
Source: https://n8n.io/workflows/6706/ — 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.
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
• Create a Google Drive folder to watch. • Connect your Google Drive account in n8n and authorize access. • Point the Google Drive Trigger node to this folder (new/modified files trigger the flow).
The workflow operates through a three-step process that handles incoming chat messages with intelligent tool orchestration: Message Trigger: The node triggers whenever a user message arrives and passe
Build an All-Source Knowledge Assistant with Claude, RAG, Perplexity, and Drive. Uses chatTrigger, memoryPostgresChat, embeddingsOpenAi, rerankerCohere. Chat trigger; 40 nodes.
Advanced Ai Demo Presented At Ai Developers 14 Meetup. Uses slack, stickyNote, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Chat trigger; 39 nodes.