Skip to main content
The Discord channel connects over the Gateway WebSocket, with the bot sending and receiving messages on a long connection. The Discord channel currently supports:
  • Interactive button approval: when an agent calls a tool that needs approval, it asks for confirmation as buttons; click to allow or deny;
  • Multimodal input: receive image and file attachments from users and pass them to the agent;
  • Markdown: replies render as Markdown, capped at 2000 characters per message, with longer content split automatically.
Connecting takes three steps: create an application and bot on the Discord Developer Portal and get the token, start an agent service to host the channel, then add the Discord channel in the management UI.

Prerequisites

The Discord channel depends on discord.py, installed with the channel extra:
Install the dependency

Create the bot

Create and configure the bot on the Discord Developer Portal.
1

Create an application

Click “New Application” to create an app, and record the Application ID on the “General Information” page.
2

Add a bot and get the token

Go to the “Bot” page, add a bot, and click “Reset Token” to generate and copy the Bot Token. The token is a secret and is shown only once; keep it safe.
3

Enable Message Content Intent

On the “Bot” page, under “Privileged Gateway Intents”, enable MESSAGE CONTENT INTENT. This is required to read message text; without it, you won’t receive message content.
4

Invite the bot to a server

Under “OAuth2 → URL Generator”, select the bot scope, then the permissions you need (at least “Send Messages” and “Read Message History”), and use the generated link to invite the bot to your server.

Start the agent service

A channel runs on top of an agent service. Start the service with create_app and declare the accepted channel types via channels. Channels depend on a message bus (message_bus); use InMemoryMessageBus for single-machine development, and switch to RedisMessageBus for multi-process or multi-node deployment.
Start an agent service that hosts the channel

Add the channel

In the management UI (see the sample frontend examples/web_ui), add a channel through a visual form, with no config to write by hand.
1

Create a channel and pick Discord

On the channel management page, create a channel and choose “Discord” as the platform type.
2

Fill in the credentials

Enter the Application ID and Bot Token from the previous step into the credential form.
3

Configure routing rules

Choose which agent handles messages and how sessions are scoped. See Message routing for what the rules mean.
4

Save and enable

Save and enable the channel; the service connects to Discord immediately and the bot comes online. @mention it in a server channel, or DM it, to begin.
The management UI maps onto the /channels endpoints; call them directly when you need to create channels programmatically. See the API part of this chapter for the fields.

Platform config

The Discord channel has a few platform-specific switches:
When routing on chat_type, a server channel’s value is guild and a DM’s is dm.

Verify and troubleshoot

  • Check the channel status in the management UI, or call GET /channels/{id}/status to confirm the connection is established.
  • If the bot doesn’t respond in a server channel, first confirm MESSAGE CONTENT INTENT is enabled, then check only_at_reply and the @-mention behavior.
  • If the bot never comes online, check the Bot Token and that it has been invited to the server.

Further reading

Message routing

Route different server channels to different agents.

Custom channel

Connect a platform beyond the built-ins.