these are a few simple slack scripts to do things from the command-line, like set status and presence with one command.
-
get an API token from https://api.slack.com/custom-integrations/legacy-tokens
-
make sure you have some basic utils installed:
- curl
- jq
- urlencode
-
set some environment variables (
SLACK_API_TOKEN
is required for all operations, the others will be used by theslack.in.sh
script):export SLACK_DEFAULT_EMOJI=house_with_garden export SLACK_DEFAULT_STATUS="working from home" export SLACK_API_TOKEN="xxxx-xxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxx"
# set presence to auto, and status to your configured default emoji and message
slack.in.sh
# set presence to away
slack.out.sh
# set your status to :fire: "on a roll"
slack.status.sh fire on a roll
# set presence to away, and status status to "lunch" and the emoji (pizza if not specified)
slack.lunch.sh [emoji]
# post the message "this is the message" to #foo
slack.post.sh foo this is the message
auth tokens only work with one team, and you need to switch the environment variable to post to another team.