Skip to content

Latest commit

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Slack Status

Latest ReleaseLicense

Slacks is a command line utility for changing user profile status in Slack on one or more Workspaces at the same time.

This project is based on the mivok/slack_status_updater and it aims to improve the previous tool in the following aspects:

  • Support for multiple Workspaces: I usually have more than one Workspace at work and I need to update my status in all of them at the same time.
  • Set status duration: The ability to set a duration with the status is import in my daily activities.
  • Do not Disturb: Pause notifications is very helpful when you need to do a focused session.
  • Token stored using keyring: Slack application token is now stored using keyring for safety.

Quick start

Create a new Application in Slack:

  • Visit the following URL: api.slack.com/apps.
  • Click on Create New App on the top right corner.
  • Select the option From scratch.
  • Choose a name and the workspace you want to install the app.
  • After creating the app, navigate to OAuth & Permission using the left menu.
  • Under User Token Scopes add the followind scope permission.
    • users.profile:write
    • dnd:write
  • Using the left menu, select the Basic Information option.
  • Under Install you app click on Install.
  • Copy the generated token. This will be configured in the CLI later.

Setup Slacks CLI tool

After cloning the repository and adding the script to you $PATH variable. You can run the following command to setup your first Workspace.

# Provide the following information:
# - `WORKSPACE_NAME`: Can be anything.
# - `APP_TOKEN`: Token generated after creating app using https://api.slack.com/appsslacks workspace addEnter a name for your workspace: WORKSPACE_NAMEEnter the token for : APP_TOKEN

Changing the status

For setting your status using custom parameters using the set command.

# Set the status with a custom message and emoji with 5 minutes
# of duration.slacks set --status "My status" --emoji ":bomb:" --duration 5
# Use the --dnd flag to pause notifications while the status
# is active.slacks set --status "My focused status" --dnd
# Use --help command to see all the available optionsslacks set --help
ParameterDescriptionDefault
--status(Required) Status messageNone
--emoji(Optional) Status message emoji:speech_balloon:
--duration(Optional) Status duration in minutes. Value 0 means don't expire0
--dnd(Optional) Enable Do not Disturb. This will pause the notifications as long as the status is activeNone

Configuration

Presets

You can create and configure presets to quickly change the status. See the following example to create a new preset.

# Creating a new preset called `meeting`slacks preset addEnter a name for your status: meetingEnter a status text: Internal meetingEnter a status emoji. (Enter for default): :calendar:Enter a duration in minutes. (Enter for not expiring):Enable Do not Disturb? [y/N]: y
# Listing all presetsslacks preset listPRESET TEXT DURATION DnDbrb Be right back 30 falselunch Having lunch 60 falsemeeting Internal meeting No expiring true
# See all the options using the `--help` flag.slacks preset --help

See an example bellow for some useful presets.

Workspaces

You can add and edit your Workspaces using the CLI. Your status will be updated automatically on every workspace you have configured.

# Add a new Workspace. We need to have a generated token for each workspaceslacks workspace add
# For all the workspace commands, use the --help flag.slacks workspace --help

Useful presets

After running slacks workspace add for the first time, you should have a new config file created at $HOME/.slacks.conf. You can include your presets there, for example:

# Leave this line, it's handle automatically by Slacks.
WORKSPACES=[myworkspace]
# Append this presets to your config file
PRESET_EMOJI_brb=":brb:"
PRESET_TEXT_brb="Be right back"
PRESET_DUR_brb="30"
PRESET_EMOJI_lunch=":hamburger:"
PRESET_TEXT_lunch="Having lunch"
PRESET_DUR_lunch="60"
PRESET_EMOJI_meeting=":calendar:"
PRESET_TEXT_meeting="Internal meeting"
PRESET_DNR_meeting="true"
PRESET_EMOJI_focus=":floppy_disk:"
PRESET_TEXT_focus="Focused session"
PRESET_DUR_focus="60"
PRESET_DNR_focus="true"

Config file settings:

SettingDescription
WORKSPACESThis is automatically managed by Slacks
PRESET_EMOJI_xxxEmoji to be used in the preset
PRESET_TEXT_xxxStatus text
PRESET_DUR_xxx(Optional) Duration for expiring status in minutes
PRESET_DND_xxx(Optional) Enable Do not Disturb

About

Slacks is a command line utility for changing user profile status

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages