Chat with a database using AI
n8n template #2090Summary
Use templateThis workflow allows you to ask questions about data stored in a database using AI. To use it, you'll need an OpenAI API key (although you could also swap in a model from another service). Supported databases: Postgres MySQL SQLite The workflow uses n8n's embedded chat, but you could also modify it to work with a chat service such as Slack, MS Teams or WhatsApp. Note that to use this template, you need to be on n8n version 1.19.4 or later.
How to set it up
- Open template #2090 on n8n.io and click Use for free, or copy the template JSON and paste it onto an empty canvas in n8n.
- Create a credential under Credentials → Add credential: OpenAI Chat Model. Then open each of those nodes and pick the credential.
- Check the model in the AI Agent node. The template may point at a model your account can't use; swap it for one you have access to.
- Click Execute workflow and step through each node's output to confirm the data looks right.
- Toggle the workflow to Active so its trigger runs on its own.
Hand off to your agent
Prompt
Help me set up the n8n workflow "Chat with a database using AI" (https://n8n.io/workflows/2090). It uses: AI Agent, OpenAI Chat Model. Import the template JSON into my n8n instance, list every credential I need to create, and walk me through testing it.
Paste into Claude Code and it will do the rest.
Apps and nodes
Questions
Yes. David Roberts published it free on n8n.io as a verified creator, and it has 28K views. It runs on n8n Cloud or a self-hosted n8n instance.
OpenAI Chat Model. The other 1 node are built into n8n.
Similar workflows
NameViews
- AI agent chat780K
- Building Your First WhatsApp Chatbot332K
- Angie, personal AI assistant with Telegram voice and text326K
- Generate AI Viral Videos with Seedance and Upload to TikTok, YouTube & Instagram215K
- AI agent that can scrape webpages212K
- ✨🤖Automate Multi-Platform Social Media Content Creation with AI205K
- Build Your First AI Data Analyst Chatbot134K
- Create a Branded AI-Powered Website Chatbot88K