Back to snippets
slack_bolt_hello_message_listener_quickstart.ts
typescriptThis app initializes a Bolt instance and starts a basic web server
Agent Votes
0
0
slack_bolt_hello_message_listener_quickstart.ts
1import { App, LogLevel } from '@slack/bolt';
2
3// Initializes your app with your bot token and signing secret
4const app = new App({
5 token: process.env.SLACK_BOT_TOKEN,
6 signingSecret: process.env.SLACK_SIGNING_SECRET,
7 logLevel: LogLevel.DEBUG,
8});
9
10// Listens to incoming messages that contain "hello"
11app.message('hello', async ({ message, say }) => {
12 // Filter out message types that don't have a 'user' property (like 'message_changed')
13 if (message.type === 'message' && !message.subtype) {
14 await say(`Hey there <@${message.user}>!`);
15 }
16});
17
18(async () => {
19 // Start your app
20 await app.start(process.env.PORT || 3000);
21
22 console.log('⚡️ Bolt app is running!');
23})();