Automatically update Slack status emoji with your current Mac application/url
Launch a plist that checks the frontmost app/webpage every 15s, associates it with an emoji, and sends it off via Slack's status API... optionally also set Slack away/auto presence when locked
- First things first: ensure your Slack team has the perfect emoji for apps/sites you care about. Slack has great instructions here
- Next, you're going to need a Slack user API token.
Go here and request one from your slack administrators.Alas; much has changed in the Slack world, and they now want you to create a Slack app with a user scope. That's a bit beyond this humble readme, but suffice it to say that you can create an 'internal' Slack app with the following User Token Scope:users.profile:write
. Once installed to your workspace, it will generate a 'User OAuth Token' (xoxp-...
) to use.
ps. Keep this token secret - though the scope is limited to your account, it can post status updates as you!!
Whether you fork/clone, copy/paste, or hand-type, you'll want a copy of this script locally on your Mac.
You might:
curl -o /usr/local/bin/slack-autostatus https://raw.githubusercontent.com/benpbolton/slack-autostatus/master/slack-autostatus
chmod +x /usr/local/bin/slack-autostatus
... but regardless of your approach, you'll want the file to be executable
ps. Edit this file to add/remove applications/urls/emoji/etc
Steady yourself: this is the final step
- curl down the sample plist file:
curl -o ~/Library/LaunchAgents/slack-autostatus.plist https://raw.githubusercontent.com/benpbolton/slack-autostatus/master/slack-autostatus.plist
-
Make the following two (or three) edits to the file:
- Change
PUT_IT_HERE!!!
to your Slack user token from above - (If needed) Change
/usr/local/bin/slack-autostatus
to the location you saved the slack-autostatus script - If you want the script to also update your slack presence (away/auto) based on whether your laptop is locked:
- uncomment the
SET_PRESENCE
environmental variable - in a terminal, install the Quartz dependency with a
pip install pyobjc-framework-Quartz
(orpip3
if you're using Python 3)
- uncomment the
- Change
-
Load the plist up:
launchctl load -w ~/Library/LaunchAgents/slack-autostatus.plist
- 🎉