-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
29 lines (23 loc) · 794 Bytes
/
index.ts
File metadata and controls
29 lines (23 loc) · 794 Bytes
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
import { App, SayFn } from "@slack/bolt";
import { configDotenv } from "dotenv";
// Initialize the app with your bot token and signing secret
configDotenv();
const app = new App({
appToken: process.env.SLACK_APP_LEVEL_TOKEN,
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
});
// Listen for messages containing "hello"
app.message("hello", async ({ message, say }: { message: any; say: SayFn }) => {
await say(`Hey there, <@${message.user}>!`);
});
app.message("ping", async ({ message, say }: { message: any; say: SayFn }) => {
await say(`Pong!!!`);
});
// Start the app
(async () => {
const port = process.env.PORT || 3000;
await app.start(port);
console.log(`⚡️ Slack bot is running on port ${port}`);
})();