Set Slack to away using legacy API tokens without the need to install apps or use webhooks. Once compiled to a binary, you can set up schedules to be away and auto (active) at specific times. Uses go which is cross-compatible with with Windows, Linux and macOS.
-
Log in to your Slack team (https://[TEAMNAME].slack.com/) and get your SLACK_API token by following the following steps:
-
Download releases
-
Set SLACK_API environment variables then restart the Terminals
-
Windows
setx SLACK_API "xoxs-....."
-
Linux
echo "export SLACK_API="xoxs-....."" >> ~/.bashrc
-
macOS
echo "export SLACK_API="xoxs-....."" >> ~/.zshrc
-
-
Test if it's working e.g.
./slackaway -s away
-
Set up tasks on Task Scheduler for Windows or cron jobs for Linux and macOS
git clone https://github.com/jimmy-ly00/slack-auto-away
go get -u -v github.com/akamensky/argparse
go build -o slackaway main.go
jly@JIMMY-LAPTOP:/mnt/c/Users/Jimmy/GitHub/slack-auto-away$ ./slackaway -h
usage: slack-auto-away [-h|--help] -s|--status (active|away)
Set a slack status
Arguments:
-h --help Print help information
-s --status Set a slack status
jly@JIMMY-LAPTOP:/mnt/c/Users/Jimmy/GitHub/slack-auto-away$ ./slackaway -s away
jly@JIMMY-LAPTOP:/mnt/c/Users/Jimmy/GitHub/slack-auto-away$ ./slackaway -s auto
Add two separate scheduled tasks. Weekdays sets auto (active) at 9:00am and sets away at 18:00.
C:\Users\Jimmy\>schtasks /create /sc weekly /D mon,tue,wed,thu,fri /tn "SlackAutoAway\auto" /tr "'c:\Google Drive\Misc\Scripts\slackaway-windows-amd64.exe' -s auto" /st 09:00
C:\Users\Jimmy\>schtasks /create /sc weekly /D mon,tue,wed,thu,fri /tn "SlackAutoAway\away" /tr "'c:\Google Drive\Misc\Scripts\slackaway-windows-amd64.exe' -s away" /st 18:00
Edit crontab to add two jobs. Weekdays sets auto (active) at 9:00am and sets away at 18:00.
jimmy@Jimmys-Mac ~/> crontab -e
0 9 * * 1-5 /bin/slackaway -s auto
0 18 * * 1-5 /bin/slackaway -s away
jimmy@Jimmys-Mac ~/> crontab -l
0 9 * * 1-5 /bin/slackaway -s auto
0 18 * * 1-5 /bin/slackaway -s away