diff --git a/connectors/src/api/webhooks/webhook_slack.ts b/connectors/src/api/webhooks/webhook_slack.ts index ba8b41aaa62d..7a6fe549c2ff 100644 --- a/connectors/src/api/webhooks/webhook_slack.ts +++ b/connectors/src/api/webhooks/webhook_slack.ts @@ -146,9 +146,18 @@ const _webhookSlackAPIHandler = async ( slackTeamId: teamId, }); - const slackConfigurations = teamId - ? await SlackConfigurationResource.listForTeamId(teamId) - : []; + if (!teamId) { + return apiError(req, res, { + api_error: { + type: "invalid_request_error", + message: "Missing team_id in request body", + }, + status_code: 400, + }); + } + const slackConfigurations = await SlackConfigurationResource.listForTeamId( + teamId + ); if (slackConfigurations.length === 0) { return apiError(req, res, { api_error: {