AutomationMart
Home/Browse/AI-powered chatbot workflow with MySQL database integration
n8n

AI-powered chatbot workflow with MySQL database integration

n8nn8n7 modulesv1.0
agentchatTriggerlmChatGroqmemoryBufferWindowmySqlTool

AI-Powered Chatbot Workflow with MySQL Integration This guide shows you how to deploy a chatbot that lets you query your database using natural language. You will build a system that accepts chat messages, retains conversation history, constructs dynamic SQL queries, and returns responses generated by an AI model. By following these instructions, you will have a working solution that integrates n8n’s AI Agent capabilities with MySQL. --- Prerequisites Before you begin, ensure that you have the f

At a glance

AI-powered chatbot workflow with MySQL database integration is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects agent, chatTrigger, lmChatGroq, memoryBufferWindow. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
agent, chatTrigger, lmChatGroq, memoryBufferWindow, mySqlTool
Modules
7
Price
Free
Version
v1.0
AI-powered chatbot workflow with MySQL database integration workflow diagram

About this workflow

AI-Powered Chatbot Workflow with MySQL Integration This guide shows you how to deploy a chatbot that lets you query your database using natural language. You will build a system that accepts chat messages, retains conversation history, constructs dynamic SQL queries, and returns responses generated by an AI model. By following these instructions, you will have a working solution that integrates n8n’s AI Agent capabilities with MySQL. --- Prerequisites Before you begin, ensure that you have the following: 1. An active n8n instance (self-hosted or cloud) running version 1.50.0 or later. 2. Valid MySQL credentials configured in n8n. 3. API credentials for the Groq Chat Model (or your preferred AI language model). 4. Basic familiarity with SQL and n8n node concepts such as chat triggers and memory buffers. 5. Access to the n8n Docs on AI Agents for further reference. --- Workflow Setup 1. Chat Interface & Trigger - When Chat Message Received This node listens for incoming chat messages via a webhook. When a message arrives, it triggers the workflow immediately. 2. Conversation Memory - Chat History This memory buffer node stores the last 10 interactions. It supplies conversation context to the AI Agent, ensuring that responses consider previous messages. 3. AI Agent Core - AI Agent (Tools Agent) The AI Agent node orchestrates the conversation by receiving the chat input and conversation history. It dynamically generates SQL queries based on your requests and coordinates calls to external tools (such as MySQL nodes). 4. Database Interactions - MySQL Node This node executes the SQL query generated by the AI Agent. You reference the query using an expression (e.g., {{$node["AI Agent"].json.sqlquery}}), allowing the agent’s output to control data retrieval. - MySQL Schema Node This node retrieves a list of base tables from your MySQL database (excluding system schemas). The agent uses this information to understand the available tables. - MySQL Definition Node This node fetches detailed metadata (such as column names, data types, and relationships) for a specific table. The table and schema names are supplied dynamically by the AI Agent. 5. Language Model Processing - Groq Chat Model This node connects to the Groq Chat API to generate text completions. It processes the combined input (chat message, context, and data fetched from MySQL) and produces the final response. 6. Guidance & Customization - Sticky Notes These nodes provide guidance on: - Switching the chat model if you wish to use another provider (e.g., OpenAI or Anthropic). - Adjusting the maximum token count per interaction. - Customizing the SQL queries and the context window size. They help you modify the workflow to suit your environment and requirements. Workflow Connections - The Chat Trigger passes the incoming message to the AI Agent. - The Chat History node supplies conversation context to the AI Agent. - The AI Agent calls the MySQL nodes as external tools, generating and sending dynamic SQL queries. - The Groq Chat Model processes the consolidated input from the agent and outputs the natural language response delivered to the user. Testing the Workflow 1. Send a chat message using the chat interface. 2. Observe how the AI Agent processes the input and generates a corresponding SQL query. 3. Verify that the MySQL nodes execute the query and return data. 4. Confirm that the Groq Chat Model produces a coherent natural language response. 5. Refer to the sticky notes for guidance if you need to fine-tune any node settings. --- Next Steps and References - Customize Your AI Model Replace the Groq Chat Model with another language model (such as the OpenAI Chat Model) by updating the node credentials and configuration. - Enhance Memory Settings Adjust the Chat History node’s context window to retain more or fewer messages based on your needs. - Modify SQL Queries Update the SQL queries in the MySQL nodes to match your specific database schema and desired data. - Further Reading Consult the n8n Docs on AI Agents for additional details and examples to expand your workflow’s capabilities. - Set Up a Website Chatbot Copy & Paste and replace the placeholders in the following code to embed the chatbot into your personal or company's website: View in CodePen 🡥 --- By following these steps, you will deploy a robust AI chatbot workflow that integrates with your MySQL database, allowing you to query data using natural language.

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 5

    Click Execute Workflow to test, then activate.

Setup guide

Setup guide included

Purchase to unlock the full step-by-step guide

Related N8n workflows

Smart email assistant: automate customer support with AI & Supabase

Intelligent Email Support System with Vector Database Overview This n8n workflow automates email support using AI and vector database technology to provide smart, context-aware responses. It seamlessly integrates email automation and document management, ensuring efficient customer support. 📌 System Components ✉️ Email Support System 1. Email Monitoring & Classification - Gmail trigger node monitoring inbox - AI-powered email classification - Intelligent routing (support vs non-support inquir

Free

Convert meeting recordings to notes & action items with AssemblyAI, GPT-4 & Sheets

This workflow automates the process of turning meeting recordings into structured notes and actionable tasks using AssemblyAI and Google Sheets. It is ideal for teams who want to save time on manual note-taking and ensure that action items from meetings are never missed. What it does - Receives a meeting recording (audio file) via webhook - Transcribes the audio using AssemblyAI - Uses AI to generate structured meeting notes and extract action items (tasks) - Logs meeting details and action

Free

Automate IT support: Convert emails to Jira tickets with AI resolution

SmartSupport Flow: Auto-Handle IT Requests from Email to JIRA with Slack notification Watch the demo video below: []( Who’s it for > This workflow is built for lean IT teams, office managers, and business operators who receive support requests via email and want to automate ticket creation, smart AI resolution advice, and seamless communication with both users and internal teams, all without lifting a finger. If your team is tired of manually triaging inbox requests, this AI-powered flow wil

Free

Generate AI viral videos with Seedance and upload to TikTok, YouTube & Instagram

Generate AI videos with Seedance & Blotato, upload to TikTok, YouTube & Instagram Who is this for? This template is ideal for creators, content marketers, social media managers, and AI enthusiasts who want to automate the production of short-form, visually captivating videos for platforms like TikTok, YouTube Shorts, and Instagram Reels — all without manual editing or publishing. What problem is this workflow solving?

Free

Create viral ads with AI: NanoBanana & publish on socials via upload-post

Create viral Ads with NanoBanana & Seedance, publish on socials via upload-post Who is this for? This workflow is designed for marketers, content creators, and small businesses who want to automate the creation of engaging social media ads without spending hours on manual design, video editing, or publishing. --- What problem is this workflow solving? / Use case Manually creating ads for multiple platforms

Free

Notion AI summary & tags

What This Workflow Does: This n8n workflow automatically generates an AI-powered summary and relevant tags whenever a new row is added to your Notion database. Simply save any URL to your Notion database using the [Notion Web Clipper] Chrome extension or [Save to Notion]—on both desktop and mobile. This keeps all your saved content organized in one place instead of scattered across different platforms. How it works: 1. The workflow is triggered when a new row is added to your Notion database (

Free

Generate captions from autocomplete ideas using Dumpling AI + GPT-4o

Who is this for? This workflow is perfect for social media managers, content creators, digital marketers, and copywriters who want to save time and stay relevant by automatically generating fresh caption ideas based on trending search behavior. --- 💡 What problem is this workflow solving? Manually coming up with engaging social media content is time-consuming and often hit-or-miss. This workflow leverages Google autocomplete to identify what users are searching for, then uses AI to convert those

Free

Transform old photos into animated videos with FLUX & Kling AI for social media

This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Description See the transformation in action! Here's an example of what this workflow can achieve: This automation template is designed for content creators, social media managers, and anyone looking to breathe new life into old family photos and historical images. It transforms any old black and white or

Free

Reviews

No reviews yet

Be the first to buy and share your experience.

Leave a review

Sign in to share your experience with this workflow.

Log in to review
Free
No ratings yet

Create a free account to purchase workflows.

  • JSON blueprint — instant download
  • Setup guide PDF included
  • 5 downloads · valid 30 days
  • Works with n8n

Need help setting this up?

Book a 3-hour live setup session with an Agility consultant.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free