Created
March 25, 2020 17:09
-
-
Save stigi/5326aa6d1c74308565e3d75a1495a7fc to your computer and use it in GitHub Desktop.
Update your Slack status from the command line for Pomodoro
This file contains 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
#!/usr/bin/env bash | |
text=":tomato: focus time" | |
emoji=":tomato:" | |
expiration=`date +%s` | |
expiration=$((expiration + 1500)) | |
data=$( jq -n \ | |
--arg text "$text" \ | |
--arg emoji "$emoji" \ | |
--argjson expiration $expiration \ | |
'{profile: {status_text: $text, status_emoji: $emoji, status_expiration: $expiration}}' ) | |
curl --silent --fail --show-error --request POST \ | |
--url https://slack.com/api/users.profile.set \ | |
--header 'authorization: Bearer [YOUR-API-TOKEN-HERE]' \ | |
--header 'content-type: application/json' \ | |
--data "$data" --output /dev/null --write-out "%{http_code}" && echo " 🍅" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment