This is a TypeScript Express.js application that connects to Slack to receive and send messages when mentioned or responded to in threads.
- Node.js (v14 or higher)
- npm or yarn
- A Slack workspace where you can create apps
- Slack app credentials (Bot Token and Signing Secret)
-
Clone this repository
-
Install dependencies:
npm install
-
Create a
.envfile in the root directory with the following variables:SLACK_BOT_TOKEN=xoxb-your-bot-token SLACK_SIGNING_SECRET=your-signing-secret PORT=3000 -
To get your Slack credentials:
- Go to api.slack.com/apps
- Create a new app
- Under "OAuth & Permissions", add the following bot token scopes:
app_mentions:readchannels:historychat:writeim:historympim:history
- Install the app to your workspace
- Copy the Bot User OAuth Token and Signing Secret
Development mode:
npm run devProduction mode:
npm run build
npm start- Responds to mentions of the bot
- Responds to messages in threads
- Basic Express server setup
The bot will respond to:
- Direct mentions of the bot
- Messages in threads where the bot is present