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 Slack integration

Tin9d69f8b2d3b6
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 17aaaa3ee..daf8eef4c 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -31,6 +31,7 @@ import { migrateGitHubIntegration } from "./plugins/github/migration";
import project from "./project";
import { getPublicProject } from "./project/controllers/get-public-project";
import search from "./search";
+import slackIntegration from "./slack-integration";
import { getPrivateObject } from "./storage/s3";
import task from "./task";
import taskRelation from "./task-relation";
@@ -395,6 +396,7 @@ const githubIntegrationApi = api.route(
"/github-integration",
githubIntegration,
);
+const slackIntegrationApi = api.route("/slack-integration", slackIntegration);
const taskRelationApi = api.route("/task-relation", taskRelation);
const externalLinkApi = api.route("/external-link", externalLink);
const workflowRuleApi = api.route("/workflow-rule", workflowRule);
@@ -449,6 +451,7 @@ export type AppType =
| typeof notificationApi
| typeof searchApi
| typeof githubIntegrationApi
+ | typeof slackIntegrationApi
| typeof taskRelationApi
| typeof externalLinkApi
| typeof workflowRuleApi
diff --git a/apps/api/src/plugins/index.ts b/apps/api/src/plugins/index.ts
index 552b86ce8..3e55e1a4b 100644
--- a/apps/api/src/plugins/index.ts
+++ b/apps/api/src/plugins/index.ts
@@ -1,10 +1,12 @@
import { githubPlugin, initializeGitHubPlugin } from "./github";
import { initializeEventSubscriptions, registerPlugin } from "./registry";
+import { slackPlugin } from "./slack";
export function initializePlugins() {
console.log("Initializing plugins...");
registerPlugin(githubPlugin);
+ registerPlugin(slackPlugin);
initializeGitHubPlugin();
initializeEventSubscriptions();
diff --git a/apps/api/src/plugins/slack/client.ts b/apps/api/src/plugins/slack/client.ts
new file mode 100644
index 000000000..1c7b3961f
--- /dev/null
+++ b/apps/api/src/plugins/slack/client.ts
@@ -0,0 +1,40 @@
+type SlackTextObject = {
+ type: "mrkdwn" | "plain_text";
+ text: string;
+};
+
+type SlackBlock =
+ | {
+ type: "section";
+ text: SlackTextObject;
+ fields?: SlackTextObject[];
+ }
+ | {
+ type: "context";
+ elements: SlackTextObject[];
+ };
+
+type SlackMessage = {
+ text: string;
+ blocks?: SlackBlock[];
+};
+
+export async function postToSlack(
+ webhookUrl: string,
+ message: SlackMessage,
+): 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(
+ `Slack webhook request failed (${response.status}): ${errorText}`,
+ );
+ }
+}
diff --git a/apps/api/src/plugins/slack/config.ts b/apps/api/src/plugins/slack/config.ts
new file mode 100644
index 000000000..be8d6e034
--- /dev/null
+++ b/apps/api/src/plugins/slack/config.ts
@@ -0,0 +1,78 @@
+import * as v from "valibot";
+
+export const slackEventKeys = [
+ "taskCreated",
+ "taskStatusChanged",
+ "taskPriorityChanged",
+ "taskTitleChanged",
+ "taskDescriptionChanged",
+ "taskCommentCreated",
+] as const;
+
+export type SlackEventKey = (typeof slackEventKeys)[number];
+
+export const slackConfigSchema = v.object({
+ webhookUrl: v.pipe(v.string(), v.url()),
+ 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 SlackConfig = v.InferOutput<typeof slackConfigSchema>;
+
+export const defaultSlackEvents: Record<SlackEventKey, boolean> = {
+ taskCreated: true,
+ taskStatusChanged: true,
+ taskPriorityChanged: false,
+ taskTitleChanged: false,
+ taskDescriptionChanged: false,
+ taskCommentCreated: true,
+};
+
+export function getDefaultSlackConfig(webhookUrl: string): SlackConfig {
+ return {
+ webhookUrl,
+ events: { ...defaultSlackEvents },
+ };
+}
+
+export function normalizeSlackConfig(config: SlackConfig): SlackConfig {
+ return {
+ ...config,
+ channelName: config.channelName?.trim() || undefined,
+ events: {
+ ...defaultSlackEvents,
+ ...(config.events ?? {}),
+ },
+ };
+}
+
+export async function validateSlackConfig(
+ config: unknown,
+): Promise<{ valid: boolean; errors?: string[] }> {
+ try {
+ const parsed = v.parse(slackConfigSchema, config);
+ normalizeSlackConfig(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/slack/events.ts b/apps/api/src/plugins/slack/events.ts
new file mode 100644
index 000000000..3f55a7ce0
--- /dev/null
+++ b/apps/api/src/plugins/slack/events.ts
@@ -0,0 +1,284 @@
+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 { postToSlack } from "./client";
+import type { SlackConfig, SlackEventKey } from "./config";
+import { normalizeSlackConfig } from "./config";
+
+type SlackEventData = {
+ taskTitle: string;
+ taskNumber: number | null;
+ projectName: string;
+ taskUrl: string | null;
+ actorName: string | null;
+ status: string | null;
+ priority: string | null;
+};
+
+function isEnabled(config: SlackConfig, key: SlackEventKey): boolean {
+ const normalized = normalizeSlackConfig(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 getSlackEventData(
+ taskId: string,
+ projectId: string,
+ userId: string | null,
+): Promise<SlackEventData | 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 sendSlackMessage(
+ config: SlackConfig,
+ title: string,
+ body: string,
+ data: SlackEventData,
+): Promise<void> {
+ const issueKey =
+ data.taskNumber !== null ? `#${data.taskNumber}` : "Task update";
+ const taskLabel = data.taskUrl
+ ? `<${data.taskUrl}|${issueKey} ${data.taskTitle}>`
+ : `${issueKey} ${data.taskTitle}`;
+
+ await postToSlack(config.webhookUrl, {
+ text: `${title}: ${data.taskTitle}`,
+ blocks: [
+ {
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*${title}*\n${body}`,
+ },
+ fields: [
+ {
+ type: "mrkdwn",
+ text: `*Task*\n${taskLabel}`,
+ },
+ {
+ type: "mrkdwn",
+ text: `*Project*\n${data.projectName}`,
+ },
+ {
+ type: "mrkdwn",
+ text: `*Status*\n${toSentenceCase(data.status)}`,
+ },
+ {
+ type: "mrkdwn",
+ text: `*Priority*\n${toSentenceCase(data.priority)}`,
+ },
+ ],
+ },
+ {
+ type: "context",
+ elements: [
+ {
+ type: "mrkdwn",
+ text: data.actorName
+ ? `Triggered by ${data.actorName}`
+ : "Triggered by Kaneo",
+ },
+ ],
+ },
+ ],
+ });
+}
+
+export async function handleTaskCreated(
+ event: TaskCreatedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskCreated")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ config,
+ "New task created",
+ `A new task was added: *${event.title}*`,
+ data,
+ );
+}
+
+export async function handleTaskStatusChanged(
+ event: TaskStatusChangedEvent,
+ context: PluginContext,
+): Promise<void> {
+ const config = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskStatusChanged")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ 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 = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskPriorityChanged")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ 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 = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskTitleChanged")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ 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 = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskDescriptionChanged")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ 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 = normalizeSlackConfig(context.config as SlackConfig);
+ if (!isEnabled(config, "taskCommentCreated")) return;
+
+ const data = await getSlackEventData(
+ event.taskId,
+ event.projectId,
+ event.userId,
+ );
+ if (!data) return;
+
+ await sendSlackMessage(
+ config,
+ "New task comment",
+ truncate(event.comment.replace(/\s+/g, " "), 200),
+ data,
+ );
+}
diff --git a/apps/api/src/plugins/slack/index.ts b/apps/api/src/plugins/slack/index.ts
new file mode 100644
index 000000000..cc324d4f4
--- /dev/null
+++ b/apps/api/src/plugins/slack/index.ts
@@ -0,0 +1,22 @@
+import type { IntegrationPlugin } from "../types";
+import { validateSlackConfig } from "./config";
+import {
+ handleTaskCommentCreated,
+ handleTaskCreated,
+ handleTaskDescriptionChanged,
+ handleTaskPriorityChanged,
+ handleTaskStatusChanged,
+ handleTaskTitleChanged,
+} from "./events";
+
+export const slackPlugin: IntegrationPlugin = {
+ type: "slack",
+ name: "Slack",
+ onTaskCreated: handleTaskCreated,
+ onTaskStatusChanged: handleTaskStatusChanged,
+ onTaskPriorityChanged: handleTaskPriorityChanged,
+ onTaskTitleChanged: handleTaskTitleChanged,
+ onTaskDescriptionChanged: handleTaskDescriptionChanged,
+ onTaskCommentCreated: handleTaskCommentCreated,
+ validateConfig: validateSlackConfig,
+};
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index ec7700f19..f26eb899f 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -111,6 +111,26 @@ export const githubIntegrationSchema = v.object({
updatedAt: v.date(),
});
+export const slackIntegrationSchema = 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/api/src/slack-integration/index.ts b/apps/api/src/slack-integration/index.ts
new file mode 100644
index 000000000..8627d1953
--- /dev/null
+++ b/apps/api/src/slack-integration/index.ts
@@ -0,0 +1,322 @@
+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 {
+ defaultSlackEvents,
+ normalizeSlackConfig,
+ type SlackConfig,
+ validateSlackConfig,
+} from "../plugins/slack/config";
+import { slackIntegrationSchema } from "../schemas";
+import { workspaceAccess } from "../utils/workspace-access-middleware";
+
+const slackIntegration = 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 = normalizeSlackConfig(
+ JSON.parse(integration.config) as SlackConfig,
+ );
+
+ return {
+ id: integration.id,
+ projectId: integration.projectId,
+ channelName: config.channelName ?? null,
+ webhookConfigured: Boolean(config.webhookUrl),
+ webhookUrl: config.webhookUrl ?? "",
+ maskedWebhookUrl: maskWebhookUrl(config.webhookUrl),
+ events: {
+ ...defaultSlackEvents,
+ ...(config.events ?? {}),
+ },
+ isActive: integration.isActive,
+ createdAt: integration.createdAt,
+ updatedAt: integration.updatedAt,
+ };
+}
+
+async function getSlackIntegration(projectId: string) {
+ const integration = await db.query.integrationTable.findFirst({
+ where: and(
+ eq(integrationTable.projectId, projectId),
+ eq(integrationTable.type, "slack"),
+ ),
+ });
+
+ if (!integration) {
+ return null;
+ }
+
+ return toResponse(integration);
+}
+
+slackIntegration
+ .get(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "getSlackIntegration",
+ tags: ["Slack"],
+ description: "Get Slack integration for a project",
+ responses: {
+ 200: {
+ description: "Slack integration details",
+ content: {
+ "application/json": { schema: resolver(slackIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const integration = await getSlackIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .post(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "createSlackIntegration",
+ tags: ["Slack"],
+ description: "Create or replace a Slack integration for a project",
+ responses: {
+ 200: {
+ description: "Slack integration created successfully",
+ content: {
+ "application/json": { schema: resolver(slackIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ 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(
+ 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()),
+ }),
+ ),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const body = c.req.valid("json");
+
+ const config = normalizeSlackConfig({
+ webhookUrl: body.webhookUrl,
+ channelName: body.channelName,
+ events: body.events,
+ });
+
+ const validation = await validateSlackConfig(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, "slack"),
+ ),
+ });
+
+ 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: "slack",
+ config: JSON.stringify(config),
+ isActive: true,
+ });
+ }
+
+ const integration = await getSlackIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .patch(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "updateSlackIntegration",
+ tags: ["Slack"],
+ description: "Update Slack integration settings",
+ responses: {
+ 200: {
+ description: "Slack integration updated successfully",
+ content: {
+ "application/json": { schema: resolver(slackIntegrationSchema) },
+ },
+ },
+ },
+ }),
+ 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(
+ 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()),
+ }),
+ ),
+ }),
+ ),
+ 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, "slack"),
+ ),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, {
+ message: "Slack integration not found",
+ });
+ }
+
+ const currentConfig = normalizeSlackConfig(
+ JSON.parse(existing.config) as SlackConfig,
+ );
+ const nextConfig = normalizeSlackConfig({
+ webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,
+ channelName:
+ body.channelName === undefined
+ ? currentConfig.channelName
+ : (body.channelName ?? undefined),
+ events: {
+ ...(currentConfig.events ?? {}),
+ ...(body.events ?? {}),
+ },
+ });
+
+ const validation = await validateSlackConfig(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 getSlackIntegration(projectId);
+ return c.json(integration);
+ },
+ )
+ .delete(
+ "/project/:projectId",
+ describeRoute({
+ operationId: "deleteSlackIntegration",
+ tags: ["Slack"],
+ description: "Delete Slack integration for a project",
+ responses: {
+ 200: {
+ description: "Slack 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, "slack"),
+ ),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, {
+ message: "Slack integration not found",
+ });
+ }
+
+ await db
+ .delete(integrationTable)
+ .where(eq(integrationTable.id, existing.id));
+ return c.json({ success: true });
+ },
+ );
+
+export default slackIntegration;
diff --git a/apps/web/src/components/project/slack-integration-settings.tsx b/apps/web/src/components/project/slack-integration-settings.tsx
new file mode 100644
index 000000000..5b95ce4aa
--- /dev/null
+++ b/apps/web/src/components/project/slack-integration-settings.tsx
@@ -0,0 +1,412 @@
+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 {
+ useCreateSlackIntegration,
+ useDeleteSlackIntegration,
+ useUpdateSlackIntegration,
+} from "@/hooks/mutations/slack-integration/use-slack-integration";
+import useGetSlackIntegration from "@/hooks/queries/slack-integration/use-get-slack-integration";
+import { toast } from "@/lib/toast";
+
+type SlackIntegrationFormValues = {
+ 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<SlackIntegrationFormValues>>["control"];
+ name: keyof Pick<
+ SlackIntegrationFormValues,
+ | "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>
+ )}
+ />
+ );
+}
+
+export function SlackIntegrationSettings({ 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 } = useGetSlackIntegration(projectId);
+ const { mutateAsync: createIntegration, isPending: isCreating } =
+ useCreateSlackIntegration();
+ const { mutateAsync: updateIntegration, isPending: isUpdating } =
+ useUpdateSlackIntegration();
+ const { mutateAsync: deleteIntegration, isPending: isDeleting } =
+ useDeleteSlackIntegration();
+ const normalizedValues = React.useMemo<SlackIntegrationFormValues>(
+ () => ({
+ 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<SlackIntegrationFormValues>({
+ 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: SlackIntegrationFormValues) => {
+ 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 ||
+ !z.url().safeParse(trimmedWebhookUrl).success
+ ) {
+ form.setError("webhookUrl", {
+ message: t("settings:slackIntegration.validation.webhookInvalid"),
+ });
+ return;
+ }
+
+ await createIntegration({
+ projectId,
+ data: {
+ webhookUrl: trimmedWebhookUrl,
+ channelName: values.channelName || undefined,
+ events,
+ },
+ });
+ } else {
+ if (
+ trimmedWebhookUrl &&
+ !z.url().safeParse(trimmedWebhookUrl).success
+ ) {
+ form.setError("webhookUrl", {
+ message: t("settings:slackIntegration.validation.webhookInvalid"),
+ });
+ return;
+ }
+
+ await updateIntegration({
+ projectId,
+ json: {
+ webhookUrl: trimmedWebhookUrl || undefined,
+ channelName: values.channelName || undefined,
+ events,
+ },
+ });
+ }
+
+ form.reset({
+ ...values,
+ webhookUrl: trimmedWebhookUrl,
+ });
+ toast.success(t("settings:slackIntegration.toast.saved"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:slackIntegration.toast.saveError"),
+ );
+ }
+ };
+
+ const handleToggleActive = async (checked: boolean) => {
+ try {
+ await updateIntegration({
+ projectId,
+ json: { isActive: checked },
+ });
+ toast.success(
+ checked
+ ? t("settings:slackIntegration.toast.enabled")
+ : t("settings:slackIntegration.toast.disabled"),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:slackIntegration.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:slackIntegration.toast.removed"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:slackIntegration.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:slackIntegration.connectionTitle")}
+ </h3>
+ </div>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:slackIntegration.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:slackIntegration.connected")
+ : t("settings:slackIntegration.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:slackIntegration.webhookLabel")}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ autoComplete="off"
+ placeholder={t(
+ "settings:slackIntegration.webhookPlaceholder",
+ )}
+ type="url"
+ />
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:slackIntegration.webhookHint")}
+ </p>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="channelName"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ {t("settings:slackIntegration.channelLabel")}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ placeholder={t(
+ "settings:slackIntegration.channelPlaceholder",
+ )}
+ />
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:slackIntegration.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:slackIntegration.eventsTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:slackIntegration.eventsHint")}
+ </p>
+ </div>
+
+ <EventToggle
+ control={form.control}
+ label={t("settings:slackIntegration.events.taskCreated")}
+ name="taskCreated"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:slackIntegration.events.taskStatusChanged")}
+ name="taskStatusChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:slackIntegration.events.taskPriorityChanged")}
+ name="taskPriorityChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:slackIntegration.events.taskTitleChanged")}
+ name="taskTitleChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t(
+ "settings:slackIntegration.events.taskDescriptionChanged",
+ )}
+ name="taskDescriptionChanged"
+ />
+ <EventToggle
+ control={form.control}
+ label={t("settings:slackIntegration.events.taskCommentCreated")}
+ name="taskCommentCreated"
+ />
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <Button disabled={isBusy} type="submit">
+ {isConnected
+ ? t("settings:slackIntegration.saveChanges")
+ : t("settings:slackIntegration.connect")}
+ </Button>
+ {isConnected && (
+ <Button
+ disabled={isBusy}
+ onClick={handleDelete}
+ type="button"
+ variant="outline"
+ >
+ <Trash2 className="size-4" />
+ {t("settings:slackIntegration.disconnect")}
+ </Button>
+ )}
+ </div>
+ </form>
+ </Form>
+ </div>
+ );
+}
diff --git a/apps/web/src/fetchers/slack-integration/create-slack-integration.ts b/apps/web/src/fetchers/slack-integration/create-slack-integration.ts
new file mode 100644
index 000000000..6db006d25
--- /dev/null
+++ b/apps/web/src/fetchers/slack-integration/create-slack-integration.ts
@@ -0,0 +1,46 @@
+import type { SlackIntegration } from "./get-slack-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 CreateSlackIntegrationRequest = {
+ webhookUrl: string;
+ channelName?: string;
+ events?: {
+ taskCreated?: boolean;
+ taskStatusChanged?: boolean;
+ taskPriorityChanged?: boolean;
+ taskTitleChanged?: boolean;
+ taskDescriptionChanged?: boolean;
+ taskCommentCreated?: boolean;
+ };
+};
+
+async function createSlackIntegration(
+ projectId: string,
+ json: CreateSlackIntegrationRequest,
+) {
+ const response = await fetch(
+ getApiUrl(`/slack-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 SlackIntegration;
+}
+
+export default createSlackIntegration;
diff --git a/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts b/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts
new file mode 100644
index 000000000..5b7186431
--- /dev/null
+++ b/apps/web/src/fetchers/slack-integration/delete-slack-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 deleteSlackIntegration(projectId: string) {
+ const response = await fetch(
+ getApiUrl(`/slack-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 deleteSlackIntegration;
diff --git a/apps/web/src/fetchers/slack-integration/get-slack-integration.ts b/apps/web/src/fetchers/slack-integration/get-slack-integration.ts
new file mode 100644
index 000000000..cdce95d14
--- /dev/null
+++ b/apps/web/src/fetchers/slack-integration/get-slack-integration.ts
@@ -0,0 +1,45 @@
+export type SlackIntegration = {
+ 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 getSlackIntegration(projectId: string) {
+ const response = await fetch(
+ getApiUrl(`/slack-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 SlackIntegration;
+}
+
+export default getSlackIntegration;
diff --git a/apps/web/src/fetchers/slack-integration/update-slack-integration.ts b/apps/web/src/fetchers/slack-integration/update-slack-integration.ts
new file mode 100644
index 000000000..463b74ad0
--- /dev/null
+++ b/apps/web/src/fetchers/slack-integration/update-slack-integration.ts
@@ -0,0 +1,47 @@
+import type { SlackIntegration } from "./get-slack-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 UpdateSlackIntegrationRequest = {
+ webhookUrl?: string;
+ channelName?: string | null;
+ isActive?: boolean;
+ events?: {
+ taskCreated?: boolean;
+ taskStatusChanged?: boolean;
+ taskPriorityChanged?: boolean;
+ taskTitleChanged?: boolean;
+ taskDescriptionChanged?: boolean;
+ taskCommentCreated?: boolean;
+ };
+};
+
+async function updateSlackIntegration(
+ projectId: string,
+ json: UpdateSlackIntegrationRequest,
+) {
+ const response = await fetch(
+ getApiUrl(`/slack-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 SlackIntegration;
+}
+
+export default updateSlackIntegration;
diff --git a/apps/web/src/hooks/mutations/slack-integration/use-slack-integration.ts b/apps/web/src/hooks/mutations/slack-integration/use-slack-integration.ts
new file mode 100644
index 000000000..5309e603b
--- /dev/null
+++ b/apps/web/src/hooks/mutations/slack-integration/use-slack-integration.ts
@@ -0,0 +1,59 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import createSlackIntegration, {
+ type CreateSlackIntegrationRequest,
+} from "@/fetchers/slack-integration/create-slack-integration";
+import deleteSlackIntegration from "@/fetchers/slack-integration/delete-slack-integration";
+import updateSlackIntegration, {
+ type UpdateSlackIntegrationRequest,
+} from "@/fetchers/slack-integration/update-slack-integration";
+
+export function useCreateSlackIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ data,
+ }: {
+ projectId: string;
+ data: CreateSlackIntegrationRequest;
+ }) => createSlackIntegration(projectId, data),
+ onSuccess: (_, { projectId }) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["slack-integration", projectId],
+ });
+ },
+ });
+}
+
+export function useUpdateSlackIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ json,
+ }: {
+ projectId: string;
+ json: UpdateSlackIntegrationRequest;
+ }) => updateSlackIntegration(projectId, json),
+ onSuccess: (_, { projectId }) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["slack-integration", projectId],
+ });
+ },
+ });
+}
+
+export function useDeleteSlackIntegration() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: (projectId: string) => deleteSlackIntegration(projectId),
+ onSuccess: (_, projectId) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["slack-integration", projectId],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/queries/slack-integration/use-get-slack-integration.ts b/apps/web/src/hooks/queries/slack-integration/use-get-slack-integration.ts
new file mode 100644
index 000000000..594a5b32a
--- /dev/null
+++ b/apps/web/src/hooks/queries/slack-integration/use-get-slack-integration.ts
@@ -0,0 +1,12 @@
+import { useQuery } from "@tanstack/react-query";
+import getSlackIntegration from "@/fetchers/slack-integration/get-slack-integration";
+
+function useGetSlackIntegration(projectId: string) {
+ return useQuery({
+ queryKey: ["slack-integration", projectId],
+ queryFn: () => getSlackIntegration(projectId),
+ enabled: Boolean(projectId),
+ });
+}
+
+export default useGetSlackIntegration;
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 1827e9a30..95ca9518d 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,7 +1,15 @@
import { createFileRoute } from "@tanstack/react-router";
+import { ChevronDown, Github, Webhook } from "lucide-react";
+import type { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import PageTitle from "@/components/page-title";
import { GitHubIntegrationSettings } from "@/components/project/github-integration-settings";
+import { SlackIntegrationSettings } from "@/components/project/slack-integration-settings";
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from "@/components/ui/collapsible";
export const Route = createFileRoute(
"/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations",
@@ -27,20 +35,61 @@ function RouteComponent() {
</div>
<div className="space-y-6">
- <div className="space-y-1">
- <h2 className="text-md font-medium">
- {t("settings:projectIntegrations.githubSectionTitle")}
- </h2>
- <p className="text-xs text-muted-foreground">
- {t("settings:projectIntegrations.githubSectionSubtitle")}
- </p>
- </div>
-
- <div className="space-y-4">
+ <IntegrationSection
+ defaultOpen
+ icon={<Github className="size-4" />}
+ subtitle={t("settings:projectIntegrations.githubSectionSubtitle")}
+ title={t("settings:projectIntegrations.githubSectionTitle")}
+ >
<GitHubIntegrationSettings projectId={projectId} />
- </div>
+ </IntegrationSection>
+
+ <IntegrationSection
+ icon={<Webhook className="size-4" />}
+ subtitle={t("settings:projectIntegrations.slackSectionSubtitle")}
+ title={t("settings:projectIntegrations.slackSectionTitle")}
+ >
+ <SlackIntegrationSettings projectId={projectId} />
+ </IntegrationSection>
</div>
</div>
</>
);
}
+
+function IntegrationSection({
+ title,
+ subtitle,
+ icon,
+ defaultOpen = false,
+ children,
+}: {
+ title: string;
+ subtitle: string;
+ icon: ReactNode;
+ defaultOpen?: boolean;
+ children: ReactNode;
+}) {
+ return (
+ <Collapsible
+ className="rounded-xl border border-border bg-background"
+ defaultOpen={defaultOpen}
+ >
+ <CollapsibleTrigger className="group flex w-full items-center justify-between gap-4 px-4 py-4 text-left">
+ <div className="flex min-w-0 items-start gap-3">
+ <div className="mt-0.5 text-muted-foreground">{icon}</div>
+ <div className="min-w-0">
+ <h2 className="text-md font-medium">{title}</h2>
+ <p className="text-xs text-muted-foreground">{subtitle}</p>
+ </div>
+ </div>
+
+ <ChevronDown className="size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-[panel-open]:rotate-180" />
+ </CollapsibleTrigger>
+
+ <CollapsibleContent>
+ <div className="border-t border-border p-4">{children}</div>
+ </CollapsibleContent>
+ </Collapsible>
+ );
+}
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 7f6873071..2273d5026 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -489,7 +489,9 @@
"title": "Projektintegrationen",
"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."
+ "githubSectionSubtitle": "Synchronisiere Aufgaben mit GitHub-Issues und aktiviere die bidirektionale Synchronisierung.",
+ "slackSectionTitle": "Slack-Integration",
+ "slackSectionSubtitle": "Sende Projektaktualisierungen per Incoming Webhook in einen Slack-Kanal."
},
"projectVisibility": {
"pageTitle": "Projektsichtbarkeit",
@@ -599,6 +601,44 @@
"importIssues": "Issues importieren",
"importDisabledHint": "Vervollständige die Repository-Konfiguration oben, um den Import zu aktivieren"
},
+ "slackIntegration": {
+ "validation": {
+ "webhookInvalid": "Gib eine gültige Slack-Webhook-URL ein"
+ },
+ "toast": {
+ "saved": "Slack-Integration erfolgreich gespeichert",
+ "saveError": "Slack-Integration konnte nicht gespeichert werden",
+ "enabled": "Slack-Benachrichtigungen aktiviert",
+ "disabled": "Slack-Benachrichtigungen pausiert",
+ "updateError": "Slack-Integration konnte nicht aktualisiert werden",
+ "removed": "Slack-Integration erfolgreich entfernt",
+ "removeError": "Slack-Integration konnte nicht entfernt werden"
+ },
+ "connectionTitle": "Slack-Webhook-Verbindung",
+ "connectionHint": "Füge eine Slack-Incoming-Webhook-URL ein und wähle aus, welche Aufgabenereignisse gesendet werden sollen.",
+ "connected": "Verbunden",
+ "paused": "Pausiert",
+ "webhookLabel": "Incoming-Webhook-URL",
+ "webhookPlaceholder": "https://hooks.slack.com/services/...",
+ "webhookHint": "Erstelle in Slack einen Incoming 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 Slack über den Webhook festgelegt.",
+ "eventsTitle": "Ereignisbenachrichtigungen",
+ "eventsHint": "Wähle aus, welche Projektänderungen an Slack gesendet werden sollen.",
+ "events": {
+ "taskCreated": "Neue Aufgaben",
+ "taskStatusChanged": "Statusänderungen",
+ "taskPriorityChanged": "Prioritätsänderungen",
+ "taskTitleChanged": "Titeländerungen",
+ "taskDescriptionChanged": "Beschreibungsänderungen",
+ "taskCommentCreated": "Neue Kommentare"
+ },
+ "connect": "Slack verbinden",
+ "saveChanges": "Änderungen speichern",
+ "update": "Slack 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 5af2121f0..c1d355cfd 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -489,7 +489,9 @@
"title": "Project Integrations",
"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."
+ "githubSectionSubtitle": "Synchronize tasks with GitHub issues and enable two-way sync.",
+ "slackSectionTitle": "Slack Integration",
+ "slackSectionSubtitle": "Send project task updates into a Slack channel with an incoming webhook."
},
"projectVisibility": {
"pageTitle": "Project Visibility",
@@ -599,6 +601,44 @@
"importIssues": "Import Issues",
"importDisabledHint": "Complete the repository configuration above to enable importing"
},
+ "slackIntegration": {
+ "validation": {
+ "webhookInvalid": "Enter a valid Slack webhook URL"
+ },
+ "toast": {
+ "saved": "Slack integration saved successfully",
+ "saveError": "Failed to save Slack integration",
+ "enabled": "Slack notifications enabled",
+ "disabled": "Slack notifications paused",
+ "updateError": "Failed to update Slack integration",
+ "removed": "Slack integration removed successfully",
+ "removeError": "Failed to remove Slack integration"
+ },
+ "connectionTitle": "Slack webhook connection",
+ "connectionHint": "Paste a Slack incoming webhook URL and choose which task events should be posted.",
+ "connected": "Connected",
+ "paused": "Paused",
+ "webhookLabel": "Incoming webhook URL",
+ "webhookPlaceholder": "https://hooks.slack.com/services/...",
+ "webhookHint": "Create an Incoming Webhook in Slack and paste the generated URL here.",
+ "channelLabel": "Channel name",
+ "channelPlaceholder": "#team-updates",
+ "channelHint": "Optional label for your reference. Slack controls the actual destination channel from the webhook setup.",
+ "eventsTitle": "Event notifications",
+ "eventsHint": "Choose which project changes should post to Slack.",
+ "events": {
+ "taskCreated": "New tasks",
+ "taskStatusChanged": "Status changes",
+ "taskPriorityChanged": "Priority changes",
+ "taskTitleChanged": "Title changes",
+ "taskDescriptionChanged": "Description changes",
+ "taskCommentCreated": "New comments"
+ },
+ "connect": "Connect Slack",
+ "saveChanges": "Save changes",
+ "update": "Update Slack",
+ "disconnect": "Disconnect"
+ },
"repositoryBrowser": {
"title": "Select Repository",
"description": "Choose a repository where your GitHub App is installed to enable issue synchronization.",