Discord
Connect Sophon to Discord as a bot.
Sophon connects to Discord using the official Bot API. You'll create an application in the Discord Developer Portal, add a bot, and invite it to your server.
Prerequisites
- A Discord account
- A Discord server where you have Manage Server permission
Step-by-Step Setup
1. Create a Discord Application
- Go to the Discord Developer Portal
- Click New Application
- Name it (e.g., "Sophon") and click Create
2. Create a Bot User
- In your application, go to Bot in the left sidebar
- Click Reset Token and copy the token — you won't see it again
- Under Privileged Gateway Intents, enable:
- Message Content Intent (required to read message text)
- Server Members Intent (optional, for member info)
3. Generate an Invite URL
- Go to OAuth2 > URL Generator
- Under Scopes, select
bot - Under Bot Permissions, select:
- Send Messages
- Read Message History
- Attach Files
- Embed Links
- Add Reactions
- Use Slash Commands (optional)
- Copy the generated URL and open it in your browser
- Select your server and click Authorize
4. Configure in Sophon Dashboard
- Go to Channels and click Add Channel
- Select Discord
- Paste the bot token
- Click Test Connection
- Click Activate
5. Test It
Mention the bot or send a DM in Discord. Sophon should respond.
Configuration Reference
| Field | Type | Required | Description |
|---|---|---|---|
botToken | secret | Yes | Bot token from Developer Portal > Bot > Reset Token |
channels.json Example
{
"id": "discord-bot",
"type": "discord",
"name": "Sophon Discord Bot",
"enabled": true,
"config": {
"botToken": "<encrypted>"
},
"routing": {
"agentId": "default",
"dmBehavior": "main-session",
"groupBehavior": "mention-only"
},
"status": "connected"
}Permissions
The minimum required permissions for Sophon to function:
| Permission | Purpose |
|---|---|
| Send Messages | Reply to users |
| Read Message History | Read conversation context |
| Attach Files | Send file attachments |
| Embed Links | Format rich responses |
| Add Reactions | React to messages |
Troubleshooting
- "Used disallowed intents" — You forgot to enable Message Content Intent in the Developer Portal under Bot > Privileged Gateway Intents. Enable it and restart the channel.
- Bot is online but doesn't respond — Make sure the bot has Send Messages and Read Message History permissions in the channel. Check the channel's permission overwrites.
- Bot doesn't see messages in a channel — The bot needs access to the channel. Check that the bot's role has the View Channel permission for the target channel.
- "Token is invalid" — Bot tokens can only be viewed once after reset. Go to Developer Portal > Bot > Reset Token to generate a new one.
- Rate limited — Discord enforces rate limits. If the bot sends too many messages, responses may be delayed. Adjust
rateLimits.maxMessagesPerMinutein the channel config.
Group behavior
In servers, Sophon responds according to the channel's group policy (mention-only by default on Pro/Enterprise; Personal-tier instances respond to all group messages — see Group Chats). Discord supports all four mention triggers: explicit @mentions, replies to the bot, quotes of the bot's messages, and participation in threads the bot is already part of.
When a user replies to an earlier message, Discord delivers the referenced message in the event itself, so Sophon captures the quoted author and text as agent context with no extra API call.
Each Discord thread — including forum posts — gets its own isolated session, a child of the channel's session with separate history and context, expired automatically after a period of inactivity.
See Group Chats for policies and allowlists, and Threads & Sessions for thread session lifecycle and configuration.