Created
March 2, 2020 18:05
-
-
Save kendomen/7dd5d9096312d4d06425330a3c9b9f4b to your computer and use it in GitHub Desktop.
slack-helloworld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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