Skip to content

Instantly share code, notes, and snippets.

@kendomen
Created March 2, 2020 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendomen/7dd5d9096312d4d06425330a3c9b9f4b to your computer and use it in GitHub Desktop.
Save kendomen/7dd5d9096312d4d06425330a3c9b9f4b to your computer and use it in GitHub Desktop.
slack-helloworld
import { App } from '@slack/bolt';
import { WebAPICallResult } from '@slack/web-api';
const {store} = require('./store');
require('dotenv').config();
const botToken = process.env.SLACK_BOT_TOKEN
const signSecret = process.env.SLACK_SIGNING_SECRET
const authorizeFn = async () => {
return {
appToken: botToken,
}
}
// Initializes your app with your signing secret
const boltApp = new App({
signingSecret: signSecret,
authorize: authorizeFn,
ignoreSelf: false
});
boltApp.message('hello', ({ message, say }) => {
// say() sends a message to the channel where the event was triggered
say(`Hey there <@${message.user}>!`);
});
(async () => {
// Start your app
await boltApp.start(process.env.PORT || 3000);
console.log('Listening on port 3000 (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment