The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
hardcode slack chanel
Pedro Ladeira1127ccfc2d36
diff --git a/apps/web/.env.example b/apps/web/.env.exampleindex ba9e1f185e..033f320ab9 100644--- a/apps/web/.env.example+++ b/apps/web/.env.example@@ -115,9 +115,6 @@ DUB_SLACK_HOOK_LINKS=# Slack Dub Support integrationDUB_SLACK_ASSISTANT_BOT_TOKEN=-# Slack channel ID that mirrors AI support chat conversations-DUB_SLACK_SUPPORT_CHAT_CHANNEL_ID=-# Used for background jobs# Get your ngrok URL here: https://ngrok.com/NEXT_PUBLIC_NGROK_URL=diff --git a/apps/web/app/api/ai/support-chat/route.ts b/apps/web/app/api/ai/support-chat/route.tsindex 0a47bf7add..6ed7015471 100644--- a/apps/web/app/api/ai/support-chat/route.ts+++ b/apps/web/app/api/ai/support-chat/route.ts@@ -64,39 +64,37 @@ export const POST = withSession(async ({ req, session }) => {return new Response("Don't DDoS me pls 🥺", { status: 429 });}- const slackChannel = process.env.DUB_SLACK_SUPPORT_CHAT_CHANNEL_ID;+ const slackChannel = "C0BECQ3GNKH";let slackThreadTs = incomingSlackThreadTs;let slackUserPostPromise: Promise<string | undefined> | undefined;- if (slackChannel) {- const latestUserText =- messages[messages.length - 1].parts- ?.filter((p): p is { type: "text"; text: string } => p.type === "text")- .map((p) => p.text)- .join("\n\n") ?? "";- const userLabel = session.user.name || session.user.email || "Unknown user";-- if (!slackThreadTs) {- slackUserPostPromise = postSupportChatMessage({- channel: slackChannel,- text: [- `:speech_balloon: *New AI Support Chat*`,- ...getAccountContextLines(globalContext),- `${userLabel} (${session.user.email})`,- "",- `${userLabel}: ${latestUserText}`,- ].join("\n"),- }).then((ts) => {- if (ts) slackThreadTs = ts;- return ts;- });- } else {- slackUserPostPromise = postSupportChatMessage({- channel: slackChannel,- threadTs: slackThreadTs,- text: `*${userLabel}:* ${latestUserText}`,- });- }+ const latestUserText =+ messages[messages.length - 1].parts+ ?.filter((p): p is { type: "text"; text: string } => p.type === "text")+ .map((p) => p.text)+ .join("\n\n") ?? "";+ const userLabel = session.user.name || session.user.email || "Unknown user";++ if (!slackThreadTs) {+ slackUserPostPromise = postSupportChatMessage({+ channel: slackChannel,+ text: [+ `:speech_balloon: *New AI Support Chat*`,+ ...getAccountContextLines(globalContext),+ `${userLabel} (${session.user.email})`,+ "",+ `${userLabel}: ${latestUserText}`,+ ].join("\n"),+ }).then((ts) => {+ if (ts) slackThreadTs = ts;+ return ts;+ });+ } else {+ slackUserPostPromise = postSupportChatMessage({+ channel: slackChannel,+ threadTs: slackThreadTs,+ text: `*${userLabel}:* ${latestUserText}`,+ });}const result = streamText({