-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
43 lines (36 loc) · 1.04 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { App, LogLevel } = require('@slack/bolt');
const SummarizeIncident = require('./functions/summarize_incident');
const GetThreadHistory = require('./functions/get_thread');
require('dotenv').config();
const PORT = process.env.PORT || 3000;
/** Initialization */
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
logLevel: LogLevel.ERROR,
installerOptions: {
port: PORT,
},
});
/** Summarize Incident Listener */
app.function('summarize_incident', SummarizeIncident);
/** Get Thread History Listener */
app.function('get_thread', GetThreadHistory);
/** App Mention Listener */
app.event('app_mention', async ({ event }) => {
try {
console.log(`Received mention in ${event.channel}`);
} catch (error) {
console.error(error);
}
});
/** Start Bolt App */
(async () => {
try {
await app.start(PORT);
console.log(`⚡️ AI for Incidents app is running on port ${PORT} ⚡️`);
} catch (error) {
console.error('Unable to start App', error);
}
})();