Skip to content

Instantly share code, notes, and snippets.

@davidvasandani
Created March 24, 2018 15:32
Show Gist options
  • Save davidvasandani/5f638c57b49447d0389b6800a581d841 to your computer and use it in GitHub Desktop.
Save davidvasandani/5f638c57b49447d0389b6800a581d841 to your computer and use it in GitHub Desktop.
Custom Slack Away Messages
export SLACK_CLI_TOKEN='####'
alias dog_slack="/usr/bin/curl -s -X POST \
https://slack.com/api/users.profile.set \
--data-urlencode 'profile={\"status_text\":\"walking the dogs\", \"status_emoji\":\":dog2:\"}' \
--data-urlencode 'token=$SLACK_CLI_TOKEN' | jq '.profile.status_text'"
alias lunch_slack="/usr/bin/curl -s -X POST \
https://slack.com/api/users.profile.set \
--data-urlencode 'profile={\"status_text\":\"getting lunch\", \"status_emoji\":\":taco:\"}' \
--data-urlencode 'token=$SLACK_CLI_TOKEN' | jq '.profile.status_text'"
alias empty_slack="/usr/bin/curl -s -X POST \
https://slack.com/api/users.profile.set \
--data-urlencode 'profile={\"status_text\":\"\", \"status_emoji\":\"\"}' \
--data-urlencode 'token=$SLACK_CLI_TOKEN' | jq '.profile.status_text'"
alias away_slack="/usr/bin/curl -s -X POST \
https://slack.com/api/users.setPresence \
--data-urlencode 'presence=away' \
--data-urlencode 'token=$SLACK_CLI_TOKEN' | jq '.ok'"
alias back_slack="/usr/bin/curl -s -X POST \
https://slack.com/api/users.setPresence \
--data-urlencode 'presence=auto' \
--data-urlencode 'token=$SLACK_CLI_TOKEN' | jq '.ok'"
alias dog='dog_slack; away_slack'
alias lunch='lunch_slack; away_slack'
alias back='empty_slack; back_slack'
alias away='empty_slack; away_slack'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment