Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(integrations): add Discord integration

Tin348802202b97
diff --git a/apps/api/src/discord-integration/index.ts b/apps/api/src/discord-integration/index.ts
new file mode 100644
index 000000000..e9e05357e
--- /dev/null
+++ b/apps/api/src/discord-integration/index.ts
@@ -0,0 +1,313 @@
+import { and, eq } from "drizzle-orm";
+import { Hono } from "hono";
+import { HTTPException } from "hono/http-exception";
+import { describeRoute, resolver, validator } from "hono-openapi";
+import * as v from "valibot";
+import db from "../database";
+import { integrationTable } from "../database/schema";
+import {
+ type DiscordConfig,
+ defaultDiscordEvents,
+ normalizeDiscordConfig,
+ validateDiscordConfig,
+} from "../plugins/discord/config";
+import { discordIntegrationSchema } from "../schemas";
+import { workspaceAccess } from "../utils/workspace-access-middleware";
+
+const discordIntegration = new Hono<{
+ Variables: {
+ userId: string;
+ workspaceId: string;
+ apiKey?: {
+ id: string;
+ userId: string;
+ enabled: boolean;
+ };
+ };
+}>();
+
+function maskWebhookUrl(value: string): string {
+ try {
+ const url = new URL(value);
+ const parts = url.pathname.split("/").filter(Boolean);
+ const last = parts[parts.length - 1] ?? "";
+ const maskedLast =
+ last.length > 8 ? `${last.slice(0, 4)}…${last.slice(-4)}` : "••••";
+ return `${url.origin}/${parts.slice(0, -1).join("/")}/${maskedLast}`;
+ } catch {
+ return "Configured";
+ }
+}
+
+function toResponse(integration: {
+ id: string;
+ projectId: string;
+ config: string;
+ isActive: boolean | null;
+ createdAt: Date;
+ updatedAt: Date;
+}) {
+ const config = normalizeDiscordConfig(
+ JSON.parse(integration.config) as DiscordConfig,
+ );
+
+ return {
+ id: integration.id,
+ projectId: integration.projectId,
+ channelName: config.channelName ?? null,
+ webhookConfigured: Boolean(config.webhookUrl),
+ webhookUrl: config.webhookUrl ?? "",
+ maskedWebhookUrl: maskWebhookUrl(config.webhookUrl),
+ events: {
+ ...defaultDiscordEvents,
+ ...(config.events ?? {}),
+ },
+ isActive: integration.isActive,
+ createdAt: integration.createdAt,
+ updatedAt: integration.updatedAt,
+ };
+}
+
+async function getDiscordIntegration(projectId: string) {
+ const integration = await db.query.integrationTable.findFirst({
+ where: and(
+ eq(integrationTable.projectId, projectId),
+ eq(integrationTable.type, "discord"),
+ ),
+ });
+
+ if (!integration) {
+ return null;
+ }
+
+ return toResponse(integration);
+}
+
+const discordEventsSchema = v.object({
+ taskCreated: v.optional(v.boolean()),
+ taskStatusChanged: v.optional(v.boolean()),
+ taskPriorityChanged: v.optional(v.boolean()),
+ taskTitleChanged: v.optional(v.boolean()),
+ taskDescriptionChanged: v.optional(v.boolean()),
+ taskCommentCreated: v.optional(v.boolean()),
+});
+
+discordIntegration
+ .get(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "getDiscordIntegration",
+ tags: ["Discord"],
+ description: "Get Discord integration for a project",
+ responses: {
+ 200: {
+ description: "Discord integration details",
+ content: {
+ "application/json": { schema: resolver(discordIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const integration = await getDiscordIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .post(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "createDiscordIntegration",
+ tags: ["Discord"],
+ description: "Create or replace a Discord integration for a project",
+ responses: {
+ 200: {
+ description: "Discord integration created successfully",
+ content: {
+ "application/json": { schema: resolver(discordIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ validator(
+ "json",
+ v.object({
+ webhookUrl: v.pipe(v.string(), v.minLength(1)),
+ channelName: v.optional(v.string()),
+ events: v.optional(discordEventsSchema),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const body = c.req.valid("json");
+
+ const config = normalizeDiscordConfig({
+ webhookUrl: body.webhookUrl,
+ channelName: body.channelName,
+ events: body.events,
+ });
+
+ const validation = await validateDiscordConfig(config);
+ if (!validation.valid) {
+ throw new HTTPException(400, {
+ message: validation.errors?.join(", ") ?? "Invalid config",
+ });
+ }
+
+ const existing = await db.query.integrationTable.findFirst({
+ where: and(
+ eq(integrationTable.projectId, projectId),
+ eq(integrationTable.type, "discord"),
+ ),
+ });
+
+ if (existing) {
+ await db
+ .update(integrationTable)
+ .set({
+ config: JSON.stringify(config),
+ isActive: true,
+ updatedAt: new Date(),
+ })
+ .where(eq(integrationTable.id, existing.id));
+ } else {
+ await db.insert(integrationTable).values({
+ projectId,
+ type: "discord",
+ config: JSON.stringify(config),
+ isActive: true,
+ });
+ }
+
+ const integration = await getDiscordIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .patch(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "updateDiscordIntegration",
+ tags: ["Discord"],
+ description: "Update Discord integration settings",
+ responses: {
+ 200: {
+ description: "Discord integration updated successfully",
+ content: {
+ "application/json": { schema: resolver(discordIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ validator(
+ "json",
+ v.object({
+ webhookUrl: v.optional(v.string()),
+ channelName: v.optional(v.nullable(v.string())),
+ isActive: v.optional(v.boolean()),
+ events: v.optional(discordEventsSchema),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const body = c.req.valid("json");
+
+ const existing = await db.query.integrationTable.findFirst({
+ where: and(
+ eq(integrationTable.projectId, projectId),
+ eq(integrationTable.type, "discord"),
+ ),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, {
+ message: "Discord integration not found",
+ });
+ }
+
+ const currentConfig = normalizeDiscordConfig(
+ JSON.parse(existing.config) as DiscordConfig,
+ );
+ const nextConfig = normalizeDiscordConfig({
+ webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,
+ channelName:
+ body.channelName === undefined
+ ? currentConfig.channelName
+ : (body.channelName ?? undefined),
+ events: {
+ ...(currentConfig.events ?? {}),
+ ...(body.events ?? {}),
+ },
+ });
+
+ const validation = await validateDiscordConfig(nextConfig);
+ if (!validation.valid) {
+ throw new HTTPException(400, {
+ message: validation.errors?.join(", ") ?? "Invalid config",
+ });
+ }
+
+ await db
+ .update(integrationTable)
+ .set({
+ config: JSON.stringify(nextConfig),
+ isActive:
+ body.isActive !== undefined
+ ? body.isActive
+ : (existing.isActive ?? true),
+ updatedAt: new Date(),
+ })
+ .where(eq(integrationTable.id, existing.id));
+
+ const integration = await getDiscordIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .delete(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "deleteDiscordIntegration",
+ tags: ["Discord"],
+ description: "Delete Discord integration for a project",
+ responses: {
+ 200: {
+ description: "Discord integration deleted successfully",
+ content: {
+ "application/json": {
+ schema: resolver(v.object({ success: v.boolean() })),
+ },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+
+ const existing = await db.query.integrationTable.findFirst({
+ where: and(
+ eq(integrationTable.projectId, projectId),
+ eq(integrationTable.type, "discord"),
+ ),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, {
+ message: "Discord integration not found",
+ });
+ }
+
+ await db
+ .delete(integrationTable)
+ .where(eq(integrationTable.id, existing.id));
+ return c.json({ success: true });
+ },
+ );
+
+export default discordIntegration;
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index daf8eef4c..40cc89cdb 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -18,6 +18,7 @@ import column from "./column";
import comment from "./comment";
import config from "./config";
import db, { schema } from "./database";
+import discordIntegration from "./discord-integration";
import externalLink from "./external-link";
import githubIntegration, {
handleGithubWebhookRoute,
@@ -396,6 +397,10 @@ const githubIntegrationApi = api.route(
"/github-integration",
githubIntegration,
);
+const discordIntegrationApi = api.route(
+ "/discord-integration",
+ discordIntegration,
+);
const slackIntegrationApi = api.route("/slack-integration", slackIntegration);
const taskRelationApi = api.route("/task-relation", taskRelation);
const externalLinkApi = api.route("/external-link", externalLink);
@@ -451,6 +456,7 @@ export type AppType =
| typeof notificationApi
| typeof searchApi
| typeof githubIntegrationApi
+ | typeof discordIntegrationApi
| typeof slackIntegrationApi
| typeof taskRelationApi
| typeof externalLinkApi
diff --git a/apps/api/src/plugins/discord/client.ts b/apps/api/src/plugins/discord/client.ts
new file mode 100644
index 000000000..bbb293ed1
--- /dev/null
+++ b/apps/api/src/plugins/discord/client.ts
@@ -0,0 +1,41 @@
+type DiscordEmbedField = {
+ name: string;
+ value: string;
+ inline?: boolean;
+};
+
+type DiscordEmbed = {
+ title?: string;
+ description?: string;
+ url?: string;
+ color?: number;
+ fields?: DiscordEmbedField[];
+ footer?: {
+ text: string;
+ };
+};
+
+type DiscordMessage = {
+ content?: string;
+ embeds?: DiscordEmbed[];
+};
+
+export async function postToDiscord(
+ webhookUrl: string,
+ message: DiscordMessage,
+): Promise<void> {
+ const response = await fetch(webhookUrl, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(message),
+ });
+
+ if (!response.ok) {
+ const errorText = await response.text();
+ throw new Error(
+ `Discord webhook request failed (${response.status}): ${errorText}`,
+ );
+ }
+}
diff --git a/apps/api/src/plugins/discord/config.ts b/apps/api/src/plugins/discord/config.ts
new file mode 100644
index 000000000..8aa5518bd
--- /dev/null
+++ b/apps/api/src/plugins/discord/config.ts
@@ -0,0 +1,87 @@
+import * as v from "valibot";
+
+export const discordEventKeys = [
+ "taskCreated",
+ "taskStatusChanged",
+ "taskPriorityChanged",
+ "taskTitleChanged",
+ "taskDescriptionChanged",
+ "taskCommentCreated",
+] as const;
+
+export type DiscordEventKey = (typeof discordEventKeys)[number];
+
+const discordWebhookSchema = v.pipe(
+ v.string(),
+ v.url(),
+ v.regex(
+ /^https:\/\/(?:discord\.com|discordapp\.com)\/api\/webhooks\/[^/]+\/[^/\s]+$/i,
+ "Enter a valid Discord webhook URL",
+ ),
+);
+
+export const discordConfigSchema = v.object({
+ webhookUrl: discordWebhookSchema,
+ channelName: v.optional(v.string()),
+ events: v.optional(
+ v.object({
+ taskCreated: v.optional(v.boolean()),
+ taskStatusChanged: v.optional(v.boolean()),
+ taskPriorityChanged: v.optional(v.boolean()),
+ taskTitleChanged: v.optional(v.boolean()),
+ taskDescriptionChanged: v.optional(v.boolean()),
+ taskCommentCreated: v.optional(v.boolean()),
+ }),
+ ),
+});
+
+export type DiscordConfig = v.InferOutput<typeof discordConfigSchema>;
+
+export const defaultDiscordEvents: Record<DiscordEventKey, boolean> = {
+ taskCreated: true,
+ taskStatusChanged: true,
+ taskPriorityChanged: false,
+ taskTitleChanged: false,
+ taskDescriptionChanged: false,
+ taskCommentCreated: true,
+};
+
+export function getDefaultDiscordConfig(webhookUrl: string): DiscordConfig {
+ return {
+ webhookUrl,
+ events: { ...defaultDiscordEvents },
+ };
+}
+
+export function normalizeDiscordConfig(config: DiscordConfig): DiscordConfig {
+ return {
+ ...config,
+ channelName: config.channelName?.trim() || undefined,
+ events: {
+ ...defaultDiscordEvents,
+ ...(config.events ?? {}),
+ },
+ };
+}
+
+export async function validateDiscordConfig(
+ config: unknown,
+): Promise<{ valid: boolean; errors?: string[] }> {
+ try {
+ const parsed = v.parse(discordConfigSchema, config);
+ normalizeDiscordConfig(parsed);
+ return { valid: true };
+ } catch (error) {
+ if (error instanceof v.ValiError) {
+ return {
+ valid: false,
+ errors: error.issues.map((issue) => issue.message),
+ };
+ }
+
+ return {
+ valid: false,
+ errors: [error instanceof Error ? error.message : "Invalid config"],
+ };
+ }
+}
diff --git a/apps/api/src/plugins/discord/events.ts b/apps/api/src/plugins/discord/events.ts
new file mode 100644
index 000000000..cdbd40df8
--- /dev/null
+++ b/apps/api/src/plugins/discord/events.ts
@@ -0,0 +1,279 @@
+import { and, eq } from "drizzle-orm";
+import db from "../../database";
+import {
+ projectTable,
+ taskTable,
+ userTable,
+ workspaceTable,
+} from "../../database/schema";
+import type {
+ PluginContext,
+ TaskCommentCreatedEvent,
+ TaskCreatedEvent,
+ TaskDescriptionChangedEvent,
+ TaskPriorityChangedEvent,
+ TaskStatusChangedEvent,
+ TaskTitleChangedEvent,
+} from "../types";
+import { postToDiscord } from "./client";
+import type { DiscordConfig, DiscordEventKey } from "./config";
+import { normalizeDiscordConfig } from "./config";
+
+type DiscordEventData = {
+ taskTitle: string;
+ taskNumber: number | null;
+ projectName: string;
+ taskUrl: string | null;
+ actorName: string | null;
+ status: string | null;
+ priority: string | null;
+};
+
+function isEnabled(config: DiscordConfig, key: DiscordEventKey): boolean {
+ const normalized = normalizeDiscordConfig(config);
+ return normalized.events?.[key] ?? false;
+}
+
+function toSentenceCase(value: string | null): string {
+ if (!value) return "Unknown";
+ return value
+ .replace(/[-_]+/g, " ")
+ .replace(/\b\w/g, (char) => char.toUpperCase());
+}
+
+function truncate(value: string, maxLength: number): string {
+ if (value.length <= maxLength) {
+ return value;
+ }
+
+ return `${value.slice(0, maxLength - 1)}…`;
+}
+
+async function getDiscordEventData(
+ taskId: string,
+ projectId: string,
+ userId: string | null,
+): Promise<DiscordEventData | null> {
+ const [taskRow] = await db
+ .select({
+ title: taskTable.title,
+ number: taskTable.number,
+ status: taskTable.status,
+ priority: taskTable.priority,
+ projectName: projectTable.name,
+ projectId: projectTable.id,
+ workspaceId: workspaceTable.id,
+ })
+ .from(taskTable)
+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
+ .innerJoin(workspaceTable, eq(projectTable.workspaceId, workspaceTable.id))
+ .where(and(eq(taskTable.id, taskId), eq(projectTable.id, projectId)))
+ .limit(1);
+
+ if (!taskRow) {
+ return null;
+ }
+
+ const [user] = userId
+ ? await db
+ .select({ name: userTable.name })
+ .from(userTable)
+ .where(eq(userTable.id, userId))
+ .limit(1)
+ : [];
+
+ const clientUrl = process.env.KANEO_CLIENT_URL || "http://localhost:5173";
+ const taskUrl = `${clientUrl}/dashboard/workspace/${taskRow.workspaceId}/project/${taskRow.projectId}/task/${taskId}`;
+
+ return {
+ taskTitle: taskRow.title,
+ taskNumber: taskRow.number,
+ projectName: taskRow.projectName,
+ taskUrl,
+ actorName: user?.name ?? null,
+ status: taskRow.status,
+ priority: taskRow.priority,
+ };
+}
+
+async function sendDiscordMessage(
+ config: DiscordConfig,
+ title: string,
+ body: string,
+ data: DiscordEventData,
+): Promise<void> {
+ const issueKey =
+ data.taskNumber !== null ? `#${data.taskNumber}` : "Task update";
+ const taskLabel = `${issueKey} ${data.taskTitle}`;
+
+ await postToDiscord(config.webhookUrl, {
+ content: `${title}: ${data.taskTitle}`,
+ embeds: [
+ {
+ title,
+ description: body,
+ url: data.taskUrl ?? undefined,
+ color: 0x5865f2,
+ fields: [
+ {
+ name: "Task",
+ value: data.taskUrl ? `[${taskLabel}](${data.taskUrl})` : taskLabel,
+ inline: true,
+ },
+ {
+ name: "Project",
+ value: data.projectName,
+ inline: true,
+ },
+ {
+ name: "Status",
+ value: toSentenceCase(data.status),
+ inline: true,
+ },
+ {
+ name: "Priority",
+ value: toSentenceCase(data.priority),
+ inline: true,
+ },
+ ],
+ footer: {
+ text: data.actorName
+ ? `Triggered by ${data.actorName}`
+ : "Triggered by Kaneo",
+ },
+ },
+ ],
+ });
+}
+
+export async function handleTaskCreated(
+ event: TaskCreatedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskCreated")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "New task created",
+ `A new task was added: **${event.title}**`,
+ data,
+ );
+}
+
+export async function handleTaskStatusChanged(
+ event: TaskStatusChangedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskStatusChanged")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "Task status changed",
+ `**${event.title}** moved from **${toSentenceCase(event.oldStatus)}** to **${toSentenceCase(event.newStatus)}**.`,
+ data,
+ );
+}
+
+export async function handleTaskPriorityChanged(
+ event: TaskPriorityChangedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskPriorityChanged")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "Task priority changed",
+ `**${event.title}** changed from **${toSentenceCase(event.oldPriority)}** to **${toSentenceCase(event.newPriority)}**.`,
+ data,
+ );
+}
+
+export async function handleTaskTitleChanged(
+ event: TaskTitleChangedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskTitleChanged")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "Task title changed",
+ `Task renamed from **${truncate(event.oldTitle, 120)}** to **${truncate(event.newTitle, 120)}**.`,
+ data,
+ );
+}
+
+export async function handleTaskDescriptionChanged(
+ event: TaskDescriptionChangedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskDescriptionChanged")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "Task description changed",
+ `The task description was updated${event.newDescription ? `: ${truncate(event.newDescription.replace(/\s+/g, " "), 160)}` : "."}`,
+ data,
+ );
+}
+
+export async function handleTaskCommentCreated(
+ event: TaskCommentCreatedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeDiscordConfig(context.config as DiscordConfig);
+ if (!isEnabled(config, "taskCommentCreated")) return;
+
+ const data = await getDiscordEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendDiscordMessage(
+ config,
+ "New task comment",
+ truncate(event.comment.replace(/\s+/g, " "), 200),
+ data,
+ );
+}
diff --git a/apps/api/src/plugins/discord/index.ts b/apps/api/src/plugins/discord/index.ts
new file mode 100644
index 000000000..8405cb1d8
--- /dev/null
+++ b/apps/api/src/plugins/discord/index.ts
@@ -0,0 +1,22 @@
+import type { IntegrationPlugin } from "../types";
+import { validateDiscordConfig } from "./config";
+import {
+ handleTaskCommentCreated,
+ handleTaskCreated,
+ handleTaskDescriptionChanged,
+ handleTaskPriorityChanged,
+ handleTaskStatusChanged,
+ handleTaskTitleChanged,
+} from "./events";
+
+export const discordPlugin: IntegrationPlugin = {
+ type: "discord",
+ name: "Discord",
+ onTaskCreated: handleTaskCreated,
+ onTaskStatusChanged: handleTaskStatusChanged,
+ onTaskPriorityChanged: handleTaskPriorityChanged,
+ onTaskTitleChanged: handleTaskTitleChanged,
+ onTaskDescriptionChanged: handleTaskDescriptionChanged,
+ onTaskCommentCreated: handleTaskCommentCreated,
+ validateConfig: validateDiscordConfig,
+};
diff --git a/apps/api/src/plugins/index.ts b/apps/api/src/plugins/index.ts
index 3e55e1a4b..637e68104 100644
--- a/apps/api/src/plugins/index.ts
+++ b/apps/api/src/plugins/index.ts
@@ -1,3 +1,4 @@
+import { discordPlugin } from "./discord";
import { githubPlugin, initializeGitHubPlugin } from "./github";
import { initializeEventSubscriptions, registerPlugin } from "./registry";
import { slackPlugin } from "./slack";
@@ -7,6 +8,7 @@ export function initializePlugins() {
registerPlugin(githubPlugin);
registerPlugin(slackPlugin);
+ registerPlugin(discordPlugin);
initializeGitHubPlugin();
initializeEventSubscriptions();
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index f26eb899f..11724d98d 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -131,6 +131,26 @@ export const slackIntegrationSchema = v.object({
updatedAt: v.date(),
});
+export const discordIntegrationSchema = v.object({
+ id: v.string(),
+ projectId: v.string(),
+ channelName: v.nullable(v.string()),
+ webhookConfigured: v.boolean(),
+ webhookUrl: v.string(),
+ maskedWebhookUrl: v.string(),
+ events: v.object({
+ taskCreated: v.boolean(),
+ taskStatusChanged: v.boolean(),
+ taskPriorityChanged: v.boolean(),
+ taskTitleChanged: v.boolean(),
+ taskDescriptionChanged: v.boolean(),
+ taskCommentCreated: v.boolean(),
+ }),
+ isActive: v.nullable(v.boolean()),
+ createdAt: v.date(),
+ updatedAt: v.date(),
+});
+
export const commentSchema = v.object({
id: v.string(),
taskId: v.string(),
diff --git a/apps/web/src/components/project/discord-integration-settings.tsx b/apps/web/src/components/project/discord-integration-settings.tsx
new file mode 100644
index 000000000..76a806c8a
--- /dev/null
+++ b/apps/web/src/components/project/discord-integration-settings.tsx
@@ -0,0 +1,424 @@
+import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
+import { CheckCircle, Trash2 } from "lucide-react";
+import React from "react";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import { z } from "zod/v4";
+import { Button } from "@/components/ui/button";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import { Switch } from "@/components/ui/switch";
+import {
+ useCreateDiscordIntegration,
+ useDeleteDiscordIntegration,
+ useUpdateDiscordIntegration,
+} from "@/hooks/mutations/discord-integration/use-discord-integration";
+import useGetDiscordIntegration from "@/hooks/queries/discord-integration/use-get-discord-integration";
+import { toast } from "@/lib/toast";
+
+type DiscordIntegrationFormValues = {
+ webhookUrl: string;
+ channelName: string;
+ taskCreated: boolean;
+ taskStatusChanged: boolean;
+ taskPriorityChanged: boolean;
+ taskTitleChanged: boolean;
+ taskDescriptionChanged: boolean;
+ taskCommentCreated: boolean;
+};
+
+function EventToggle({
+ control,
+ name,
+ label,
+}: {
+ control: ReturnType<typeof useForm<DiscordIntegrationFormValues>>["control"];
+ name: keyof Pick<
+ DiscordIntegrationFormValues,
+ | "taskCreated"
+ | "taskStatusChanged"
+ | "taskPriorityChanged"
+ | "taskTitleChanged"
+ | "taskDescriptionChanged"
+ | "taskCommentCreated"
+ >;
+ label: string;
+}) {
+ return (
+ <FormField
+ control={control}
+ name={name}
+ render={({ field }) => (
+ <FormItem className="flex items-center justify-between rounded-md border px-3 py-2">
+ <FormLabel className="text-sm font-medium">{label}</FormLabel>
+ <FormControl>
+ <Switch
+ checked={Boolean(field.value)}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+function isValidDiscordWebhookUrl(value: string): boolean {
+ return (
+ z.url().safeParse(value).success &&
+ /^https:\/\/(?:discord\.com|discordapp\.com)\/api\/webhooks\/[^/]+\/[^/\s]+$/i.test(
+ value,
+ )
+ );
+}
+
+export function DiscordIntegrationSettings({
+ projectId,
+}: {
+ projectId: string;
+}) {
+ const { t } = useTranslation();
+ const schema = React.useMemo(
+ () =>
+ z.object({
+ webhookUrl: z.string(),
+ channelName: z.string(),
+ taskCreated: z.boolean(),
+ taskStatusChanged: z.boolean(),
+ taskPriorityChanged: z.boolean(),
+ taskTitleChanged: z.boolean(),
+ taskDescriptionChanged: z.boolean(),
+ taskCommentCreated: z.boolean(),
+ }),
+ [],
+ );
+
+ const { data: integration, isLoading } = useGetDiscordIntegration(projectId);
+ const { mutateAsync: createIntegration, isPending: isCreating } =
+ useCreateDiscordIntegration();
+ const { mutateAsync: updateIntegration, isPending: isUpdating } =
+ useUpdateDiscordIntegration();
+ const { mutateAsync: deleteIntegration, isPending: isDeleting } =
+ useDeleteDiscordIntegration();
+ const normalizedValues = React.useMemo<DiscordIntegrationFormValues>(
+ () => ({
+ webhookUrl: integration?.webhookUrl ?? "",
+ channelName: integration?.channelName ?? "",
+ taskCreated: integration?.events?.taskCreated ?? true,
+ taskStatusChanged: integration?.events?.taskStatusChanged ?? true,
+ taskPriorityChanged: integration?.events?.taskPriorityChanged ?? false,
+ taskTitleChanged: integration?.events?.taskTitleChanged ?? false,
+ taskDescriptionChanged:
+ integration?.events?.taskDescriptionChanged ?? false,
+ taskCommentCreated: integration?.events?.taskCommentCreated ?? true,
+ }),
+ [integration],
+ );
+
+ const form = useForm<DiscordIntegrationFormValues>({
+ resolver: standardSchemaResolver(schema),
+ defaultValues: {
+ webhookUrl: "",
+ channelName: "",
+ taskCreated: true,
+ taskStatusChanged: true,
+ taskPriorityChanged: false,
+ taskTitleChanged: false,
+ taskDescriptionChanged: false,
+ taskCommentCreated: true,
+ },
+ });
+
+ React.useEffect(() => {
+ form.reset(normalizedValues);
+ }, [form, normalizedValues]);
+
+ const isConnected = Boolean(integration?.webhookConfigured);
+ const isBusy = isCreating || isUpdating || isDeleting;
+
+ const onSubmit = async (values: DiscordIntegrationFormValues) => {
+ try {
+ const trimmedWebhookUrl = values.webhookUrl.trim();
+ const events = {
+ taskCreated: values.taskCreated,
+ taskStatusChanged: values.taskStatusChanged,
+ taskPriorityChanged: values.taskPriorityChanged,
+ taskTitleChanged: values.taskTitleChanged,
+ taskDescriptionChanged: values.taskDescriptionChanged,
+ taskCommentCreated: values.taskCommentCreated,
+ };
+
+ if (!isConnected) {
+ if (
+ !trimmedWebhookUrl ||
+ !isValidDiscordWebhookUrl(trimmedWebhookUrl)
+ ) {
+ form.setError("webhookUrl", {
+ message: t("settings:discordIntegration.validation.webhookInvalid"),
+ });
+ return;
+ }
+
+ await createIntegration({
+ projectId,
+ data: {
+ webhookUrl: trimmedWebhookUrl,
+ channelName: values.channelName || undefined,
+ events,
+ },
+ });
+ } else {
+ if (trimmedWebhookUrl && !isValidDiscordWebhookUrl(trimmedWebhookUrl)) {
+ form.setError("webhookUrl", {
+ message: t("settings:discordIntegration.validation.webhookInvalid"),
+ });
+ return;
+ }
+
+ await updateIntegration({
+ projectId,
+ json: {
+ webhookUrl: trimmedWebhookUrl || undefined,
+ channelName: values.channelName || undefined,
+ events,
+ },
+ });
+ }
+
+ form.reset({
+ ...values,
+ webhookUrl: trimmedWebhookUrl,
+ });
+ toast.success(t("settings:discordIntegration.toast.saved"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:discordIntegration.toast.saveError"),
+ );
+ }
+ };
+
+ const handleToggleActive = async (checked: boolean) => {
+ try {
+ await updateIntegration({
+ projectId,
+ json: { isActive: checked },
+ });
+ toast.success(
+ checked
+ ? t("settings:discordIntegration.toast.enabled")
+ : t("settings:discordIntegration.toast.disabled"),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:discordIntegration.toast.updateError"),
+ );
+ }
+ };
+
+ const handleDelete = async () => {
+ try {
+ await deleteIntegration(projectId);
+ form.reset({
+ webhookUrl: "",
+ channelName: "",
+ taskCreated: true,
+ taskStatusChanged: true,
+ taskPriorityChanged: false,
+ taskTitleChanged: false,
+ taskDescriptionChanged: false,
+ taskCommentCreated: true,
+ });
+ toast.success(t("settings:discordIntegration.toast.removed"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:discordIntegration.toast.removeError"),
+ );
+ }
+ };
+
+ if (isLoading) {
+ return (
+ <div className="space-y-4">
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="h-4 w-40 animate-pulse rounded bg-muted" />
+ <div className="h-10 w-full animate-pulse rounded bg-muted" />
+ <div className="h-10 w-full animate-pulse rounded bg-muted" />
+ </div>
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="h-4 w-40 animate-pulse rounded bg-muted" />
+ <div className="h-10 w-full animate-pulse rounded bg-muted" />
+ <div className="h-10 w-full animate-pulse rounded bg-muted" />
+ </div>
+ </div>
+ );
+ }
+
+ return (
+ <div className="space-y-4">
+ <Form {...form}>
+ <form className="space-y-4" onSubmit={form.handleSubmit(onSubmit)}>
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <div className="flex items-center gap-2">
+ <h3 className="font-medium">
+ {t("settings:discordIntegration.connectionTitle")}
+ </h3>
+ </div>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:discordIntegration.connectionHint")}
+ </p>
+ </div>
+
+ <div className="flex items-center gap-3">
+ {isConnected && (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <CheckCircle className="size-4 text-green-600" />
+ <span>
+ {integration?.isActive
+ ? t("settings:discordIntegration.connected")
+ : t("settings:discordIntegration.paused")}
+ </span>
+ </div>
+ )}
+ <Switch
+ checked={integration?.isActive ?? false}
+ disabled={!isConnected || isBusy}
+ onCheckedChange={handleToggleActive}
+ />
+ </div>
+ </div>
+
+ <FormField
+ control={form.control}
+ name="webhookUrl"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ {t("settings:discordIntegration.webhookLabel")}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ autoComplete="off"
+ placeholder={t(
+ "settings:discordIntegration.webhookPlaceholder",
+ )}
+ type="url"
+ />
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:discordIntegration.webhookHint")}
+ </p>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="channelName"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ {t("settings:discordIntegration.channelLabel")}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ placeholder={t(
+ "settings:discordIntegration.channelPlaceholder",
+ )}
+ />
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:discordIntegration.channelHint")}
+ </p>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+
+ <div className="space-y-3 rounded-md border border-border bg-sidebar p-4">
+ <div>
+ <h3 className="font-medium">
+ {t("settings:discordIntegration.eventsTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:discordIntegration.eventsHint")}
+ </p>
+ </div>
+
+ <EventToggle
+ control={form.control}
+ label={t("settings:discordIntegration.events.taskCreated")}
+ name="taskCreated"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:discordIntegration.events.taskStatusChanged")}
+ name="taskStatusChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t(
+ "settings:discordIntegration.events.taskPriorityChanged",
+ )}
+ name="taskPriorityChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:discordIntegration.events.taskTitleChanged")}
+ name="taskTitleChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t(
+ "settings:discordIntegration.events.taskDescriptionChanged",
+ )}
+ name="taskDescriptionChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:discordIntegration.events.taskCommentCreated")}
+ name="taskCommentCreated"
+ />
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <Button disabled={isBusy} type="submit">
+ {isConnected
+ ? t("settings:discordIntegration.saveChanges")
+ : t("settings:discordIntegration.connect")}
+ </Button>
+ {isConnected && (
+ <Button
+ disabled={isBusy}
+ onClick={handleDelete}
+ type="button"
+ variant="outline"
+ >
+ <Trash2 className="size-4" />
+ {t("settings:discordIntegration.disconnect")}
+ </Button>
+ )}
+ </div>
+ </form>
+ </Form>
+ </div>
+ );
+}
diff --git a/apps/web/src/fetchers/discord-integration/create-discord-integration.ts b/apps/web/src/fetchers/discord-integration/create-discord-integration.ts
new file mode 100644
index 000000000..a7f4271fc
--- /dev/null
+++ b/apps/web/src/fetchers/discord-integration/create-discord-integration.ts
@@ -0,0 +1,46 @@
+import type { DiscordIntegration } from "./get-discord-integration";
+
+function getApiUrl(path: string) {
+ const baseUrl = import.meta.env.VITE_API_URL || "http://localhost:1337";
+ const apiUrl = baseUrl.endsWith("/api") ? baseUrl : `${baseUrl}/api`;
+ return `${apiUrl}${path}`;
+}
+
+export type CreateDiscordIntegrationRequest = {
+ webhookUrl: string;
+ channelName?: string;
+ events?: {
+ taskCreated?: boolean;
+ taskStatusChanged?: boolean;
+ taskPriorityChanged?: boolean;
+ taskTitleChanged?: boolean;
+ taskDescriptionChanged?: boolean;
+ taskCommentCreated?: boolean;
+ };
+};
+
+async function createDiscordIntegration(
+ projectId: string,
+ json: CreateDiscordIntegrationRequest,
+) {
+ const response = await fetch(
+ getApiUrl(`/discord-integration/project/${projectId}`),
+ {
+ method: "POST",
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(json),
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as DiscordIntegration;
+}
+
+export default createDiscordIntegration;
diff --git a/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts b/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts
new file mode 100644
index 000000000..12951392c
--- /dev/null
+++ b/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts
@@ -0,0 +1,27 @@
+function getApiUrl(path: string) {
+ const baseUrl = import.meta.env.VITE_API_URL || "http://localhost:1337";
+ const apiUrl = baseUrl.endsWith("/api") ? baseUrl : `${baseUrl}/api`;
+ return `${apiUrl}${path}`;
+}
+
+async function deleteDiscordIntegration(projectId: string) {
+ const response = await fetch(
+ getApiUrl(`/discord-integration/project/${projectId}`),
+ {
+ method: "DELETE",
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default deleteDiscordIntegration;
diff --git a/apps/web/src/fetchers/discord-integration/get-discord-integration.ts b/apps/web/src/fetchers/discord-integration/get-discord-integration.ts
new file mode 100644
index 000000000..e7729aa85
--- /dev/null
+++ b/apps/web/src/fetchers/discord-integration/get-discord-integration.ts
@@ -0,0 +1,45 @@
+export type DiscordIntegration = {
+ id: string;
+ projectId: string;
+ channelName: string | null;
+ webhookConfigured: boolean;
+ webhookUrl: string;
+ events: {
+ taskCreated: boolean;
+ taskStatusChanged: boolean;
+ taskPriorityChanged: boolean;
+ taskTitleChanged: boolean;
+ taskDescriptionChanged: boolean;
+ taskCommentCreated: boolean;
+ };
+ isActive: boolean | null;
+ createdAt: string;
+ updatedAt: string;
+} | null;
+
+function getApiUrl(path: string) {
+ const baseUrl = import.meta.env.VITE_API_URL || "http://localhost:1337";
+ const apiUrl = baseUrl.endsWith("/api") ? baseUrl : `${baseUrl}/api`;
+ return `${apiUrl}${path}`;
+}
+
+async function getDiscordIntegration(projectId: string) {
+ const response = await fetch(
+ getApiUrl(`/discord-integration/project/${projectId}`),
+ {
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as DiscordIntegration;
+}
+
+export default getDiscordIntegration;
diff --git a/apps/web/src/fetchers/discord-integration/update-discord-integration.ts b/apps/web/src/fetchers/discord-integration/update-discord-integration.ts
new file mode 100644
index 000000000..68fcb9444
--- /dev/null
+++ b/apps/web/src/fetchers/discord-integration/update-discord-integration.ts
@@ -0,0 +1,47 @@
+import type { DiscordIntegration } from "./get-discord-integration";
+
+function getApiUrl(path: string) {
+ const baseUrl = import.meta.env.VITE_API_URL || "http://localhost:1337";
+ const apiUrl = baseUrl.endsWith("/api") ? baseUrl : `${baseUrl}/api`;
+ return `${apiUrl}${path}`;
+}
+
+export type UpdateDiscordIntegrationRequest = {
+ webhookUrl?: string;
+ channelName?: string | null;
+ isActive?: boolean;
+ events?: {
+ taskCreated?: boolean;
+ taskStatusChanged?: boolean;
+ taskPriorityChanged?: boolean;
+ taskTitleChanged?: boolean;
+ taskDescriptionChanged?: boolean;
+ taskCommentCreated?: boolean;
+ };
+};
+
+async function updateDiscordIntegration(
+ projectId: string,
+ json: UpdateDiscordIntegrationRequest,
+) {
+ const response = await fetch(
+ getApiUrl(`/discord-integration/project/${projectId}`),
+ {
+ method: "PATCH",
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(json),
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as DiscordIntegration;
+}
+
+export default updateDiscordIntegration;
diff --git a/apps/web/src/hooks/mutations/discord-integration/use-discord-integration.ts b/apps/web/src/hooks/mutations/discord-integration/use-discord-integration.ts
new file mode 100644
index 000000000..cda1a2f9b
--- /dev/null
+++ b/apps/web/src/hooks/mutations/discord-integration/use-discord-integration.ts
@@ -0,0 +1,59 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import createDiscordIntegration, {
+ type CreateDiscordIntegrationRequest,
+} from "@/fetchers/discord-integration/create-discord-integration";
+import deleteDiscordIntegration from "@/fetchers/discord-integration/delete-discord-integration";
+import updateDiscordIntegration, {
+ type UpdateDiscordIntegrationRequest,
+} from "@/fetchers/discord-integration/update-discord-integration";
+
+export function useCreateDiscordIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ data,
+ }: {
+ projectId: string;
+ data: CreateDiscordIntegrationRequest;
+ }) => createDiscordIntegration(projectId, data),
+ onSuccess: (_, { projectId }) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["discord-integration", projectId],
+ });
+ },
+ });
+}
+
+export function useUpdateDiscordIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ json,
+ }: {
+ projectId: string;
+ json: UpdateDiscordIntegrationRequest;
+ }) => updateDiscordIntegration(projectId, json),
+ onSuccess: (_, { projectId }) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["discord-integration", projectId],
+ });
+ },
+ });
+}
+
+export function useDeleteDiscordIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: (projectId: string) => deleteDiscordIntegration(projectId),
+ onSuccess: (_, projectId) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["discord-integration", projectId],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/queries/discord-integration/use-get-discord-integration.ts b/apps/web/src/hooks/queries/discord-integration/use-get-discord-integration.ts
new file mode 100644
index 000000000..36d7d0d01
--- /dev/null
+++ b/apps/web/src/hooks/queries/discord-integration/use-get-discord-integration.ts
@@ -0,0 +1,11 @@
+import { useQuery } from "@tanstack/react-query";
+import getDiscordIntegration from "@/fetchers/discord-integration/get-discord-integration";
+
+function useGetDiscordIntegration(projectId: string) {
+ return useQuery({
+ queryKey: ["discord-integration", projectId],
+ queryFn: () => getDiscordIntegration(projectId),
+ });
+}
+
+export default useGetDiscordIntegration;
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations.tsx
index 95ca9518d..6f4c318d2 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations.tsx
@@ -1,8 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
-import { ChevronDown, Github, Webhook } from "lucide-react";
+import { ChevronDown, Github, MessageCircle, Webhook } from "lucide-react";
import type { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import PageTitle from "@/components/page-title";
+import { DiscordIntegrationSettings } from "@/components/project/discord-integration-settings";
import { GitHubIntegrationSettings } from "@/components/project/github-integration-settings";
import { SlackIntegrationSettings } from "@/components/project/slack-integration-settings";
import {
@@ -44,6 +45,14 @@ function RouteComponent() {
<GitHubIntegrationSettings projectId={projectId} />
</IntegrationSection>
+ <IntegrationSection
+ icon={<MessageCircle className="size-4" />}
+ subtitle={t("settings:projectIntegrations.discordSectionSubtitle")}
+ title={t("settings:projectIntegrations.discordSectionTitle")}
+ >
+ <DiscordIntegrationSettings projectId={projectId} />
+ </IntegrationSection>
+
<IntegrationSection
icon={<Webhook className="size-4" />}
subtitle={t("settings:projectIntegrations.slackSectionSubtitle")}
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 2273d5026..0401910f8 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -490,6 +490,8 @@
"subtitle": "Verbinde dein Projekt mit externen Tools und Diensten, um deinen Workflow zu optimieren.",
"githubSectionTitle": "GitHub-Integration",
"githubSectionSubtitle": "Synchronisiere Aufgaben mit GitHub-Issues und aktiviere die bidirektionale Synchronisierung.",
+ "discordSectionTitle": "Discord-Integration",
+ "discordSectionSubtitle": "Sende Projektaktualisierungen per Webhook in einen Discord-Kanal.",
"slackSectionTitle": "Slack-Integration",
"slackSectionSubtitle": "Sende Projektaktualisierungen per Incoming Webhook in einen Slack-Kanal."
},
@@ -639,6 +641,44 @@
"update": "Slack aktualisieren",
"disconnect": "Trennen"
},
+ "discordIntegration": {
+ "validation": {
+ "webhookInvalid": "Gib eine gültige Discord-Webhook-URL ein"
+ },
+ "toast": {
+ "saved": "Discord-Integration erfolgreich gespeichert",
+ "saveError": "Discord-Integration konnte nicht gespeichert werden",
+ "enabled": "Discord-Benachrichtigungen aktiviert",
+ "disabled": "Discord-Benachrichtigungen pausiert",
+ "updateError": "Discord-Integration konnte nicht aktualisiert werden",
+ "removed": "Discord-Integration erfolgreich entfernt",
+ "removeError": "Discord-Integration konnte nicht entfernt werden"
+ },
+ "connectionTitle": "Discord-Webhook-Verbindung",
+ "connectionHint": "Füge eine Discord-Webhook-URL ein und wähle aus, welche Aufgabenereignisse gesendet werden sollen.",
+ "connected": "Verbunden",
+ "paused": "Pausiert",
+ "webhookLabel": "Webhook-URL",
+ "webhookPlaceholder": "https://discord.com/api/webhooks/...",
+ "webhookHint": "Erstelle in Discord einen Kanal-Webhook und füge die erzeugte URL hier ein.",
+ "channelLabel": "Kanalname",
+ "channelPlaceholder": "#team-updates",
+ "channelHint": "Optionales Label für dich. Der tatsächliche Zielkanal wird in Discord über den Webhook festgelegt.",
+ "eventsTitle": "Ereignisbenachrichtigungen",
+ "eventsHint": "Wähle aus, welche Projektänderungen an Discord gesendet werden sollen.",
+ "events": {
+ "taskCreated": "Neue Aufgaben",
+ "taskStatusChanged": "Statusänderungen",
+ "taskPriorityChanged": "Prioritätsänderungen",
+ "taskTitleChanged": "Titeländerungen",
+ "taskDescriptionChanged": "Beschreibungsänderungen",
+ "taskCommentCreated": "Neue Kommentare"
+ },
+ "connect": "Discord verbinden",
+ "saveChanges": "Änderungen speichern",
+ "update": "Discord aktualisieren",
+ "disconnect": "Trennen"
+ },
"repositoryBrowser": {
"title": "Repository auswählen",
"description": "Wähle ein Repository aus, in dem deine GitHub-App installiert ist, um die Issue-Synchronisierung zu aktivieren.",
diff --git a/i18n/en-US.json b/i18n/en-US.json
index c1d355cfd..47c1d0860 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -490,6 +490,8 @@
"subtitle": "Connect your project with external tools and services to streamline your workflow.",
"githubSectionTitle": "GitHub Integration",
"githubSectionSubtitle": "Synchronize tasks with GitHub issues and enable two-way sync.",
+ "discordSectionTitle": "Discord Integration",
+ "discordSectionSubtitle": "Send project task updates into a Discord channel with a webhook.",
"slackSectionTitle": "Slack Integration",
"slackSectionSubtitle": "Send project task updates into a Slack channel with an incoming webhook."
},
@@ -639,6 +641,44 @@
"update": "Update Slack",
"disconnect": "Disconnect"
},
+ "discordIntegration": {
+ "validation": {
+ "webhookInvalid": "Enter a valid Discord webhook URL"
+ },
+ "toast": {
+ "saved": "Discord integration saved successfully",
+ "saveError": "Failed to save Discord integration",
+ "enabled": "Discord notifications enabled",
+ "disabled": "Discord notifications paused",
+ "updateError": "Failed to update Discord integration",
+ "removed": "Discord integration removed successfully",
+ "removeError": "Failed to remove Discord integration"
+ },
+ "connectionTitle": "Discord webhook connection",
+ "connectionHint": "Paste a Discord webhook URL and choose which task events should be posted.",
+ "connected": "Connected",
+ "paused": "Paused",
+ "webhookLabel": "Webhook URL",
+ "webhookPlaceholder": "https://discord.com/api/webhooks/...",
+ "webhookHint": "Create a Discord channel webhook and paste the generated URL here.",
+ "channelLabel": "Channel name",
+ "channelPlaceholder": "#team-updates",
+ "channelHint": "Optional label for your reference. Discord controls the actual destination channel from the webhook setup.",
+ "eventsTitle": "Event notifications",
+ "eventsHint": "Choose which project changes should post to Discord.",
+ "events": {
+ "taskCreated": "New tasks",
+ "taskStatusChanged": "Status changes",
+ "taskPriorityChanged": "Priority changes",
+ "taskTitleChanged": "Title changes",
+ "taskDescriptionChanged": "Description changes",
+ "taskCommentCreated": "New comments"
+ },
+ "connect": "Connect Discord",
+ "saveChanges": "Save changes",
+ "update": "Update Discord",
+ "disconnect": "Disconnect"
+ },
"repositoryBrowser": {
"title": "Select Repository",
"description": "Choose a repository where your GitHub App is installed to enable issue synchronization.",