I have too many slack workspaces that all need to be in sync for my status, so, here is a status updater. Slack is a bit of a pain, in that you need to create an app for each workspace account, but, once you get over that hill, life is good!
Once setup, you can just call your script with python and an argument, and poof, your status is up-to-date!
python status.py lunch
and bam!
- Head to https://api.slack.com/apps
- Click "Create a New App"
- Select "From Scratch"
- On the left menu, find "OAuth & Permissions" and hit that
- Scroll down to scopes and Add an OAuth Scope under the "User Token Scopes", here you need
users.profile:write
- For Presence changes you'll also need to add
users:write
- At the top of this page you can install your app to the workspace
- Copy the User OAuth Token (starting in
xoxp-
) into your.env
file (see.env.sample
)
For me this looks like:
pyenv virtualenv 3.12 slack
pyenv activate slack
pip install -r requirements.txt
To make sure you've set things up without updating your status, you can clear your active status with:
python status.py clear
alias brb="<PATH TO PYTHON>/python <PATH TO REPO>/status.py brb"
alias slack_clear="<PATH TO PYTHON>/python <PATH TO REPO>/status.py clear"
alias lunch="<PATH TO PYTHON>/python <PATH TO REPO>/status.py lunch"
python status.py clear
will clear your statuspython status.py brb
will set you to BRB for 15 minutespython status.py lunch
will set your status to "Lunch Time" for 60 minutes and use a random food-based emoji- Lastly you can provide a custom status, emoji and duration for your own status-based flair! For example:
python status.py custom --message "Taking the kids to Soccer" --emoji ":soccer:" --time 120