Discord bot
Connect a Discord bot so members can talk to a governed flow by DM or by @mentioning the bot in a server channel. Discord delivers messages to bots over its Gateway (a persistent WebSocket the gateway opens outbound), so no public URL is needed for this channel.
What you need
- A Discord account that can create an application and invite bots to the server (Manage Server permission on that server).
Official documentation
- Gateway & intents: https://docs.discord.com/developers/topics/gateway
- Message resource (Create Message, Message Content intent): https://docs.discord.com/developers/resources/message
- OAuth2 bot authorization (invite URL): https://docs.discord.com/developers/topics/oauth2
- Developer Portal: https://discord.com/developers/applications
Set up on Discord
- https://discord.com/developers/applications → New Application.
- Bot → Reset Token → copy the bot token (shown once).
- Same page → Privileged Gateway Intents → enable MESSAGE CONTENT INTENT (without it the bot receives empty text in servers). Bots in 100+ servers need Discord's verification for this intent.
- Connect in Tools Anatomy (below). The console shows the invite URL
(
https://discord.com/oauth2/authorize?client_id=<app>&scope=bot&permissions=68608= View Channels + Send Messages + Read Message History). Open it, pick the server, authorize. - Optionally restrict the bot to one server by pasting its Server ID (enable Developer Mode in Discord → right-click the server → Copy Server ID).
Connect in Tools Anatomy
/channels → Messaging channels → Discord bot → paste:
| Field | Where it comes from |
|---|---|
| Bot token | Developer Portal → Bot → Token |
| Server (guild) ID (optional) | Discord → server → Copy Server ID |
The gateway validates the token (GET /users/@me), stores the bot's id,
and starts a gateway session for the channel. Disabling the channel closes
the session.
Identity we derive
| Canonical key | Value |
|---|---|
external_user_id |
Discord user id (snowflake) |
channel |
discord |
display_name |
global_name (or username) — metadata only, runtime_only |
email, phone_number |
not provided (email needs an OAuth2 flow) |
conversation_context.channel_account_id = the server (guild) id, or dm.
Threads: one conversation per Discord channel/DM.
Limits
- Only DMs and server messages that @mention the bot are answered.
- Replies over 2000 characters are split into several messages.
- The gateway session runs in one gateway instance (single-instance assumption); it reconnects with backoff after disconnects.
- Attachments are acknowledged but not processed (text only in v1).
Test it
DM the bot (right-click → Message) or post @YourBot hello in a channel
it can see.
Troubleshooting
- Bot online but replies to nothing in servers: MESSAGE CONTENT intent is off, or the bot lacks View Channel / Send Messages in that channel.
- 401 on connect: the token was reset — paste the new one.
- Answers in the wrong server: set the Server ID filter.