mirror of https://github.com/buster-so/buster.git
env vars and oauth scopes
This commit is contained in:
parent
2e4791158b
commit
32073d8c03
|
@ -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,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres
|
||||
BRAINTRUST_KEY=""
|
||||
TRIGGER_SECRET_KEY=""
|
||||
ENVIRONMENT="development"
|
||||
ENVIRONMENT="development"
|
||||
BUSTER_URL="http://localhost:3000"
|
|
@ -6,6 +6,7 @@ declare global {
|
|||
TRIGGER_SECRET_KEY: string;
|
||||
ENVIRONMENT: string;
|
||||
NODE_ENV?: 'development' | 'production' | 'test';
|
||||
BUSTER_URL: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>*`,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue