Discord AI ChatBot : Context-Aware, Replies to Mentions AND also DMs
Needs changesNeeds changes. This template uses 2 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes), HTTP Request Tool (legacy). 2 breaking item(s) found. Static check, last run 2026-10-19.
What to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent (v1.8) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
| HTTP Request Tool (legacy) Read last private messages | HTTP Request node connected to the AI Agent's Tool input |
Community nodes
These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
n8n-nodes-discord-trigger(Public Mention)
Nodes used (10)
- AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Discord
n8n-nodes-base.discord - Webhook
n8n-nodes-base.webhook - Discord Trigger
n8n-nodes-discord-trigger.discordTrigger - Discord Tool
n8n-nodes-base.discordTool - HTTP Request Tool
@n8n/n8n-nodes-langchain.toolHttpRequest
What it does
Click here to access this Workflow for free. --- Get your own custom ChatGPT inside your Discord Server !DS.png(fileId:1737) Description This n8n workflow enables a fully autonomous AI assistant within your Discord server. It listens for both public mentions and direct messages (DMs), and replies in real-time using a language model (OpenAI's GPT-4o by default). The assistant can dynamically fetch previous messages for better context, providing smart, coherent, and personalized responses. --- 🔧 Key Features - Dual Trigger: Reacts to both public bot mentions and private DMs. - Context-Aware AI: Dynamically fetches the last 30 messages from either public or private conversations. - Smart Routing: Replies either in the original public channel or via DM, depending on where the message came from. - Custom Prompting: Easily modify the system prompt to define the AI’s tone, behavior, and personality. - Fully Autonomous: No manual intervention required — the bot always replies instantly. --- ✅ Requirements - An operational n8n instance. - A Discord bot with at least these permissions: - Send Messages - Read Message History - Manage Messages - OpenAI API key (or compatible LLM credentials). - The community package: n8n-nodes-discord-trigger. --- 🧰 Setup Instructions 1. Discord Bot Setup - Create and invite your Discord bot to your server with required permissions. > You will find in the next step a complete tutorial to craft your own bot with the right code and permissions for this workflow to work - Set your Discord bot token in n8n's credential manager. 2. Install the Community Node (please read ⚠️ Disclaimer first) - Go to Settings > Community Nodes > Install - Paste: n8n-nodes-discord-trigger and install. 3. Configure the Workflow - Add your Discord bot credentials. - Update the LLM credentials with your OpenAI key or alternative. - Customize the AI agent system prompt if needed. --- 🤖 How It Works - When a public mention is detected, the bot replies directly in the channel, referencing the original message. - When a DM is received, it responds privately. - The AI uses tools to read the latest 30 public or private messages to build accurate context before replying. --- 🛠 Customization Options - Change LLM: Swap out OpenAI with any LLM that has an API. - Edit Prompt Behavior: Modify the system prompt to control tone and personality. - Adjust Trigger Filters: Choose which roles, channels, or patterns activate the flow. --- If you just need a tutorial on setting up your Discord bot, be my guest ➡️ Here --- And if you need any help, or have any question, feel free to come discuss about it on Telegram