Discord
Source: https://docs.datzi.ai/channels/discordDiscord (Bot API)
Status: ready for DMs and guild channels via the official Discord gateway.Pairing
Discord DMs default to pairing mode.
Slash commands
Native command behavior and command catalog.
Channel troubleshooting
Cross-channel diagnostics and repair flow.
Quick setup
You will need to create a new application with a bot, add the bot to your server, and pair it to Datzi. We recommend adding your bot to your own private server. If you don’t have one yet, create one first (choose Create My Own > For me and my friends).Create a Discord application and bot
Go to the Discord Developer Portal and click New Application. Name it something like “Datzi”.Click Bot on the sidebar. Set the Username to whatever you call your Datzi agent.
Enable privileged intents
Still on the Bot page, scroll down to Privileged Gateway Intents and enable:
- Message Content Intent (required)
- Server Members Intent (recommended; required for role allowlists and name-to-ID matching)
- Presence Intent (optional; only needed for presence updates)
Copy your bot token
Scroll back up on the Bot page and click Reset Token.Copy the token and save it somewhere. This is your Bot Token and you will need it shortly.
Generate an invite URL and add the bot to your server
Click OAuth2 on the sidebar. You’ll generate an invite URL with the right permissions to add the bot to your server.Scroll down to OAuth2 URL Generator and enable:
botapplications.commands
- View Channels
- Send Messages
- Read Message History
- Embed Links
- Attach Files
- Add Reactions (optional)
Enable Developer Mode and collect your IDs
Back in the Discord app, you need to enable Developer Mode so you can copy internal IDs.
- Click User Settings (gear icon next to your avatar) -> Advanced -> toggle on Developer Mode
- Right-click your server icon in the sidebar -> Copy Server ID
- Right-click your own avatar -> Copy User ID
Allow DMs from server members
For pairing to work, Discord needs to allow your bot to DM you. Right-click your server icon -> Privacy Settings -> toggle on Direct Messages.
Step 0: Set your bot token securely (do not send it in chat)
Your Discord bot token is a secret (like a password). Set it on the machine running Datzi before messaging your agent.If Datzi is already running as a background service, use
datzi gateway restart instead.Configure Datzi and pair
- Ask your agent
- CLI / config
Chat with your Datzi agent on any existing channel (e.g. Telegram) and tell it. If Discord is your first channel, use the CLI / config tab instead.
“I already set my Discord bot token in config. Please finish Discord setup with User ID<user_id>and Server ID<server_id>.”
Approve first DM pairing
Wait until the gateway is running, then DM your bot in Discord. It will respond with a pairing code.Pairing codes expire after 1 hour.You should now be able to chat with your agent in Discord via DM.
- Ask your agent
- CLI
Send the pairing code to your agent on your existing channel:
“Approve this Discord pairing code: <CODE>”
Recommended: Set up a guild workspace
Once DMs are working, you can set up your Discord server as a full workspace where each channel gets its own agent session with its own context.Add your server to the guild allowlist
- Ask your agent
- Config
“Add my Discord Server ID <server_id> to the guild allowlist”
Runtime model
- Gateway owns the Discord connection.
- Reply routing is deterministic: Discord inbound replies back to Discord.
- By default (
session.dmScope=main), direct chats share the agent main session (agent:main:main). - Guild channels are isolated session keys (
agent:<agentId>:discord:channel:<channelId>). - Group DMs are ignored by default (
channels.discord.dm.groupEnabled=false). - Native slash commands run in isolated command sessions (
agent:<agentId>:discord:slash:<userId>), while still carryingCommandTargetSessionKeyto the routed conversation session.
Forum channels
Discord forum and media channels only accept thread posts. Datzi supports two ways to create them:- Send a message to the forum parent (
channel:<forumId>) to auto-create a thread. - Use
datzi message thread createto create a thread directly.
Interactive components
Datzi supports Discord components v2 containers for agent messages. Use the message tool with acomponents payload.
Supported blocks:
text,section,separator,actions,media-gallery,file- Action rows allow up to 5 buttons or a single select menu
- Select types:
string,user,role,mentionable,channel
components.reusable=true to allow buttons, selects, and forms to be used
multiple times until they expire.
To restrict who can click a button, set allowedUsers on that button (Discord user IDs, tags, or *).
Example:
Access control and routing
channels.discord.dmPolicy controls DM access:
pairing(default)allowlistopen(requireschannels.discord.allowFromto include"*")disabled
channels.discord.groupPolicy:
openallowlistdisabled
channels.discord exists is allowlist.
Example guild allowlist:
Role-based agent routing
Usebindings[].match.roles to route Discord guild members to different agents by role ID:
Native commands and command auth
commands.nativedefaults to"auto"and is enabled for Discord.- Per-channel override:
channels.discord.commands.native. commands.native=falseexplicitly clears previously registered Discord native commands.- Native command auth uses the same Discord allowlists/policies as normal message handling.
Voice channels
Datzi can join Discord voice channels for realtime, continuous conversations. Requirements:- Enable native commands (
commands.nativeorchannels.discord.commands.native). - Configure
channels.discord.voice. - The bot needs Connect + Speak permissions in the target voice channel.
/vc join|leave|status to control sessions.
Auto-join example:
Voice messages
Discord voice messages show a waveform preview and require OGG/Opus audio plus metadata. Datzi generates the waveform automatically, but it needsffmpeg and ffprobe available on the gateway host.
Requirements and constraints:
- Provide a local file path (URLs are rejected).
- Omit text content (Discord does not allow text + voice message in the same payload).
- Any audio format is accepted; Datzi converts to OGG/Opus when needed.
Tools and action gates
Default gate behavior:| Action group | Default |
|---|---|
| reactions, messages, threads, pins, polls, search, memberInfo, roleInfo, channelInfo, channels, voiceStatus, events, stickers, emojiUploads, stickerUploads, permissions | enabled |
| roles | disabled |
| moderation | disabled |
| presence | disabled |
Troubleshooting
datzi doctor+datzi channels status --probefor most issues.- Enable Message Content Intent and Server Members Intent in the bot settings.
- Verify
groupPolicyand guild allowlist if guild messages are blocked. - Check
requireMentionis configured underchannels.discord.guilds, not at the top level.
