Quick Start
Install the plugin:corsair.ts
Authentication
Supported Auth Types
The Discord plugin supports:api_key(default) - Use a Discord bot token
Default Auth Type
If noauthType is specified, the plugin defaults to api_key.
Configuring API Key Authentication
Store credentials with the CLI:corsair.ts
Options
The Discord plugin accepts the following configuration options:| Option | Type | Description |
|---|---|---|
authType | 'api_key' | Authentication method (defaults to 'api_key') |
key | string | Bot token (optional, uses database if not provided) |
publicKey | string | Ed25519 public key for webhook signature verification |
hooks | object | Endpoint hooks for custom logic |
webhookHooks | object | Webhook hooks for event handling |
errorHandlers | object | Custom error handlers |
permissions | object | Permission configuration for AI agent access |
Hooks
Error Handling
The plugin includes built-in error handlers for common scenarios. For complete documentation, see the Error Handlers reference.Usage
Accessing the API
Webhooks
Discord sends interaction events (slash commands, buttons, modals) to your webhook URL:app/api/webhook/route.ts
https://your-domain.com/api/webhook.
See Webhooks for all available events.
Database Access
Multi-Tenancy
Examples
Example 1: Respond to a Slash Command
corsair.ts
inngest/functions.ts
Example 2: Create a Thread on Important Messages
corsair.ts
inngest/functions.ts
Example 3: Post a Message with Reactions
inngest/functions.ts