Slack Location Manager
A command-line tool that sets your slack status for you depending on your location. Run the wizard to create a daily cron job, automating the process for the future.
The team at F1V works in different offices depending on the day. We let our team know who is at which office by setting our slack status (e.g. use the 'house' emoji when we're working from home). Once you install this script, this process will be automated by a daily cron job.
This was created for an internal use at F1V. If you're not part of the team and want to use this, you will need to create a Slack app your workspace and get a token from it.
How to Use
Globally install the package
npm install -g slack-location-manager
Run the install wizard
Important: A token will be required for first-time setup, see below How to get a Token
Test run the script
This is the command that cron will call daily. You can use this command to test setting your status.
This will remove the locally stored token and any related cron jobs from your machine
How it Works
- User is prompted for token and desired time of day to run script (prompts, chalk)
- Token is saved locally (node-persist)
- Cron job is created (node-crontab)
- Status emoji is calculated based on IP address location (ipinfo.io, geolib)
- Token is retrieved from local storage (node-persist)
- API call is made to Slack (node-slack-sdk, Slack Web API)
How to Get a Token
Note: you should only have to do this once. Once completed, everything is automated.
Click View App in your Slackbot message that was sent to you or click on Location Manager here (might have to sign in):
Click Install App to generate your token: