Skip to content

Commit 585e328

Browse files
committed
slack integrations work with esm and run on start
1 parent 7734f80 commit 585e328

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/backend/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import carsRouter from './src/routes/cars.routes.js';
1717
import organizationRouter from './src/routes/organizations.routes.js';
1818
import recruitmentRouter from './src/routes/recruitment.routes.js';
1919
import { getReceiver } from './src/integrations/slack.js';
20+
import './src/routes/slack.routes.js';
2021
import announcementsRouter from './src/routes/announcements.routes.js';
2122
import onboardingRouter from './src/routes/onboarding.routes.js';
2223
import popUpsRouter from './src/routes/pop-up.routes.js';

src/backend/src/integrations/slack.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { App, ExpressReceiver } from '@slack/bolt';
1+
import bolt from '@slack/bolt';
2+
import type { App, ExpressReceiver } from '@slack/bolt';
23
import { HttpException } from '../utils/errors.utils.js';
34

5+
const { App: AppClass, ExpressReceiver: ExpressReceiverClass } = bolt;
6+
47
let receiver: ExpressReceiver | null = null;
58
let slackApp: App | null = null;
69
let slack: any = null; // Type will be inferred from slackApp.client (WebClient from Bolt)
@@ -23,12 +26,12 @@ const initializeSlack = () => {
2326
}
2427

2528
// Initialize the receiver, app, and client
26-
receiver = new ExpressReceiver({
29+
receiver = new ExpressReceiverClass({
2730
signingSecret: SLACK_SIGNING_SECRET || '',
2831
endpoints: '/slack/events'
2932
});
3033

31-
slackApp = new App({
34+
slackApp = new AppClass({
3235
token: SLACK_BOT_TOKEN,
3336
receiver
3437
});

0 commit comments

Comments
 (0)