This is a Slack bot built using the @slack/bolt framework and slack-block-builder package to handle interactive Slack messages. The bot is designed to streamline workflows, enhance communication, and provide interactive features within your Slack workspace.
- Interactive Modals and Blocks: Create dynamic and user-friendly interfaces using
slack-block-builder. - Event Handling: Respond to messages, commands, and other Slack events seamlessly.
- Custom Commands: Implement custom slash commands to meet your team's specific needs.
- Live Development: Utilize
nodemonfor hot-reloading during development. - Consistent Code Style: Use
prettierfor automatic code formatting.
Ensure you have the following installed:
- Node.js (v20.18.0 or higher)
- yarn (v1.22.22 or higher) or yarn
-
Clone the repository:
git clone https://github.com/mostopalove/slack-bot-node.git cd slack-bot-node -
Install dependencies:
npm install # or yarn install -
Create a
.envfile in the root directory with the following variables:SLACK_BOT_TOKEN=<your-slack-bot-token> SLACK_SIGNING_SECRET=<your-slack-signing-secret> SLACK_APP_TOKEN=<your-slack-app-token>
Replace
<your-slack-bot-token>,<your-slack-app-token>and<your-slack-signing-secret>with your Slack app credentials. -
Start the development server:
yarn develop
This will use
nodemonto restart the server on file changes.
For deployment, ensure you set the environment variables in your hosting environment and use:
yarn startyarn develop: Start the bot in development mode withnodemon.yarn code:format: Format code usingprettier.
- Add the bot to your Slack workspace.
- Interact with the bot using commands or events defined in the code.
- Customize the bot's behavior by modifying the event listeners and handlers.
.
├── src/
│ ├── listeners/ # Contains event listeners for Slack interactions
│ │ ├── actions/ # Handlers for button clicks, menu selections, etc.
│ │ ├── commands/ # Custom slash command handlers
│ │ └── views/ # Handlers for views and modals
│ ├── user-interface/ # Contains user interface components
│ │ └── modals/ # Definitions for Slack modals
│ ├── utils/ # Utility functions and helpers
│ └── app.js # Main entry point for initializing and running the Slack app
├── .env # Environment variables
├── .prettierignore # Files and directories ignored by Prettier
├── .prettierrc # Prettier configuration
├── package.json # Project metadata and dependencies
└── README.md # Project documentation
- @slack/bolt - Slack app framework
- slack-block-builder - Helper library for Slack Block Kit
- nodemon - Development tool for automatic server restarts
- prettier - Code formatter
Feel free to submit issues or pull requests for any bugs or enhancements.
This project is licensed under the MIT License. See the LICENSE file for details.
- Ensure the bot has proper permissions within your Slack app configuration.
- Refer to the Slack API documentation for additional resources and features.