env vars and oauth scopes

This commit is contained in:
dal 2025-07-07 11:03:40 -06:00
parent 2e4791158b
commit 32073d8c03
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
5 changed files with 14 additions and 4 deletions

View File

@ -41,11 +41,16 @@ export class SlackOAuthService {
clientSecret: this.env.SLACK_CLIENT_SECRET,
redirectUri: this.env.SLACK_REDIRECT_URI,
scopes: [
'channels:history',
'channels:join',
'channels:manage',
'channels:read',
'chat:write',
'chat:write.public',
'commands',
'channels:join',
'users:read',
'users:read.email',
],
},
tokenStorage,

View File

@ -2,3 +2,4 @@ DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres
BRAINTRUST_KEY=""
TRIGGER_SECRET_KEY=""
ENVIRONMENT="development"
BUSTER_URL="http://localhost:3000"

View File

@ -6,6 +6,7 @@ declare global {
TRIGGER_SECRET_KEY: string;
ENVIRONMENT: string;
NODE_ENV?: 'development' | 'production' | 'test';
BUSTER_URL: string;
}
}
}

View File

@ -4,6 +4,7 @@ import { logger } from '@trigger.dev/sdk/v3';
export interface SlackNotificationParams {
organizationId: string;
userName: string | null;
chatId: string;
summaryTitle?: string | undefined;
summaryMessage?: string | undefined;
formattedMessage?: string | null | undefined;
@ -153,6 +154,7 @@ function shouldSendSlackNotification(params: SlackNotificationParams): boolean {
*/
function formatSlackMessage(params: SlackNotificationParams): SlackMessage {
const userName = params.userName || 'Unknown User';
const chatUrl = `${process.env.BUSTER_URL}/app/chats/${params.chatId}`;
// Case 1: Formatted message from workflow (highest priority)
if (params.formattedMessage) {
@ -162,7 +164,7 @@ function formatSlackMessage(params: SlackNotificationParams): SlackMessage {
type: 'section',
text: {
type: 'mrkdwn',
text: `Buster flagged a chat for review:\n*<fakeLink.toEmployeeProfile.com|${userName}>*`,
text: `Buster flagged a chat for review:\n*<${chatUrl}|${userName}>*`,
},
},
{
@ -185,7 +187,7 @@ function formatSlackMessage(params: SlackNotificationParams): SlackMessage {
type: 'section',
text: {
type: 'mrkdwn',
text: `Buster flagged a chat for review:\n*<fakeLink.toEmployeeProfile.com|${userName} - ${params.summaryTitle}>*`,
text: `Buster flagged a chat for review:\n*<${chatUrl}|${userName} - ${params.summaryTitle}>*`,
},
},
{
@ -208,7 +210,7 @@ function formatSlackMessage(params: SlackNotificationParams): SlackMessage {
type: 'section',
text: {
type: 'mrkdwn',
text: `Buster flagged a chat for review:\n*<fakeLink.toEmployeeProfile.com|${userName} - Flagged Chat>*`,
text: `Buster flagged a chat for review:\n*<${chatUrl}|${userName} - Flagged Chat>*`,
},
},
{

View File

@ -272,6 +272,7 @@ export const messagePostProcessingTask: ReturnType<
const slackResult = await sendSlackNotification({
organizationId: messageContext.organizationId,
userName: messageContext.userName,
chatId: messageContext.chatId,
summaryTitle: dbData.summaryTitle,
summaryMessage: dbData.summaryMessage,
formattedMessage: dbData.formattedMessage,