Plus Bot is a slack bot that allows you to give kudos and sparkles to folks. No real world value, just good vibes ✨
![Showing plusbot: /++ great job on that presentation @ljacks! PlusBot: Rock on @ljacks!](https://private-user-images.githubusercontent.com/8128188/344737280-bd2da145-2684-4876-844c-ff23ac308ae8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTc0NDUsIm5iZiI6MTczOTkxNzE0NSwicGF0aCI6Ii84MTI4MTg4LzM0NDczNzI4MC1iZDJkYTE0NS0yNjg0LTQ4NzYtODQ0Yy1mZjIzYWMzMDhhZTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMThUMjIxOTA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjRlYmVjNzA0OWU1YTE3YjMwOGMwZjhjOTg3YmNmYTI4ODlhZWEwMGE2NGU0ODBkNGZmZGIxMTU4YjBhNTQ4ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.SQCjpmcWffqYX3MN-JL9cHlS_NvqBFXoY5oHtXa1K5I)
![/++ @ljacks @linzjax Amazing work team! PlusBot: High five @ljacks! Keep it up @linzjax!](https://private-user-images.githubusercontent.com/8128188/344740469-e030c53c-605b-4c75-b505-8dd413b80c3f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTc0NDUsIm5iZiI6MTczOTkxNzE0NSwicGF0aCI6Ii84MTI4MTg4LzM0NDc0MDQ2OS1lMDMwYzUzYy02MDViLTRjNzUtYjUwNS04ZGQ0MTNiODBjM2YucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMThUMjIxOTA1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTYxNzU1YjkxNDgyNmYzMDI4NTI0OTYzNmZhMzU5ODQ1NzhmYzA1OTMwYjMzNDYxMTYzMGZkYzcxMWUwNGQ3YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ._hCGbgj0_uq_DTTHOhLyphkcbrLalCIb4XCx-7JSelo)
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