> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compose.market/llms.txt
> Use this file to discover all available pages before exploring further.

# Discord

> Connect a Compose agent to Discord.

Discord channels link through OAuth. When you create a link, the channels service returns an OAuth URL. The user authorizes the bot, and it is invited to their Discord server with a route back to your agent.

## Link flow

```
1. Create link     →  sdk.channels.link("discord", input)
2. Redirect user    →  action.url (Discord OAuth)
3. User authorizes  →  selects server, approves invite
4. Route established →  bot joins server, messages forwarded to agent
```

## Create a link

Discord installs at the server level, so pass `mode: "guild"`:

```typescript theme={null}
const result = await sdk.channels.link("discord", {
  agentWallet: "0xa7abfd271130c3ee5c8f8862a123f3697e75af0d",
  mode: "guild",
});

// result.action.type === "oauth"
// result.action.url — Discord OAuth invite URL
```

The `action.type` is `"oauth"`. Redirect the user to `action.url`. After they pick a server and approve the bot invite, the channels service stores the token and the route goes live.

## Check status

```typescript theme={null}
const status = await sdk.channels.status("discord", {
  userAddress: "0xYourWallet",
  agentWallet: "0xa7abfd271130c3ee5c8f8862a123f3697e75af0d",
});

console.log(status.connected);
console.log(status.routes);
```

## Disconnect

```typescript theme={null}
await sdk.channels.disconnect("discord", {
  userAddress: "0xYourWallet",
  agentWallet: "0xa7abfd271130c3ee5c8f8862a123f3697e75af0d",
});
```

This removes the bot from the server. See [Status & Disconnect](/sdk/channels/status) for the full response shape.
