Discord
Connect Discord text channels and forum channels to AnswerLoops for automatic AI deflection and ticket tracking.
Overview
AnswerLoops integrates with Discord at two levels:
- Text channels — every message in a watched channel is ingested as a ticket. The bot replies in-thread when AI confidence is above your threshold.
- Forum channels — new forum posts create tickets via the
ThreadCreateevent. The initial post is ingested as the ticket body. Replies inside the forum thread also ingest viaMessageCreateand are attached to the same ticket.
Both channel types appear in the unified ticket list with a Discord source badge.
Cloud setup (recommended)
No Discord Developer Portal access required. AnswerLoops manages the bot and OAuth app on your behalf.
- In the onboarding wizard (or Settings → Channels → Discord), click "Add AnswerLoops to Discord"
- Select the server you want to connect in the Discord authorization screen
- Approve the requested permissions and click Authorize
- Back in AnswerLoops, a channel picker appears showing all text channels and forum channels on your server
- Select the channels where the bot should listen and click Save
The bot joins your server immediately. No token to copy, no manifest to upload.
You can return to Settings → Channels → Discord at any time to add or remove channels without re-authorizing.
Connecting multiple servers
You're not limited to one Discord server. Click "Add AnswerLoops to Discord" again from Settings → Channels → Discord to connect another — each server gets its own card with its own channel picker and its own escalation role, and can be removed independently without affecting the others. A server can only be connected to one AnswerLoops account at a time; if you try to connect a server that's already linked elsewhere, you'll see an error instead of it silently switching ownership.
Self-hosted setup
For self-hosted deployments you need to create your own Discord application and configure three environment variables.
1. Create a Discord application
- Go to discord.com/developers/applications and click New Application
- Under Bot, click Add Bot and copy the Bot Token → this is
DISCORD_TOKEN - Under OAuth2 → General, copy the Client ID →
DISCORD_CLIENT_ID - Copy the Client Secret →
DISCORD_CLIENT_SECRET - Add your callback URL to OAuth2 → Redirects:
{AUTH_URL}/api/discord/callback
2. Set required permissions
Under Bot → Privileged Gateway Intents, enable:
- Message Content Intent
- Server Members Intent (required for user lookups)
Under OAuth2 → URL Generator, select scopes: bot, applications.commands. Select bot permissions: Read Messages/View Channels, Send Messages, Create Public Threads, Read Message History.
3. Configure environment variables
Set these on your app service (not only on the bot service — the app service needs DISCORD_TOKEN for the channel picker to work):
| Variable | Description |
|---|---|
DISCORD_TOKEN | Bot token from the Discord Developer Portal |
DISCORD_CLIENT_ID | Application (client) ID |
DISCORD_CLIENT_SECRET | OAuth2 client secret |
DISCORD_APPLICATION_ID | Same as DISCORD_CLIENT_ID — required for slash commands |
BOT_TARGET_URL | Internal URL the bot uses to reach the app API (no trailing slash) |
4. Register the OAuth callback
Make sure AUTH_URL is set to your public app URL (e.g. https://support.yourcompany.com). Discord will redirect to {AUTH_URL}/api/discord/callback after authorization.
Forum channels
Forum channels work without any extra configuration beyond selecting the channel in the channel picker.
When a user creates a new post in a forum channel:
- AnswerLoops receives a
ThreadCreateevent - The post's initial message is ingested as a new ticket
- The bot replies in the thread if AI confidence is above threshold
When anyone replies inside that forum thread:
- AnswerLoops receives
MessageCreateevents for each reply - Replies are attached to the original ticket for full context
Forum channel replies by AnswerLoops appear inside the thread, not as top-level posts — keeping conversations organized for your community members.
Slash commands
AnswerLoops supports two slash commands in connected servers:
| Command | What it does |
|---|---|
/ask <question> | Queries the KB and returns an AI answer inline (visible only to the user who ran it) |
/summarize | Summarizes the current thread or recent channel activity |
Slash commands require DISCORD_APPLICATION_ID to be set. After setting it, register the commands by running:
pnpm run discord:register-commandsEnvironment variables reference
| Variable | Required | Description |
|---|---|---|
DISCORD_TOKEN | Yes (self-host) | Bot token — set on both app and bot services |
DISCORD_CLIENT_ID | Yes (self-host) | OAuth2 client ID |
DISCORD_CLIENT_SECRET | Yes (self-host) | OAuth2 client secret |
DISCORD_APPLICATION_ID | For slash commands | Usually the same value as DISCORD_CLIENT_ID |
BOT_TARGET_URL | Yes (self-host) | URL the bot uses to call the app API — no trailing slash |