Skip to main content

Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan

Workflow preview

Workflow preview
100%
Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

![Peliqan n8n chatbot with RAG and Text To SQL](https://images.spr.so/cdn cgi/imagedelivery/j42No7y dcokJuNgXeA0ig/99465134 7cb5 46cd a26c c44c11a3317e/Peliqan n8n AI Agent template with RAG and Te...

Best for

  • Internal Wiki automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.memorybufferwindow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Peliqan.

Original n8n.io source

1.1 Workflow description

Title
Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan
Workflow name
Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan

How it works

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.

Peliqan.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.

The workflow will write source data to Supabase as a vector store, for RAG searches by the chatbot. The source URL (e.g. the URL of a Notion page) is added in metadata.

The AI Agent will decide for each question to use either RAG or Text-to-SQL or a combination of both. Text-to-SQL is performed via the Peliqan node, added as a tool to the AI Agent. The question of the user in natural language is converted to an SQL query by the AI Agent. The query is executed by Peliqan.io on the source data and the result is interpreted by the AI Agent.

RAG is typically used to answer knowledge questions, often on non-structured data (Notion pages, Google Drive etc.). Text-to-SQL is typically used to answer analytical questions, for example "Show list of customers with number of open support tickets and add customer revenue based on invoiced amounts".

Preconditions

  • You signed up for a Peliqan.io free trial account
  • You have one or more data sources, e.g. a CRM, ERP, Accounting software, files, Notion, Google Drive etc.

Set up steps

  • Sign up for a free trial on peliqan.io: https://peliqan.io
  • Add one or more sources in Peliqan (e.g. Hubspot, Pipedrive...)
  • Copy your Peliqan API key under settings and use it here to add a Peliqan connection
  • Run the "RAG" workflow to feed Supabase, change the name of the table in the Peliqan node "Get table data".
  • Update the list of tables & columns that can be used for SQL in the System Message of the AI Agent.

Visit https://peliqan.io/n8n for more information.

Disclaimer: This template contains a community node and therefore only works for n8n self-hosted users.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 2 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1

Block 4 - Embeddings OpenAI for RAG retrieval

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1

Block 5 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 6 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 7 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 10 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 11 - Supabase Vector Store to store vectors for RAG

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1

Block 12 - Get table data

Type / Role
n8n-nodes-peliqan.peliqan - peliqan
Config choices
Version 1

Block 13 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Execute an SQL query via Peliqan

Type / Role
n8n-nodes-peliqan.peliqanTool - peliqanTool
Config choices
Version 1

Block 18 - Supabase Vector Store for search

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.1

Block 19 - Embeddings OpenAI for RAG

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1

3. Summary Table

Workflow Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan
Complexity advanced
Nodes 19
Categories Internal Wiki, AI Chatbot
Author Peliqan
Published 30 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6706/6706.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Query business data with OpenAI chatbot using RAG and text-to-SQL via Peliqan do?

![Peliqan n8n chatbot with RAG and Text To SQL](https://images.spr.so/cdn cgi/imagedelivery/j42No7y dcokJuNgXeA0ig/99465134 7cb5 46cd a26c c44c11a3317e/Peliqan n8n AI Agent template with RAG and Te...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI Chatbot use case.