Plus Bot is a slack bot that allows you to give kudos and sparkles to folks. No real world value, just good vibes ✨
Use the /++
command to indicate that this is a plusbot command. After that tag as many users as you'd like and let others know what a good job they did! Then let the sparkles flow.
/++ @user hey good job!
// plusbot will respond with a good job message
/++ Happy birthday @user!
// plusbot will respond with a happy birthday message.
Currently you can clone this repo, update the emoji's and personal messages to whatever best fits your organization. From there you can deploy it to a Cloudflare worker, and set up your own custom Slackbot.
- Clone the repo
Create two new cloudflare workers
- plusbot
- plusbot-dev (If you're doing active development, I'd suggest creating a separate slack where you can test out features.)
- Go to permissions and install in your workspace
- Add a new redirect url that matches the cloudflare worker:
https://plusbot.[your-user-name].workers.dev/authorize
- Give it bot token scopes [chat:write, commands]
- Go to Slash Commands and add
/++
as a new command. - Give it a fun picture and description if you want!
- Go back into your cloudflare workers and add the variables found in env.example.
Note: All of the values in ### CUSTOMIZATIONS #### can be changed to whatever makes sense for you and your organization! Pick emojis that your company uses frequently, use kudos messages that makes sense for your vibe, go wild.
- There's information in env.example for where to find the Slack variables that are needed.
Note: All the slack variables should be Encrypted in cloudflare.
# for your dev environment:
npm run deploy-dev
# for deploying to prod:
npm run deploy
You can read if you want, but these were mostly for me :)
{
token: <token>,
team_id: <id of the slack team>,
team_domain: 'lindseysappfactory',
channel_id: <id of the slack channel>,
channel_name: 'random',
user_id: <user id>,
user_name: 'linzjax',
command: '/++',
text: '<@<user_id>|ljacks>',
api_app_id: <api app id>,
is_enterprise_install: 'false',
response_url: <where to post the response to>,
trigger_id: <trigger id string>
}
- Add companies if they don't exist
- Print out a help message if there's no user tagged in the message
- Provide a "list" option
- Add unit tests
- Clean up code
- Set up OAuth
- Prevent users from giving themselves plusses
- Rename "companies" "teams" to match slacks lingo
Things that I've learned along the way:
- @slack/web-api uses axios, which is incompatable with cloudflare workers.
- worktop, though convenient, does not use traditional request objects, so standard operations like
.clone()
are not available, making it incompatable with @sagi.io/workers-slack 'sverifyRequestSignature
function. - Itty-router only parses requests that come in with application/json. Slack sends application/x-www-form-urlencoded