Skip to content

Instantly share code, notes, and snippets.

@xiii
Created April 19, 2017 09:09
Show Gist options
  • Save xiii/b29bd784d1e333144e249be0b3967f03 to your computer and use it in GitHub Desktop.
Save xiii/b29bd784d1e333144e249be0b3967f03 to your computer and use it in GitHub Desktop.
Shell function to update slack status
#
# I have this in my .zshrc and I call it from the terminal. Make sure you replace the SLACK_TOKEN part.
# $ slack-status afk train
#
function slack-status {
local SLACK_TOKEN=""
local STATUS=${1:-""}
local EMOJI=${2:-"itv"}
local DATA='{"status_text":"'$STATUS'","status_emoji":":'$EMOJI':"}'
curl -s -o /dev/null https://slack.com/api/users.profile.set -X POST -H "Content-type: application/x-www-form-urlencoded" -d "token=${SLACK_TOKEN}&profile=$DATA"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment