This is a Slackbot you can use to give and take karma to your colleagues.
@username ++: give 1 karma point to @username@username --: take 1 karma point from @username@username +++: give 2 karma points to @username@username ---: take 2 karma points from @username- etc.
After completing the setup instructions below, you will have the following .env file in your project for testing locally, and the same environment variables added on Vercel:
CHANNEL_ID=
SLACK_BOT_TOKEN=
SLACK_SIGNING_SECRET=
TURSO_AUTH_TOKEN=
TURSO_DATABASE_URL=Go to Slack API Apps Page:
- Create new App
- From Scratch
- Name your app & pick a workspace
- Go to OAuth & Permissions
- Scroll to scopes
- Add the following scopes
channels:history
- Click "Install to Workplace"
- Copy Bot User OAuth Token
- Add the token to Vercel's environment variables as
SLACK_BOT_TOKEN
- Getting signing secret
- Basic Information --> App Credentials --> Copy Signing Secret
- Add the secret to Vercel's environment variables as
SLACK_SIGNING_SECRET
After successfully deploying the app, go to Slack API Apps Page and select your app:
- Go to Event Subscriptions and enable events.
- Add the following URL to Request URL:
https://<your-vercel-app>.vercel.app/api/slack/events- Make sure the URL is verified, otherwise check out Vercel Logs for troubleshooting.
- Subscribe to bot events by adding:
message.channels
- Click Save Changes.
- Slack requires you to reinstall the app to apply the changes.
Use localtunnel to test out this project locally:
npm run devnpx localtunnel --port 3000Make sure to modify the subscription URL to the localtunnel URL.
turso auth login
turso db shell apogee-bot-dev < ./prisma/migrations/20241024201506_init/migration.sqlThis project uses Vitest for testing. To run the test suite, use:
npm test