Created
April 19, 2017 09:09
-
-
Save xiii/b29bd784d1e333144e249be0b3967f03 to your computer and use it in GitHub Desktop.
Shell function to update 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
# | |
# 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