Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

docs: recommend Connect for Discord credentials (#1298)

Ben Pankow33a358c120ac
diff --git a/docs/channels/discord.mdx b/docs/channels/discord.mdx
index 390064d63..cbe0553d4 100644
--- a/docs/channels/discord.mdx
+++ b/docs/channels/discord.mdx
@@ -4,23 +4,54 @@ description: "Reach your agent from Discord HTTP Interactions, including slash c
type: integration
---
-The Discord channel wires your agent into Discord's HTTP Interactions, including slash and application commands, message components, and modal submissions. Discord enforces a three-second ACK deadline, so the channel verifies the Ed25519 signature headers, acknowledges the command right away, and runs the eve work in the background. See [Channels](./overview) for the contract this builds on.
+The Discord channel wires your agent into Discord's HTTP Interactions, including slash and application commands, message components, and modal submissions. Discord enforces a three-second ACK deadline, so the channel verifies inbound requests, acknowledges the command right away, and runs the eve work in the background. See [Channels](./overview) for the contract this builds on.
+
+## Set up Connect
+
+Create a Discord connector with **Bot and interactions** enabled, copy its UID (e.g. `discord/my-agent`), and attach this project as the trigger destination at eve's Discord route:
+
+```bash
+npm install -g vercel@latest
+vercel connect create discord --triggers
+vercel connect attach <uid> --triggers --trigger-path /eve/v1/discord --yes
+```
+
+You can also create the connector from the [Connect dashboard](https://vercel.com/d?to=/%5Bteam%5D/~/connect&title=Go+to+Connect). Connect stores the bot token, verifies Discord's signed interactions, and forwards them to your project with Vercel OIDC.
+
+Open the connector's **Triggers** section and copy its webhook URL (`https://connect.vercel.com/trigger/<connector-id>`). In the [Discord Developer Portal](https://discord.com/developers/applications), open your application, go to **General Information**, paste the URL into **Interactions Endpoint URL**, and save. Discord sends a signed validation request before accepting the URL.
## Add the channel
+Install the Connect SDK:
+
+```bash
+npm install @vercel/connect
+```
+
+Then create:
+
```ts title="agent/channels/discord.ts"
+import { connectDiscordCredentials } from "@vercel/connect/eve";
import { discordChannel } from "eve/channels/discord";
-export default discordChannel();
+export default discordChannel({
+ credentials: connectDiscordCredentials("discord/my-agent"),
+});
```
+`connectDiscordCredentials` supplies the application ID and bot token from Connect and verifies forwarded interactions with Vercel OIDC. The route is `POST /eve/v1/discord` by default.
+
+### Direct credentials
+
+To connect Discord without Vercel Connect, provide credentials through environment variables:
+
```bash
DISCORD_PUBLIC_KEY=... # verifies X-Signature-Ed25519 + X-Signature-Timestamp
DISCORD_APPLICATION_ID=... # edits the deferred response and sends followups
DISCORD_BOT_TOKEN=... # proactive messages + fallback + typing indicators
```
-To skip env vars, pass the same values through `credentials: { applicationId, botToken, publicKey }`. The route is `POST /eve/v1/discord` by default. Paste that public URL into your Discord application's Interactions Endpoint URL.
+Or pass the same values through `credentials: { applicationId, botToken, publicKey }`. Paste the deployed `/eve/v1/discord` URL into your Discord application's Interactions Endpoint URL.
## Register a command
@@ -74,7 +105,7 @@ HITL renders as Discord components. Confirmations and options become buttons, `d
### Proactive sessions
-Start a session without an inbound interaction through `receive(discord, { message, target, auth })` from a schedule `run` handler, or `args.receive(discord, ...)` from another channel. The proactive target shape is `{ channelId, conversationId?, initialMessage? }`. Either path needs `DISCORD_BOT_TOKEN`.
+Start a session without an inbound interaction through `receive(discord, { message, target, auth })` from a schedule `run` handler, or `args.receive(discord, ...)` from another channel. The proactive target shape is `{ channelId, conversationId?, initialMessage? }`. Either path needs a bot token, supplied by Connect or `DISCORD_BOT_TOKEN`.
### Attachments