Plugins
Discord
Send messages and manage channels via the Discord Bot API.
Authentication
| Type | Default | Details |
|---|---|---|
bot_token | ✅ | Bot Token sent as Authorization: Bot <token> |
oauth_2 | Discord OAuth with bot scope |
The plugin defaults to Bot prefix for bot tokens. OAuth access tokens are sent as Bearer. Set tokenType explicitly to override.
Endpoints
| Path | Risk | Description |
|---|---|---|
messages.create | write | Post a message to a channel. |
messages.get | read | Get a single message. |
messages.delete | destructive | Delete a message. |
channels.get | read | Get channel metadata. |
channels.list | read | List channels in a guild. |
guilds.get | read | Get guild metadata. |
users.me | read | Get the authenticated bot user. |
messages.create
Post a message to a channel.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
channelId | string | ✅ | Channel ID |
content | string | Message text (required unless embeds) | |
embeds | array | Embed objects | |
tts | boolean | Text-to-speech | |
message_reference | object | Reply to: { message_id: string } |
Output: DiscordMessage
messages.get
Get a single message.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
channelId | string | ✅ | Channel ID |
messageId | string | ✅ | Message ID |
Output: DiscordMessage
messages.delete
Delete a message.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
channelId | string | ✅ | Channel ID |
messageId | string | ✅ | Message ID |
Output: { ok: boolean }
channels.get
Get channel metadata.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
channelId | string | ✅ | Channel ID |
Output: DiscordChannel
channels.list
List channels in a guild.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
guildId | string | ✅ | Guild ID |
Output: DiscordChannel[]
guilds.get
Get guild metadata.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
guildId | string | ✅ | Guild ID |
Output: DiscordGuild
users.me
Get the authenticated bot user.
Input: None
Output: DiscordUser
Usage
import { createFabric } from "@fabricorg/integrations";
import { discord } from "@fabricorg/integrations/plugins";
const fabric = createFabric({
plugins: [discord({ botToken: process.env.DISCORD_BOT_TOKEN })],
});
// Send a message
const msg = await fabric.discord.api.messages.create({
channelId: "1234567890123456789",
content: "Hello from Fabric!",
});
// Reply to a message
await fabric.discord.api.messages.create({
channelId: "1234567890123456789",
content: "Thanks for the update!",
message_reference: { message_id: msg.id },
});Webhooks
Discord webhooks are not yet implemented in this plugin. Slash command interactions (which require Ed25519 signature verification) are planned for a dedicated discord-interactions plugin.
Types
interface DiscordChannel {
id: string;
type: number;
name?: string;
guild_id?: string;
topic?: string | null;
parent_id?: string | null;
}
interface DiscordMessage {
id: string;
channel_id: string;
content: string;
author?: { id: string; username: string; bot?: boolean };
timestamp?: string;
}
interface DiscordUser {
id: string;
username: string;
discriminator?: string;
avatar?: string | null;
bot?: boolean;
}
interface DiscordGuild {
id: string;
name: string;
owner_id?: string;
member_count?: number;
}