From 35193e53ce3848b1a0b1c21869cba05449ce3bac Mon Sep 17 00:00:00 2001 From: dal Date: Mon, 18 Aug 2025 13:28:32 -0600 Subject: [PATCH] - fix lower case slack - return error response on slack bot verification - auth scope fix --- apps/server/src/api/v2/slack/constants.ts | 1 - apps/server/src/api/v2/slack/events.ts | 21 +++++++++++++------ .../integrations/SlackIntegrations.tsx | 8 +++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/server/src/api/v2/slack/constants.ts b/apps/server/src/api/v2/slack/constants.ts index 853f1b9bd..fa48c6d73 100644 --- a/apps/server/src/api/v2/slack/constants.ts +++ b/apps/server/src/api/v2/slack/constants.ts @@ -2,7 +2,6 @@ export const SLACK_OAUTH_SCOPES = [ 'app_mentions:read', 'channels:history', 'channels:join', - 'channels:manage', 'channels:read', 'chat:write', 'chat:write.public', diff --git a/apps/server/src/api/v2/slack/events.ts b/apps/server/src/api/v2/slack/events.ts index c96d53f8b..ffc58527a 100644 --- a/apps/server/src/api/v2/slack/events.ts +++ b/apps/server/src/api/v2/slack/events.ts @@ -141,12 +141,21 @@ export async function handleSlackEventsEndpoint(c: Context) { const payload = c.get('slackPayload'); if (!payload) { // This shouldn't happen if middleware works correctly - return c.json({ success: false }); + return c.json({ error: 'Unauthorized' }, 401); } - // Process the event - const response = await eventsHandler(payload); - return c.json(response); + try { + // Process the event + const response = await eventsHandler(payload); + return c.json(response); + } catch (error) { + // Handle authentication errors + if (error instanceof Error && error.message.includes('Unauthorized')) { + return c.json({ error: 'Unauthorized' }, 401); + } + // Re-throw other errors + throw error; + } } /** @@ -179,8 +188,8 @@ export async function eventsHandler(payload: SlackWebhookPayload): Promise { }, [isConnected]); if (slackIntegrationError) { - return ; + return ; } if (!isFetchedSlackIntegration) { @@ -67,7 +67,7 @@ const ConnectSlackCard = React.memo(() => {
Slack account - Link your slack account to use Buster from Slack + Link your Slack account to use Buster from Slack
@@ -166,7 +166,7 @@ const ConnectedSlackChannels = React.memo(() => {
Alerts channel - Select which slack channel Buster should send alerts to + Select which Slack channel Buster should send alerts to
@@ -262,7 +262,7 @@ const SlackSharingPermissions = React.memo(() => {
Auto-share chats with other users - Specify how chats are auto-shared when created from slack channels + Specify how chats are auto-shared when created from Slack channels