Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cowagent.ai/llms.txt

Use this file to discover all available pages before exploring further.

Integrate CowAgent into Discord via a Discord Bot using the Gateway (persistent WebSocket). Supports direct messages (DM) and server channels (triggered by @mention or replying to the bot). The Gateway uses a persistent WebSocket connection — no public IP or callback URL required, works out of the box.

1. Setup

Step 1: Create a Discord Application and Bot

  1. Open the Discord Developer Portal, click New Application, enter a name (e.g. CowAgent), and create it.
  2. Go to the Bot page in the left sidebar, click Reset Token to generate a Bot Token, then copy and store it safely (shown only once).
This token is your bot’s password — keep it secret. If it leaks, click Reset Token again on the Bot page to regenerate it.

Step 2: Enable the Message Content Intent

Reading message text in both DMs and channels depends on this privileged intent.
  1. On the Bot page, find Privileged Gateway Intents.
  2. Turn on Message Content Intent and save.
Without this intent enabled, incoming message content will be empty and the bot will not respond.

Step 3: Invite the Bot to a Server

  1. Go to OAuth2 → URL Generator in the left sidebar.
  2. Under Scopes, check bot.
  3. Under Bot Permissions, check at least: Send Messages, Read Message History, Attach Files, View Channels.
  4. Copy the generated authorization URL at the bottom, open it in a browser, and authorize it for your target server.
You can skip this step if you only need DMs, but you still need a DM channel with the bot (e.g. the user messages the bot directly).

Step 4: Connect to CowAgent

The integration is ready when you see logs like:
[Discord] Bot logged in as CowAgent#1234 (id=123456789)
[Discord] ✅ Discord bot ready, listening for messages

2. Capabilities

FeatureSupport
Direct message (DM)
Server channel (@bot / reply to bot)
Text messages✅ send / receive
Image messages✅ send / receive
File messages✅ send / receive (PDF / Word / Excel, etc.)
A single Discord message is capped at 2000 characters; long replies are automatically split across multiple messages by line breaks.

3. Usage

Once connected:
  • Direct message (DM): find your bot in the server member list, click its avatar, and message it directly.
  • Channel: in a channel where the bot is invited, trigger it with @your-bot hello or by replying to one of the bot’s messages.
When sending an image or file, you can add a text caption (description / question) in the attachment input — the bot will answer based on both. Sending an attachment first and then a follow-up question also works; the two messages are merged automatically.