n8n Community Node

n8n Discord AI Memory: Persistent Memory for Discord Bots

Discord bots in n8n process each message in isolation — no memory of previous conversations, no user context across sessions. retainr adds persistent memory so your Discord bot remembers every user across all servers and all time. Install the community node in 30 seconds.

Why Discord bots in n8n forget everything

Each Discord message triggers a new n8n execution. When that execution ends, all context is discarded. The next message — even from the same user in the same thread — starts from scratch. retainr bridges the gap: persist context after each response, retrieve it before the next.

Add Discord memory to n8n in 3 steps

1

Install the retainr community node

Settings → Community Nodes → Install → n8n-nodes-retainr. Create a Discord bot in the Discord Developer Portal, add it to your server, and add the bot token to n8n as a Discord credential.

2

Search memory before each AI call

Add a retainr Search Memory node after the Discord Trigger. Namespace: discord:{user_id} for per-user memory or discord:server:{guild_id} for shared server memory. Query: the incoming message content.

3

Store memory after each AI response

Add a retainr Store Memory node after your AI step. Namespace: same as above. Content: the user message and bot response. The Discord bot now remembers every user permanently across all sessions.

n8n Discord memory — frequently asked questions

How do I set up a Discord bot to use with n8n?
Go to discord.com/developers/applications, create a new application, add a Bot, copy the token, and invite the bot to your server using the OAuth2 URL generator with bot and applications.commands scopes. In n8n, add the bot token as a Discord credential and use the Discord Trigger or Webhook node to receive messages.
Should I scope memory per user or per server?
For AI assistants in DMs, scope by user ID: discord:{user_id}. For server bots where shared knowledge matters (e.g., a community Q&A bot), scope by server: discord:server:{guild_id}. For multi-server bots where user memory should be consistent across servers, use discord:{user_id} without the server ID.
How do I handle Discord slash commands with memory?
Discord slash commands send interaction payloads to a configured endpoint. Use a Webhook node in n8n to receive interactions. For a /forget slash command, call DELETE /v1/memories?namespace=discord:{user_id} via HTTP Request. Respond to the interaction within 3 seconds or Discord will show an error.
Can I give each Discord server its own isolated memory?
Yes. Use the guild_id in the namespace: discord:server:{guild_id}. Each server has completely separate memory from other servers. If you also want per-user memory within a server, use discord:{user_id}:{guild_id}.
What is the difference between using a Discord bot token and a webhook?
A bot token lets n8n listen for messages using the Discord Gateway (real-time events). A Discord webhook only lets you send messages — it cannot receive them. For a conversational AI bot that reads and responds to messages, you need a bot token and the Messages Intent enabled in the Discord Developer Portal.

Give your Discord bot real memory

1,000 memory operations per month. Free forever. No credit card required.

Start free