Last active
June 5, 2018 12:47
-
-
Save AGresvig/ff269904abdb7826be9f54c9ab4d7d71 to your computer and use it in GitHub Desktop.
A command line utility for changing your Slack status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: slackstatus "My new status" | |
function slackstatus() { | |
slacktoken=$SLACK_OAUTH_TOKEN | |
apiurl="https://slack.com/api/users.profile.set?token="$slacktoken"&profile=" | |
emoji=":mag:" | |
if [ $# -eq 0 ] | |
then | |
status="" | |
emoji="" | |
else | |
status="$@" | |
fi | |
curl --silent --data-urlencode "profile={\"status_text\":\"$status\",\"status_emoji\": \"$emoji\"}" $apiurl > /dev/null | |
echo "Status changed to $status" | |
} | |
export -f slackstatus > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to @samervin for inspiration.
This script uses Slack API to change status (https://api.slack.com/docs/presence-and-status). I use it to set my status to "Focusing" when I start a pomodoro-like app called Focus on my Mac.
To set this up.
You'll need to set your last name, as well as get a token from https://api.slack.com/docs/oauth-test-tokens
To use, type slackstatus . To reset your status (to just your last name), just type slackstatus with no arguments.