Rusi:
btw, I am thinking about adding a bot to help me set my slack status easier... something to help with the whole WFH situation 😕
I want to have pre-defined statuses, like ":hamburger: ...lunch" and ":afk: away from the keyboard", and others
and that would be easy to trigger with
/status lunchor/status afkor/status clear...
actually that exists 😄
it is not as nice as a one word status msg... but it's usable 🙂
Me:
So what you want is actually pre-defined status messages that may be activated with a shortcut/keyword?
Rusi:
yes, and maybe some other functions similar to slack's workflows - say I set my status with
/status lunch- maybe after an hour, a message will popup with a button - "are you back" or something like that
or I can have
/status meeting 30to set a 30 minute meeting status message
the idea is that you should be able to see my slack status, and know what's going on - similar to when we are in the office together - you can just look at my desk and see me working, or having a meeting, or eating, or not being there 😄
TL;DR
/rustat help
/rustat add <key> <message>
/rustat remove <key>
/rustat list
/rusi <key> [<expiry>]
/rusi clear
Welcome to ✨The Rustat Hristov Slack bot✨!
A "rustat" is a predefined ✨fancy status message✨.
It can also mean "R. U. status", that is, "Are you ?", like "Are youNOPE.lunch?"
/rustat help-- Print this help textManage your rustats
/rustat add <key> <message>-- Save a rustat with the shortcut keyword<key>; if<message>starts with an emoji, that emoji will be used as status emoji
/rustat remove <key>-- Deletes a rustat with the shortcut keyword ><key>
/rustat list-- List all saved rustatsSet your status message
/rusi <key> [<expiry>]-- Activate the rustat with the shortcut keyword<key>that will (optionally) automatically be cleared by<expiry> (in human language!>); e.g./rusi lunch,/rusi sleep until 10pm,/rusi meeting for 30 minutesor/rusi call until 2am EST
/rusi clear-- Clear your current status message (whether it's a > rustat or not)
Requires:
- NodeJS 12.x
- Serverless Framework
npm i -g serverless
- ngrok
- On macOS, with Homebrew:
brew install ngrok
- On macOS, with Homebrew:
- a Slack app -- follow the initial setup here: https://slack.dev/bolt/tutorial/getting-started
- Additional steps
- Create slash commands for
/rustatand/rusi - Set OAuth redirect URL
- Create slash commands for
- Additional steps
Create .env then set the environment variables with values taken from your Slack app
- supports
.env.<sls env>where<sls env>is the value used in theserverlesscommand invoked - e.g.
.env.devforsls deploy --env dev
cp example.env .envInstall app dependencies
npm i
sls dynamodb installRun ngrok
ngrok http 3000Copy the ngrok URL and paste it into:
.envforSLACK_REDIRECT_URL- the Slack app's configured slash commands and OAuth redirect URL
Start serverless-offline
- this watches for changes in the TypeScript source code and automatically rebuilds
- however, it does not watch for .env changes -- you need to restart in that case
- also, somehow, serverless-offline buries all console.log output ¯_(ツ)_/¯
- the alternative is to run Slack Bolt locally as well, but that also is another PITA because it doesn't watch for local changes
npm run start:offlineSlack workspace installations
| Entity | Hash | Range |
|---|---|---|
installation |
PK#<enterprise_id>#<team_id> |
#SK#<user_id> |
| Entity | Hash | Range | Other attributes |
|---|---|---|---|
rustat |
rustat#<username> |
#key#<username>#<key> |
key, message |
Ref: https://aws.amazon.com/getting-started/projects/design-a-database-for-a-mobile-app-with-dynamodb/4/