Skip to content

Instantly share code, notes, and snippets.

@stigi
Created March 25, 2020 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stigi/5326aa6d1c74308565e3d75a1495a7fc to your computer and use it in GitHub Desktop.
Save stigi/5326aa6d1c74308565e3d75a1495a7fc to your computer and use it in GitHub Desktop.
Update your Slack status from the command line for Pomodoro
#!/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