AutomationFlowsAI & RAG › AI Chat with Database

AI Chat with Database

Original n8n title: Chat with a Database Using AI

Chat With A Database Using Ai. Uses lmChatOpenAi, agent, chatTrigger, stickyNote. Chat trigger; 5 nodes.

Chat trigger trigger★★☆☆☆ complexityAI-powered5 nodesOpenAI ChatAgentChat Trigger
AI & RAG Trigger: Chat trigger Nodes: 5 Complexity: ★★☆☆☆ AI nodes: yes Added:

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 →

Download .json
{
  "nodes": [
    {
      "id": "d277b81b-05fd-4733-807a-f63eb6e87742",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        960,
        500
      ],
      "parameters": {
        "model": "gpt-4",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c56b3269-32b0-4782-ad50-74af8ee2d8a7",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        960,
        320
      ],
      "parameters": {
        "agent": "sqlAgent",
        "input": "={{ $json.chatInput }}",
        "options": {},
        "dataSource": "postgres"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8781c9fd-f6de-4a85-b05d-8f55647304f7",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        740,
        320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3c485755-0594-4a5a-b38c-440694668181",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        480
      ],
      "parameters": {
        "content": "## Try me out\nClick the 'chat' button at the bottom of the canvas and paste in:\n\n_Which tables are available?_"
      },
      "typeVersion": 1
    },
    {
      "id": "8f296643-7375-4974-be5d-9a4223d11e5f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 297,
        "height": 205,
        "content": "This workflow uses a Postgres DB, but you could swap it for a MySQL or SQLite one"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Chat With A Database Using Ai. Uses lmChatOpenAi, agent, chatTrigger, stickyNote. Chat trigger; 5 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

AI Agent : Google calendar assistant using OpenAI. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, googleCalendarTool. Chat trigger; 13 nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +2
AI & RAG

OpenSea AI-Powered Insights via Telegram. Uses chatTrigger, telegramTrigger, lmChatOpenAi, memoryBufferWindow. Chat trigger; 13 nodes.

Chat Trigger, Telegram Trigger, OpenAI Chat +4
AI & RAG

Build an MCP server with Airtable. Uses chatTrigger, agent, memoryBufferWindow, mcpClientTool. Chat trigger; 13 nodes.

Chat Trigger, Agent, Memory Buffer Window +4
AI & RAG

Build an MCP server with Airtable. Uses chatTrigger, agent, memoryBufferWindow, mcpClientTool. Chat trigger; 13 nodes.

Chat Trigger, Agent, Memory Buffer Window +4
AI & RAG

This template is a simple AI Agent that acts as a Google Calendar Assistant. It is designed for beginners to have their "first AI Agent" performing common tasks and to help them understand how it work

Chat Trigger, OpenAI Chat, Memory Buffer Window +2