Slack chat bot running on Node, built using the Slack Bolt javascript framework
To run the bot locally, first clone the repo, then set the following environment variables:
- SLACK_BOT_TOKEN - this is found in the Slack API under OAuth & Permissions
- SLACK_SIGNING_SECRET - this is found in the Slack API under Signing Secret
- SLACK_APP_TOKEN - this is found in the Slack API under App-Level Tokens
On the terminal from the app's root directory once you have found the appropriate values, run:
export SLACK_BOT_TOKEN=xoxb-tokenvalue
export SLACK_SIGNING_SECRET=signingsecretvalue
export SLACK_APP_TOKEN=xapp-tokenvalue
On the terminal from the app's root directory once you have found the appropriate values, run:
set SLACK_BOT_TOKEN=xoxb-tokenvalue
set SLACK_SIGNING_SECRET=signingsecretvalue
set SLACK_APP_TOKEN=xapp-tokenvalue
It's recommended that you use VS Code during local development.This will let you use Prettier to keep formatting and syntax consistent when you save a file.
You can take advantage of a local development server (with hot reloading) to avoid restarting the app for every change:
# Don't use npm! Only use yarn: https://yarnpkg.com/en/
yarn install
yarn run dev
To add a new script/function to the bot, create a new script in the src/scripts
folder. Then, in src/app.ts
(at the bottom of the file), add a call to your new function to pass the app object into it.
Tests rely on Jest. Tests can be run with the following:
# Run all tests
yarn test
# Run tests for a file or directory (looks for partial Regex matches)
yarn test file-or-directory-name