integrations/messaging/discord/dist¶
Classes¶
DiscordGatewayService¶
Constructors¶
Constructor¶
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordGatewayServiceOptions |
Returns¶
Methods¶
continueConversation()¶
Parameters¶
| Parameter | Type |
|---|---|
conversationId |
string |
options? |
ContinueConversationInDiscordOptions |
Returns¶
Promise\<ContinueConversationInDiscordResult>
start()¶
Returns¶
Promise\<void>
status()¶
Returns¶
stop()¶
Returns¶
Promise\<void>
DiscordSqliteStore¶
Implements¶
Constructors¶
Constructor¶
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordSqliteStoreOptions |
Returns¶
Methods¶
close()¶
Returns¶
void
Implementation of¶
deactivateBinding()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<void>
Implementation of¶
DiscordGatewayStore.deactivateBinding
getBindingByThreadId()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<DiscordThreadBinding>
Implementation of¶
DiscordGatewayStore.getBindingByThreadId
getLastMirroredOffset()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<number>
Implementation of¶
DiscordGatewayStore.getLastMirroredOffset
hasMirroredEvent()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
runtimeEventId |
string |
Returns¶
Promise\<boolean>
Implementation of¶
DiscordGatewayStore.hasMirroredEvent
initialize()¶
Returns¶
Promise\<void>
Implementation of¶
DiscordGatewayStore.initialize
listActiveBindings()¶
Returns¶
Promise\<DiscordThreadBinding[]>
Implementation of¶
DiscordGatewayStore.listActiveBindings
listActiveBindingsForConversation()¶
Parameters¶
| Parameter | Type |
|---|---|
conversationId |
string |
Returns¶
Promise\<DiscordThreadBinding[]>
Implementation of¶
DiscordGatewayStore.listActiveBindingsForConversation
recordMirroredEvent()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
RecordMirroredEventInput |
Returns¶
Promise\<void>
Implementation of¶
DiscordGatewayStore.recordMirroredEvent
upsertBinding()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
{ active?: boolean; conversationId: string; discordThreadId: string; discordVoiceChannelId?: string; discordVoiceChannelName?: string; guildId: string; parentChannelId: string; starterUserId?: string; threadName?: string; } |
input.active? |
boolean |
input.conversationId |
string |
input.discordThreadId |
string |
input.discordVoiceChannelId? |
string |
input.discordVoiceChannelName? |
string |
input.guildId |
string |
input.parentChannelId |
string |
input.starterUserId? |
string |
input.threadName? |
string |
Returns¶
Promise\<DiscordThreadBinding>
Implementation of¶
DiscordGatewayStore.upsertBinding
Interfaces¶
ContinueConversationInDiscordOptions¶
Properties¶
voice?¶
ContinueConversationInDiscordResult¶
Properties¶
conversationId¶
discordThreadId¶
discordThreadUrl¶
discordVoiceChannelId?¶
discordVoiceChannelUrl?¶
enabled¶
ready¶
DiscordAllowedMentions¶
Properties¶
parse?¶
replied_user?¶
roles?¶
users?¶
DiscordApplicationResource¶
Indexable¶
Properties¶
bot_public?¶
bot_require_code_grant?¶
description?¶
id?¶
name?¶
verify_key?¶
DiscordChannelResource¶
Indexable¶
Properties¶
guild_id?¶
id?¶
message?¶
name?¶
parent_id?¶
thread_metadata?¶
topic?¶
type?¶
DiscordCreateForumPostInput¶
Extends¶
Properties¶
additionalFields?¶
Inherited from¶
DiscordMessageInput.additionalFields
allowedMentions?¶
Inherited from¶
DiscordMessageInput.allowedMentions
appliedTags?¶
attachments?¶
Inherited from¶
DiscordMessageInput.attachments
autoArchiveDuration?¶
channelId¶
components?¶
Inherited from¶
DiscordMessageInput.components
content?¶
Inherited from¶
embeds?¶
Inherited from¶
flags?¶
Inherited from¶
messageReference?¶
Inherited from¶
DiscordMessageInput.messageReference
name¶
rateLimitPerUser?¶
reason?¶
stickerIds?¶
Inherited from¶
DiscordMessageInput.stickerIds
tts?¶
Inherited from¶
DiscordCreateThreadInput¶
Properties¶
autoArchiveDuration?¶
channelId¶
invitable?¶
name¶
rateLimitPerUser?¶
reason?¶
type?¶
DiscordCredentialStatusInput¶
Properties¶
applicationId?¶
botInstalled?¶
botToken?¶
channelId?¶
channelPermissionGranted?¶
expiresAt?¶
guildId?¶
publicKey?¶
requiredScopes?¶
scopes?¶
webhookUrl?¶
DiscordExecuteWebhookInput¶
Extends¶
Properties¶
additionalFields?¶
Inherited from¶
DiscordMessageInput.additionalFields
allowedMentions?¶
Inherited from¶
DiscordMessageInput.allowedMentions
attachments?¶
Inherited from¶
DiscordMessageInput.attachments
components?¶
Inherited from¶
DiscordMessageInput.components
content?¶
Inherited from¶
embeds?¶
Inherited from¶
flags?¶
Inherited from¶
messageReference?¶
Inherited from¶
DiscordMessageInput.messageReference
stickerIds?¶
Inherited from¶
DiscordMessageInput.stickerIds
threadId?¶
tts?¶
Inherited from¶
wait?¶
webhookUrl¶
DiscordGatewayClientOptions¶
Properties¶
clientOptions?¶
DiscordGatewayServiceConfig¶
Properties¶
applicationId¶
guildId¶
mirrorPollIntervalMs¶
supportChannelId¶
threadAutoArchiveDuration¶
webAppUrl¶
DiscordGatewayServiceCopy¶
Properties¶
promptFallbackMessage?¶
Parameters¶
| Parameter | Type |
|---|---|
input |
{ conversationId: string; conversationUrl: string; } |
input.conversationId |
string |
input.conversationUrl |
string |
Returns¶
string
sourceThreadNamePrefix?¶
supportThreadNamePrefix?¶
turnFailureMessage?¶
Parameters¶
| Parameter | Type |
|---|---|
input |
{ conversationUrl: string; discordThreadId: string; } |
input.conversationUrl |
string |
input.discordThreadId |
string |
Returns¶
string
voiceChannelNamePrefix?¶
voiceHandoffMessage?¶
Parameters¶
| Parameter | Type |
|---|---|
input |
{ conversationId: string; conversationUrl: string; discordThreadId: string; discordThreadUrl: string; discordVoiceChannelId: string; discordVoiceChannelUrl: string; } |
input.conversationId |
string |
input.conversationUrl |
string |
input.discordThreadId |
string |
input.discordThreadUrl |
string |
input.discordVoiceChannelId |
string |
input.discordVoiceChannelUrl |
string |
Returns¶
string
voiceMessagePrefix?¶
webMessagePrefix?¶
DiscordGatewayServiceOptions¶
Properties¶
agentId¶
botToken¶
config¶
copy?¶
runtime¶
store¶
DiscordGatewayStatus¶
Properties¶
applicationId¶
botUser?¶
id¶
tag¶
enabled¶
guildId¶
ready¶
supportChannelId¶
DiscordGatewayStore¶
Methods¶
close()¶
Returns¶
void
deactivateBinding()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<void>
getBindingByThreadId()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<DiscordThreadBinding>
getLastMirroredOffset()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
Returns¶
Promise\<number>
hasMirroredEvent()¶
Parameters¶
| Parameter | Type |
|---|---|
discordThreadId |
string |
runtimeEventId |
string |
Returns¶
Promise\<boolean>
initialize()¶
Returns¶
Promise\<void>
listActiveBindings()¶
Returns¶
Promise\<DiscordThreadBinding[]>
listActiveBindingsForConversation()¶
Parameters¶
| Parameter | Type |
|---|---|
conversationId |
string |
Returns¶
Promise\<DiscordThreadBinding[]>
recordMirroredEvent()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
RecordMirroredEventInput |
Returns¶
Promise\<void>
upsertBinding()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
{ active?: boolean; conversationId: string; discordThreadId: string; discordVoiceChannelId?: string; discordVoiceChannelName?: string; guildId: string; parentChannelId: string; starterUserId?: string; threadName?: string; } |
input.active? |
boolean |
input.conversationId |
string |
input.discordThreadId |
string |
input.discordVoiceChannelId? |
string |
input.discordVoiceChannelName? |
string |
input.guildId |
string |
input.parentChannelId |
string |
input.starterUserId? |
string |
input.threadName? |
string |
Returns¶
Promise\<DiscordThreadBinding>
DiscordGetChannelInput¶
Properties¶
channelId¶
DiscordGetGuildInput¶
Properties¶
guildId¶
DiscordGuildResource¶
Indexable¶
Properties¶
features?¶
icon?¶
id?¶
name?¶
owner_id?¶
DiscordInteractionPayload¶
Indexable¶
Properties¶
application_id?¶
channel_id?¶
data?¶
guild_id?¶
id?¶
member?¶
message?¶
token?¶
type?¶
user?¶
DiscordListMessagesInput¶
Properties¶
after?¶
around?¶
before?¶
channelId¶
limit?¶
DiscordLiveCheckOptions¶
Extends¶
Properties¶
apiBaseUrl?¶
Inherited from¶
DiscordMessagingClientOptions.apiBaseUrl
apiVersion?¶
Inherited from¶
DiscordMessagingClientOptions.apiVersion
applicationId?¶
botToken?¶
Inherited from¶
DiscordMessagingClientOptions.botToken
channelId?¶
client?¶
optional client?: Pick<DiscordMessagingClient, "getCurrentBot" | "getCurrentApplication" | "getGuild" | "getChannel">;
guildId?¶
rest?¶
Inherited from¶
DiscordMessagingClientOptions.rest
DiscordMessageInput¶
Extended by¶
Properties¶
additionalFields?¶
allowedMentions?¶
attachments?¶
components?¶
content?¶
embeds?¶
flags?¶
messageReference?¶
stickerIds?¶
tts?¶
DiscordMessageResource¶
Indexable¶
Properties¶
attachments?¶
author?¶
channel_id?¶
components?¶
content?¶
edited_timestamp?¶
embeds?¶
flags?¶
guild_id?¶
id?¶
mention_everyone?¶
mentions?¶
thread?¶
timestamp?¶
tts?¶
DiscordMessagingClient¶
Properties¶
rest¶
Methods¶
createForumPost()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordCreateForumPostInput |
Returns¶
Promise\<DiscordChannelResource>
createGatewayClient()¶
Parameters¶
| Parameter | Type |
|---|---|
options? |
DiscordGatewayClientOptions |
Returns¶
Client
createThread()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordCreateThreadInput |
Returns¶
Promise\<DiscordChannelResource>
executeWebhook()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordExecuteWebhookInput |
Returns¶
Promise\<
| Record\<string, never>
| DiscordMessageResource>
getChannel()¶
Parameters¶
| Parameter | Type |
|---|---|
channelId |
string |
Returns¶
Promise\<DiscordChannelResource>
getCurrentApplication()¶
Returns¶
Promise\<DiscordApplicationResource>
getCurrentBot()¶
Returns¶
Promise\<DiscordUserResource>
getGuild()¶
Parameters¶
| Parameter | Type |
|---|---|
guildId |
string |
Returns¶
Promise\<DiscordGuildResource>
listChannelMessages()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordListMessagesInput |
Returns¶
Promise\<DiscordMessageResource[]>
sendChannelMessage()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordSendChannelMessageInput |
Returns¶
Promise\<DiscordMessageResource>
DiscordMessagingClientOptions¶
Extended by¶
Properties¶
apiBaseUrl?¶
apiVersion?¶
botToken?¶
rest?¶
DiscordMessagingJsonObject¶
Indexable¶
DiscordParsedInteractionRequest¶
Properties¶
contentType?¶
payload¶
rawBody¶
validSignature?¶
DiscordRestLike¶
Methods¶
get()¶
Parameters¶
| Parameter | Type |
|---|---|
route |
string |
options? |
DiscordRestOptions |
Returns¶
Promise\<unknown>
post()¶
Parameters¶
| Parameter | Type |
|---|---|
route |
string |
options? |
DiscordRestOptions |
Returns¶
Promise\<unknown>
DiscordRestOptions¶
Properties¶
auth?¶
body?¶
query?¶
reason?¶
DiscordSendChannelMessageInput¶
Extends¶
Properties¶
additionalFields?¶
Inherited from¶
DiscordMessageInput.additionalFields
allowedMentions?¶
Inherited from¶
DiscordMessageInput.allowedMentions
attachments?¶
Inherited from¶
DiscordMessageInput.attachments
channelId¶
components?¶
Inherited from¶
DiscordMessageInput.components
content?¶
Inherited from¶
embeds?¶
Inherited from¶
flags?¶
Inherited from¶
messageReference?¶
Inherited from¶
DiscordMessageInput.messageReference
stickerIds?¶
Inherited from¶
DiscordMessageInput.stickerIds
tts?¶
Inherited from¶
DiscordSqliteStoreOptions¶
Properties¶
filename¶
DiscordThreadBinding¶
Properties¶
active¶
conversationId¶
createdAt¶
discordThreadId¶
discordVoiceChannelId?¶
discordVoiceChannelName?¶
guildId¶
parentChannelId¶
starterUserId?¶
threadName?¶
updatedAt¶
DiscordUserResource¶
Indexable¶
Properties¶
avatar?¶
bot?¶
discriminator?¶
global_name?¶
id?¶
system?¶
username?¶
NormalizeDiscordChannelEventInput¶
Properties¶
interaction¶
receivedAt?¶
ParseDiscordInteractionOptions¶
Extended by¶
Properties¶
publicKey?¶
requireSignature?¶
ParseDiscordInteractionRequestInput¶
Extends¶
Properties¶
publicKey?¶
Inherited from¶
ParseDiscordInteractionOptions.publicKey
request¶
requireSignature?¶
Inherited from¶
ParseDiscordInteractionOptions.requireSignature
RecordMirroredEventInput¶
Properties¶
conversationId¶
direction¶
discordMessageId?¶
discordThreadId¶
runtimeEventId¶
runtimeEventOffset¶
ValidateDiscordInteractionSignatureInput¶
Properties¶
publicKey¶
rawBody¶
signature¶
timestamp¶
Type Aliases¶
DiscordChannelEvent¶
DiscordMessagingJsonPrimitive¶
DiscordMessagingJsonValue¶
type DiscordMessagingJsonValue =
| DiscordMessagingJsonPrimitive
| DiscordMessagingJsonObject
| readonly DiscordMessagingJsonValue[];
DiscordMessagingProviderExtensionValue¶
DiscordMessagingProviderPayload¶
DiscordMirrorDirection¶
DiscordMirrorItem¶
type DiscordMirrorItem =
| {
event: Extract<RuntimeEvent, {
type: "message.completed";
}>;
kind: "message";
origin: DiscordMirrorMessageOrigin;
role: "user" | "assistant";
text: string;
}
| {
event: Extract<RuntimeEvent, {
type: "ui.prompted";
}>;
kind: "prompt";
};
DiscordMirrorMessageOrigin¶
DiscordThreadAutoArchiveDuration¶
Variables¶
createDiscordIntegration¶
createDiscordIntegrationOperationHandlers¶
Functions¶
collectDiscordMirrorItems()¶
Parameters¶
| Parameter | Type |
|---|---|
events |
RuntimeEvent[] |
Returns¶
createDiscordGatewayService()¶
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordGatewayServiceOptions |
Returns¶
createDiscordMessagingClient()¶
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordMessagingClientOptions |
Returns¶
createDiscordMessagingIntegration()¶
function createDiscordMessagingIntegration(options): DefinedIntegration<{
capabilities: [{
audiences: ["customer-facing", "mixed"];
capability: "receive";
description: "Validates Ed25519-signed Discord outgoing-webhook interaction requests.";
exposesSensitiveData: true;
label: "Receive Discord interactions";
providerObjects: [{
kind: "discordInteraction";
label: "Discord Interaction";
}];
requiresCredential: true;
}, {
audiences: ["customer-facing", "mixed"];
capability: "send";
description: "Sends bot-token-authenticated Discord channel messages through discord.js REST.post(Routes.channelMessages).";
exposesSensitiveData: true;
label: "Send Discord channel messages";
providerObjects: [{
kind: "discordMessage";
label: "Discord Message";
}];
requiresCredential: true;
sideEffect: true;
}, {
audiences: ["customer-facing", "mixed"];
capability: "thread";
changesWorkflow: true;
description: "Creates Discord text-channel threads or forum/media channel posts selected by SDK configuration.";
exposesSensitiveData: true;
label: "Create Discord support threads";
providerObjects: [{
kind: "discordThread";
label: "Discord Thread";
}, {
kind: "discordForumPost";
label: "Discord Forum Post";
}, {
kind: "discordMediaPost";
label: "Discord Media Channel Post";
}];
requiresCredential: true;
sideEffect: true;
}];
category: "messaging";
channelAudiences: ["customer-facing", "mixed"];
coverage: {
evidence: [{
label: "discord.js package";
url: "https://www.npmjs.com/package/discord.js";
}, {
label: "Discord API reference";
url: "https://docs.discord.com/developers/reference";
}, {
label: "Discord message resource";
url: "https://docs.discord.com/developers/resources/message";
}, {
label: "Discord channel/thread endpoints";
url: "https://docs.discord.com/developers/resources/channel";
}];
notes: ["Coverage is a Cognidesk support workflow adapter backed by discord.js REST, discord.js Routes helpers, and an optional discord.js Gateway service for live support-thread handoff.", "Typed operations cover channel messages, text/forum/media-channel threads, webhook execution with strict Discord webhook URL validation, selected bot/application/guild/channel reads, channel message listing, and Ed25519 interaction signature verification.", "The runtime export includes a Discord Gateway service that creates or reuses Discord threads, ingests customer messages through messageCreate events, mirrors Cognidesk runtime messages into threads, and records idempotency state through the bundled SQLite store.", "This package intentionally removes the generated Discord HTTP API clone and does not claim full Discord platform coverage.", "Discord bot installation, Gateway intents policy, channel permissions, moderation policy, retention, deletion, command registration lifecycle, voice/media transport, broad moderation/admin APIs, and Discord Webhook Events subscriptions remain SDK-user-owned configuration or future package surfaces."];
scope: "support-workflow-subset";
};
credentialRequirements: [{
description: "Server-side Discord bot token used by discord.js REST and Routes SDK helpers for channel, guild, bot, and application calls.";
id: "discord-bot-token";
label: "Discord bot token";
metadata: {
scopeKind: "provider-oauth-scopes";
};
required: true;
scopes: ["bot", "applications.commands"];
}, {
description: "SDK-user-owned Discord application ID used to identify commands, interactions, and installation readiness.";
id: "discord-application-id";
label: "Discord application ID";
required: true;
}, {
description: "Ed25519 public key from the Discord Developer Portal for validating interaction endpoint requests.";
id: "discord-public-key";
label: "Discord interaction public key";
required: true;
}];
directions: ["receive-only", "send-only", "bidirectional"];
id: "messaging.discord";
limitations: ["Available Discord operations depend on the SDK user's Discord application, bot installation, OAuth scopes, role permissions, channel permissions, forum settings, and rate limits.", "The optional Gateway service requires Discord Gateway access with Message Content Intent enabled when message text is mirrored into Cognidesk.", "Discord Webhook Events subscriptions, slash command registration, broader REST administration, voice, and local RPC/IPC remain outside this package.", "Discord interaction endpoint requests must fail closed when signature verification is required but the public key or signature headers are missing or invalid."];
maintainers: [{
name: "Cognidesk";
type: "official";
}];
metadata: {
apiBaseUrl: "https://discord.com/api";
channelCoverage: {
botApplicationGuildChannelReads: "sdk-owned-rest-read";
channelMessages: "sdk-owned-rest-send-list";
forumPosts: "sdk-owned-rest-create";
gatewayEvents: "sdk-owned-discord-js-gateway-service";
interactionsEndpoint: "typed-verify-parse";
threads: "sdk-owned-rest-create";
voiceGatewayAndRpc: "not-covered";
webhookEventsSubscriptions: "not-covered";
webhookExecution: "sdk-owned-rest-webhook-execute";
};
defaultApiVersion: "10";
gatewayService: {
messageIngress: "discord-js-messageCreate";
runtimeMirror: "cognidesk-runtime-event-list";
sourceId: "discord-gateway";
store: "bundled-libsql-sqlite-binding-store";
};
implementation: {
operationMethodMap: {
discord.application.read: "REST.get(Routes.oauth2CurrentApplication)";
discord.bot.read: "REST.get(Routes.user)";
discord.channel-messages.list: "REST.get(Routes.channelMessages)";
discord.channel.read: "REST.get(Routes.channel)";
discord.forum-post.create: "REST.post(Routes.threads)";
discord.guild.read: "REST.get(Routes.guild)";
discord.interaction-signature.verify: "validateDiscordInteractionSignature";
discord.interaction.receive: "parseDiscordInteractionRequest";
discord.message.send: "REST.post(Routes.channelMessages)";
discord.thread.create: "REST.post(Routes.threads)";
discord.webhook.execute: "REST.post(Routes.webhook)";
};
sdkPackage: "discord.js";
sdkRuntimeSurface: "REST + Routes + Client gateway";
sdkVersionRange: "^14.26.4";
strategy: "official-sdk-support-slice";
strictExceptions: {
discord.interaction-signature.verify: "Signature verification is local Ed25519 protocol handling, not an outbound provider SDK call.";
discord.interaction.receive: "Interaction parsing and Ed25519 signature verification are local protocol handling, not outbound provider SDK calls.";
discord.webhook.execute: "Webhook URLs are validated against the configured Discord API origin, parsed into webhook id/token, dispatched through discord.js REST with auth disabled, and rejected before dispatch when the URL is not a Discord webhook execution URL.";
};
};
integrationEntryPoints: {
manifest: "@cognidesk/integration-messaging-discord/manifest";
runtime: "@cognidesk/integration-messaging-discord/runtime";
};
integrationName: "Discord Integration";
integrationPackageName: "@cognidesk/integration-messaging-discord";
interactionSignatureHeaders: readonly ["x-signature-ed25519", "x-signature-timestamp"];
providerClient: {
importPolicy: "runtime-entrypoint-only";
package: "discord.js";
versionRange: "^14.26.4";
};
};
name: "Discord Messaging Support";
operations: [{
alias: "discord.interaction.receive";
capability: "receive";
exposesSensitiveData: true;
extension: true;
inputSchemaName: "ParseDiscordInteractionRequestInput";
outputSchemaName: "DiscordParsedInteractionRequest";
providerObject: "discordInteraction";
requiresCredential: true;
}, {
alias: "discord.message.send";
capability: "send";
exposesSensitiveData: true;
extension: true;
externallyVisible: true;
inputSchemaName: "DiscordSendChannelMessageInput";
outputSchemaName: "DiscordMessageResource";
providerObject: "discordMessage";
providerOperation: "REST.post(Routes.channelMessages)";
requiresCredential: true;
sideEffect: true;
}, {
alias: "discord.thread.create";
capability: "thread";
changesWorkflow: true;
exposesSensitiveData: true;
extension: true;
inputSchemaName: "DiscordCreateThreadInput";
outputSchemaName: "DiscordChannelResource";
providerObject: "discordThread";
providerOperation: "REST.post(Routes.threads)";
requiresCredential: true;
sideEffect: true;
}];
packageName: "@cognidesk/integration-messaging-discord";
privacyNotes: ["Discord messages, user IDs, guild IDs, channel IDs, thread IDs, usernames, attachments, embeds, interaction payloads, and mirrored runtime transcripts can contain customer and moderator data.", "Discord bot tokens, public keys, application IDs, guild/channel routing, webhook URLs, consent, moderation, retention, and transcript policy stay SDK-user-owned configuration."];
provider: "discord";
trustLevel: "official";
}, unknown, {
discord.application.read: () => Promise<DiscordApplicationResource>;
discord.bot.read: () => Promise<DiscordUserResource>;
discord.channel-messages.list: (input) => Promise<DiscordMessageResource[]>;
discord.channel.read: (input) => Promise<DiscordChannelResource>;
discord.forum-post.create: (input, _context) => Promise<DiscordChannelResource>;
discord.guild.read: (input) => Promise<DiscordGuildResource>;
discord.interaction-signature.verify: (input) => Promise<boolean>;
discord.interaction.receive: (input) => Promise<DiscordParsedInteractionRequest>;
discord.message.send: (input, _context) => Promise<DiscordMessageResource>;
discord.thread.create: (input, _context) => Promise<DiscordChannelResource>;
discord.webhook.execute: (input, _context) => Promise<
| Record<string, never>
| DiscordMessageResource>;
}>;
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordMessagingIntegrationOptions |
Returns¶
DefinedIntegration\<{
capabilities: [{
audiences: ["customer-facing", "mixed"];
capability: "receive";
description: "Validates Ed25519-signed Discord outgoing-webhook interaction requests.";
exposesSensitiveData: true;
label: "Receive Discord interactions";
providerObjects: [{
kind: "discordInteraction";
label: "Discord Interaction";
}];
requiresCredential: true;
}, {
audiences: ["customer-facing", "mixed"];
capability: "send";
description: "Sends bot-token-authenticated Discord channel messages through discord.js REST.post(Routes.channelMessages).";
exposesSensitiveData: true;
label: "Send Discord channel messages";
providerObjects: [{
kind: "discordMessage";
label: "Discord Message";
}];
requiresCredential: true;
sideEffect: true;
}, {
audiences: ["customer-facing", "mixed"];
capability: "thread";
changesWorkflow: true;
description: "Creates Discord text-channel threads or forum/media channel posts selected by SDK configuration.";
exposesSensitiveData: true;
label: "Create Discord support threads";
providerObjects: [{
kind: "discordThread";
label: "Discord Thread";
}, {
kind: "discordForumPost";
label: "Discord Forum Post";
}, {
kind: "discordMediaPost";
label: "Discord Media Channel Post";
}];
requiresCredential: true;
sideEffect: true;
}];
category: "messaging";
channelAudiences: ["customer-facing", "mixed"];
coverage: {
evidence: [{
label: "discord.js package";
url: "https://www.npmjs.com/package/discord.js";
}, {
label: "Discord API reference";
url: "https://docs.discord.com/developers/reference";
}, {
label: "Discord message resource";
url: "https://docs.discord.com/developers/resources/message";
}, {
label: "Discord channel/thread endpoints";
url: "https://docs.discord.com/developers/resources/channel";
}];
notes: ["Coverage is a Cognidesk support workflow adapter backed by discord.js REST, discord.js Routes helpers, and an optional discord.js Gateway service for live support-thread handoff.", "Typed operations cover channel messages, text/forum/media-channel threads, webhook execution with strict Discord webhook URL validation, selected bot/application/guild/channel reads, channel message listing, and Ed25519 interaction signature verification.", "The runtime export includes a Discord Gateway service that creates or reuses Discord threads, ingests customer messages through messageCreate events, mirrors Cognidesk runtime messages into threads, and records idempotency state through the bundled SQLite store.", "This package intentionally removes the generated Discord HTTP API clone and does not claim full Discord platform coverage.", "Discord bot installation, Gateway intents policy, channel permissions, moderation policy, retention, deletion, command registration lifecycle, voice/media transport, broad moderation/admin APIs, and Discord Webhook Events subscriptions remain SDK-user-owned configuration or future package surfaces."];
scope: "support-workflow-subset";
};
credentialRequirements: [{
description: "Server-side Discord bot token used by discord.js REST and Routes SDK helpers for channel, guild, bot, and application calls.";
id: "discord-bot-token";
label: "Discord bot token";
metadata: {
scopeKind: "provider-oauth-scopes";
};
required: true;
scopes: ["bot", "applications.commands"];
}, {
description: "SDK-user-owned Discord application ID used to identify commands, interactions, and installation readiness.";
id: "discord-application-id";
label: "Discord application ID";
required: true;
}, {
description: "Ed25519 public key from the Discord Developer Portal for validating interaction endpoint requests.";
id: "discord-public-key";
label: "Discord interaction public key";
required: true;
}];
directions: ["receive-only", "send-only", "bidirectional"];
id: "messaging.discord";
limitations: ["Available Discord operations depend on the SDK user's Discord application, bot installation, OAuth scopes, role permissions, channel permissions, forum settings, and rate limits.", "The optional Gateway service requires Discord Gateway access with Message Content Intent enabled when message text is mirrored into Cognidesk.", "Discord Webhook Events subscriptions, slash command registration, broader REST administration, voice, and local RPC/IPC remain outside this package.", "Discord interaction endpoint requests must fail closed when signature verification is required but the public key or signature headers are missing or invalid."];
maintainers: [{
name: "Cognidesk";
type: "official";
}];
metadata: {
apiBaseUrl: "https://discord.com/api";
channelCoverage: {
botApplicationGuildChannelReads: "sdk-owned-rest-read";
channelMessages: "sdk-owned-rest-send-list";
forumPosts: "sdk-owned-rest-create";
gatewayEvents: "sdk-owned-discord-js-gateway-service";
interactionsEndpoint: "typed-verify-parse";
threads: "sdk-owned-rest-create";
voiceGatewayAndRpc: "not-covered";
webhookEventsSubscriptions: "not-covered";
webhookExecution: "sdk-owned-rest-webhook-execute";
};
defaultApiVersion: "10";
gatewayService: {
messageIngress: "discord-js-messageCreate";
runtimeMirror: "cognidesk-runtime-event-list";
sourceId: "discord-gateway";
store: "bundled-libsql-sqlite-binding-store";
};
implementation: {
operationMethodMap: {
discord.application.read: "REST.get(Routes.oauth2CurrentApplication)";
discord.bot.read: "REST.get(Routes.user)";
discord.channel-messages.list: "REST.get(Routes.channelMessages)";
discord.channel.read: "REST.get(Routes.channel)";
discord.forum-post.create: "REST.post(Routes.threads)";
discord.guild.read: "REST.get(Routes.guild)";
discord.interaction-signature.verify: "validateDiscordInteractionSignature";
discord.interaction.receive: "parseDiscordInteractionRequest";
discord.message.send: "REST.post(Routes.channelMessages)";
discord.thread.create: "REST.post(Routes.threads)";
discord.webhook.execute: "REST.post(Routes.webhook)";
};
sdkPackage: "discord.js";
sdkRuntimeSurface: "REST + Routes + Client gateway";
sdkVersionRange: "^14.26.4";
strategy: "official-sdk-support-slice";
strictExceptions: {
discord.interaction-signature.verify: "Signature verification is local Ed25519 protocol handling, not an outbound provider SDK call.";
discord.interaction.receive: "Interaction parsing and Ed25519 signature verification are local protocol handling, not outbound provider SDK calls.";
discord.webhook.execute: "Webhook URLs are validated against the configured Discord API origin, parsed into webhook id/token, dispatched through discord.js REST with auth disabled, and rejected before dispatch when the URL is not a Discord webhook execution URL.";
};
};
integrationEntryPoints: {
manifest: "@cognidesk/integration-messaging-discord/manifest";
runtime: "@cognidesk/integration-messaging-discord/runtime";
};
integrationName: "Discord Integration";
integrationPackageName: "@cognidesk/integration-messaging-discord";
interactionSignatureHeaders: readonly ["x-signature-ed25519", "x-signature-timestamp"];
providerClient: {
importPolicy: "runtime-entrypoint-only";
package: "discord.js";
versionRange: "^14.26.4";
};
};
name: "Discord Messaging Support";
operations: [{
alias: "discord.interaction.receive";
capability: "receive";
exposesSensitiveData: true;
extension: true;
inputSchemaName: "ParseDiscordInteractionRequestInput";
outputSchemaName: "DiscordParsedInteractionRequest";
providerObject: "discordInteraction";
requiresCredential: true;
}, {
alias: "discord.message.send";
capability: "send";
exposesSensitiveData: true;
extension: true;
externallyVisible: true;
inputSchemaName: "DiscordSendChannelMessageInput";
outputSchemaName: "DiscordMessageResource";
providerObject: "discordMessage";
providerOperation: "REST.post(Routes.channelMessages)";
requiresCredential: true;
sideEffect: true;
}, {
alias: "discord.thread.create";
capability: "thread";
changesWorkflow: true;
exposesSensitiveData: true;
extension: true;
inputSchemaName: "DiscordCreateThreadInput";
outputSchemaName: "DiscordChannelResource";
providerObject: "discordThread";
providerOperation: "REST.post(Routes.threads)";
requiresCredential: true;
sideEffect: true;
}];
packageName: "@cognidesk/integration-messaging-discord";
privacyNotes: ["Discord messages, user IDs, guild IDs, channel IDs, thread IDs, usernames, attachments, embeds, interaction payloads, and mirrored runtime transcripts can contain customer and moderator data.", "Discord bot tokens, public keys, application IDs, guild/channel routing, webhook URLs, consent, moderation, retention, and transcript policy stay SDK-user-owned configuration."];
provider: "discord";
trustLevel: "official";
}, unknown, {
discord.application.read: () => Promise\<DiscordApplicationResource>;
discord.bot.read: () => Promise\<DiscordUserResource>;
discord.channel-messages.list: (input) => Promise\<DiscordMessageResource[]>;
discord.channel.read: (input) => Promise\<DiscordChannelResource>;
discord.forum-post.create: (input, _context) => Promise\<DiscordChannelResource>;
discord.guild.read: (input) => Promise\<DiscordGuildResource>;
discord.interaction-signature.verify: (input) => Promise\<boolean>;
discord.interaction.receive: (input) => Promise\<DiscordParsedInteractionRequest>;
discord.message.send: (input, _context) => Promise\<DiscordMessageResource>;
discord.thread.create: (input, _context) => Promise\<DiscordChannelResource>;
discord.webhook.execute: (input, _context) => Promise\<
| Record\<string, never>
| DiscordMessageResource>;
}>
createDiscordMessagingLiveChecks()¶
function createDiscordMessagingLiveChecks(options): (
| {
description: string;
id: string;
requiredCredentialIds: string[];
run: Promise<{
details: {
bot: boolean;
id: string;
username: string;
};
}>;
}
| {
description: string;
id: string;
requiredCredentialIds: string[];
run: Promise<{
details: {
id: string;
name: string;
};
}>;
})[];
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordLiveCheckOptions |
Returns¶
(
| {
description: string;
id: string;
requiredCredentialIds: string[];
run: Promise\<{
details: {
bot: boolean;
id: string;
username: string;
};
}>;
}
| {
description: string;
id: string;
requiredCredentialIds: string[];
run: Promise\<{
details: {
id: string;
name: string;
};
}>;
})[]
createDiscordMessagingOperationHandlers()¶
function createDiscordMessagingOperationHandlers(options): {
discord.application.read: () => Promise<DiscordApplicationResource>;
discord.bot.read: () => Promise<DiscordUserResource>;
discord.channel-messages.list: (input) => Promise<DiscordMessageResource[]>;
discord.channel.read: (input) => Promise<DiscordChannelResource>;
discord.forum-post.create: (input, _context) => Promise<DiscordChannelResource>;
discord.guild.read: (input) => Promise<DiscordGuildResource>;
discord.interaction-signature.verify: (input) => Promise<boolean>;
discord.interaction.receive: (input) => Promise<DiscordParsedInteractionRequest>;
discord.message.send: (input, _context) => Promise<DiscordMessageResource>;
discord.thread.create: (input, _context) => Promise<DiscordChannelResource>;
discord.webhook.execute: (input, _context) => Promise<
| Record<string, never>
| DiscordMessageResource>;
};
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordMessagingIntegrationOptions |
Returns¶
{
discord.application.read: () => Promise<DiscordApplicationResource>;
discord.bot.read: () => Promise<DiscordUserResource>;
discord.channel-messages.list: (input) => Promise<DiscordMessageResource[]>;
discord.channel.read: (input) => Promise<DiscordChannelResource>;
discord.forum-post.create: (input, _context) => Promise<DiscordChannelResource>;
discord.guild.read: (input) => Promise<DiscordGuildResource>;
discord.interaction-signature.verify: (input) => Promise<boolean>;
discord.interaction.receive: (input) => Promise<DiscordParsedInteractionRequest>;
discord.message.send: (input, _context) => Promise<DiscordMessageResource>;
discord.thread.create: (input, _context) => Promise<DiscordChannelResource>;
discord.webhook.execute: (input, _context) => Promise<
| Record<string, never>
| DiscordMessageResource>;
}
| Name | Type |
|---|---|
discord.application.read() |
() => Promise\<DiscordApplicationResource> |
discord.bot.read() |
() => Promise\<DiscordUserResource> |
discord.channel-messages.list() |
(input) => Promise\<DiscordMessageResource[]> |
discord.channel.read() |
(input) => Promise\<DiscordChannelResource> |
discord.forum-post.create() |
(input, _context) => Promise\<DiscordChannelResource> |
discord.guild.read() |
(input) => Promise\<DiscordGuildResource> |
discord.interaction-signature.verify() |
(input) => Promise\<boolean> |
discord.interaction.receive() |
(input) => Promise\<DiscordParsedInteractionRequest> |
discord.message.send() |
(input, _context) => Promise\<DiscordMessageResource> |
discord.thread.create() |
(input, _context) => Promise\<DiscordChannelResource> |
discord.webhook.execute() |
(input, _context) => Promise\< | Record\<string, never> | DiscordMessageResource> |
createDiscordSqliteStore()¶
Parameters¶
| Parameter | Type |
|---|---|
options |
DiscordSqliteStoreOptions |
Returns¶
discordInteractionPongResponse()¶
Returns¶
| Name | Type |
|---|---|
type |
number |
discordMessageBody()¶
function discordMessageBody(input): {
allowed_mentions: DiscordAllowedMentions;
attachments: DiscordMessagingJsonValue[];
components: DiscordMessagingJsonValue[];
content: string;
embeds: DiscordMessagingJsonValue[];
flags: number;
message_reference: DiscordMessagingJsonObject;
sticker_ids: string[];
tts: boolean;
};
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordMessageInput |
Returns¶
{
allowed_mentions: DiscordAllowedMentions;
attachments: DiscordMessagingJsonValue[];
components: DiscordMessagingJsonValue[];
content: string;
embeds: DiscordMessagingJsonValue[];
flags: number;
message_reference: DiscordMessagingJsonObject;
sticker_ids: string[];
tts: boolean;
}
| Name | Type |
|---|---|
allowed_mentions |
DiscordAllowedMentions |
attachments |
DiscordMessagingJsonValue[] |
components |
DiscordMessagingJsonValue[] |
content |
string |
embeds |
DiscordMessagingJsonValue[] |
flags |
number |
message_reference |
DiscordMessagingJsonObject |
sticker_ids |
string[] |
tts |
boolean |
discordMessagingCredentialStatuses()¶
function discordMessagingCredentialStatuses(input): {
expiresAt?: string;
message?: string;
providerPackageId?: string;
requirementId: string;
scopes?: string[];
state: | "required"
| "configured"
| "permission-blocked"
| "not-required"
| "missing"
| "expired"
| "insufficient-scope"
| "unavailable";
}[];
Parameters¶
| Parameter | Type |
|---|---|
input |
DiscordCredentialStatusInput |
Returns¶
{
expiresAt?: string;
message?: string;
providerPackageId?: string;
requirementId: string;
scopes?: string[];
state: | "required"
| "configured"
| "permission-blocked"
| "not-required"
| "missing"
| "expired"
| "insufficient-scope"
| "unavailable";
}[]
discordThreadUrl()¶
Parameters¶
| Parameter | Type |
|---|---|
guildId |
string |
threadId |
string |
Returns¶
string
discordWebhookUrl()¶
Parameters¶
| Parameter | Type |
|---|---|
webhookUrl |
string |
apiBaseUrl |
string |
Returns¶
URL
normalizeDiscordInteractionChannelEvent()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
NormalizeDiscordChannelEventInput |
Returns¶
parseDiscordInteractionRequest()¶
function parseDiscordInteractionRequest(request, options?): Promise<DiscordParsedInteractionRequest>;
Parameters¶
| Parameter | Type |
|---|---|
request |
Request |
options? |
ParseDiscordInteractionOptions |
Returns¶
Promise\<DiscordParsedInteractionRequest>
validateDiscordInteractionSignature()¶
Parameters¶
| Parameter | Type |
|---|---|
input |
ValidateDiscordInteractionSignatureInput |
Returns¶
boolean
References¶
discordIntegrationManifest¶
Renames and re-exports discordMessagingProviderManifest
discordMessagingManifestInput¶
Re-exports discordMessagingManifestInput
discordMessagingOperationAliases¶
Re-exports discordMessagingOperationAliases
discordMessagingProviderManifest¶
Re-exports discordMessagingProviderManifest