You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A command-line tool for sending messages to Slack using the Slack API.
This project is a fork of urugus/slack-cli, with additional features and modifications.
Disclaimer: This is an unofficial tool and is not affiliated with, endorsed by, or sponsored by Slack Technologies, LLC. "Slack" is a trademark of Slack Technologies, LLC.
Installation
npm install -g @mimo-3/slack-cli
By default, when you run commands, the CLI will show an update notification if a new npm release is available. To disable this, set SLACK_CLI_DISABLE_UPDATE_NOTIFIER=1.
Configuration
You need to configure your Slack API token on first use:
Tokens are encrypted with AES-256-GCM before being written to disk.
A local master key is created at ~/.slack-cli-secrets/master.key with owner-only permissions.
Existing ~/.slack-cli/master.key files are migrated automatically on first use.
For ephemeral environments, you can supply SLACK_CLI_MASTER_KEY to override the local key.
Legacy v0.x configs: tokens stored before v0.20 used a fixed key derived from a hard-coded
string. They are upgraded to AES-256-GCM the first time a v0.20+ release reads them, but old
backups taken before that upgrade can be decrypted by anyone with access to the source code.
Discard any pre-0.20 backups after a successful upgrade. See SECURITY.md for
details.
Trust boundary for file inputs:
--file/-f (e.g. slack-cli upload -f ./report.csv) and --blocks-file read paths with the
privileges of the invoking user. Do not pass untrusted paths from external systems; the CLI does
not sandbox or restrict the readable directory.
Usage
Managing Multiple Workspaces (Profiles)
# Set tokens for different workspacesprintf'%s\n'"$WORK_SLACK_TOKEN"| slack-cli config set --profile work --token-stdin
printf'%s\n'"$PERSONAL_SLACK_TOKEN"| slack-cli config set --profile personal --token-stdin
# Show all profiles
slack-cli config profiles
# Switch default profile
slack-cli config use work
# Show current active profile
slack-cli config current
# Show configuration for specific profile
slack-cli config get --profile personal
# Clear specific profile
slack-cli config clear --profile work
Sending Messages
# Basic usage (uses default profile)
slack-cli send -c channel-name -m "Your message here"# Using specific profile
slack-cli send -c channel-name -m "Your message here" --profile personal
# Using channel ID
slack-cli send -c C1234567890 -m "Your message here"# Multi-line message
slack-cli send -c general -m "Line 1\nLine 2\nLine 3"# Send message from file
slack-cli send -c random -f message.txt
# Reply to a thread
slack-cli send -c channel-name -m "Reply message" --thread 1719207629.000100
# Reply to a thread (short option)
slack-cli send -c channel-name -m "Reply message" -t 1719207629.000100
# Schedule by absolute time (Unix seconds or ISO 8601)
slack-cli send -c channel-name -m "Scheduled message" --at "2026-03-01T09:00:00Z"# Schedule after N minutes
slack-cli send -c channel-name -m "Scheduled message" --after 30
# Send DM by username
slack-cli send --user @john -m "Hello via DM!"# Send DM by email
slack-cli send --email john@example.com -m "Hello via DM!"# Send a Block Kit message (inline JSON)
slack-cli send -c general --blocks '[{"type":"section","text":{"type":"mrkdwn","text":"*Release shipped* :tada:"}}]'# Send a Block Kit message from file
slack-cli send -c general --blocks-file ./blocks.json
List Channels
# List all channels (uses default profile)
slack-cli channels
# List channels from specific profile
slack-cli channels --profile work
# List public channels only
slack-cli channels --type public
# List private channels only
slack-cli channels --type private
# List all channel types including IMs and MPIMs
slack-cli channels --type all
# Include archived channels
slack-cli channels --include-archived
# Limit number of channels displayed
slack-cli channels --limit 20
# Output in different formats
slack-cli channels --format json
slack-cli channels --format simple
Channel Info & Management
# Display channel details (topic, purpose, members, etc.)
slack-cli channel info -c general
# Output channel info in different formats
slack-cli channel info -c general --format json
slack-cli channel info -c general --format simple
# Set channel topic
slack-cli channel set-topic -c general --topic "Current sprint: v2.0"# Set channel purpose
slack-cli channel set-purpose -c general --purpose "Project X development channel"
View Message History
# Get latest 10 messages (default)
slack-cli history -c general
# Specify number of messages
slack-cli history -c general -n 20
# Get messages since specific date
slack-cli history -c general --since "2024-01-01 00:00:00"# Get complete conversation of a thread
slack-cli history -c general --thread 1719207629.000100
# Output in different formats
slack-cli history -c general --format json
slack-cli history -c general --format simple
# Include permalink for each message
slack-cli history -c general --with-link
# Use specific profile
slack-cli history -c general --profile work
Get Unread Messages
# Get all unread messages across all channels
slack-cli unread
# Get unread messages from specific channel
slack-cli unread -c general
# Show only unread counts (no message content)
slack-cli unread --count-only
# Mark messages as read after fetching
slack-cli unread --mark-read
# Mark messages as read for specific channel
slack-cli unread -c general --mark-read
# Limit number of channels displayed
slack-cli unread --limit 10
# Output in different formats
slack-cli unread --format json
slack-cli unread --format simple
Search Messages
# Basic search
slack-cli search -q "deploy error"# Sort by timestamp (newest first)
slack-cli search -q "meeting" --sort timestamp
# Sort oldest first
slack-cli search -q "release" --sort timestamp --sort-dir asc
# Limit results per page
slack-cli search -q "bug fix" -n 50
# Paginate through results
slack-cli search -q "deploy" --page 2
# Use Slack search modifiers in query
slack-cli search -q "in:general from:@alice deploy"# Output in different formats
slack-cli search -q "error" --format json
slack-cli search -q "error" --format simple
# Use specific profile
slack-cli search -q "release" --profile work
Edit Messages
# Edit a sent message
slack-cli edit -c general --ts 1234567890.123456 -m "Updated message text"# Replace with Block Kit content (inline)
slack-cli edit -c general --ts 1234567890.123456 \
--blocks '[{"type":"section","text":{"type":"mrkdwn","text":"*Edited*"}}]'# Replace with Block Kit content from file
slack-cli edit -c general --ts 1234567890.123456 --blocks-file ./blocks.json
# Use specific profile
slack-cli edit -c general --ts 1234567890.123456 -m "Fixed typo" --profile work
Delete Messages
# Delete a message
slack-cli delete -c general --ts 1234567890.123456
# Use specific profile
slack-cli delete -c general --ts 1234567890.123456 --profile work
Upload Files
# Upload a file
slack-cli upload -c general -f ./report.csv
# Upload with title and initial comment
slack-cli upload -c general -f ./report.csv --title "Daily Report" -m "Here is the report"# Upload a text snippet
slack-cli upload -c general --content 'console.log("hello")' --filename snippet.js --filetype javascript
# Upload as a thread reply
slack-cli upload -c general -f ./logs.txt -t 1234567890.123456
# JSON output (returns file_id, permalink, etc. for scripting)
slack-cli upload -c general -f ./report.csv --format json
Channel Membership
# Join a channel
slack-cli join -c general
# Leave a channel
slack-cli leave -c general
# Invite one or more users to a channel
slack-cli invite -c general --user @alice
slack-cli invite -c general --user U01ABCDEF --user U01XYZDEF
# Tolerate invalid user IDs and continue inviting valid ones
slack-cli invite -c general --user U01ABCDEF --user invalid-id --force
# List members of a channel
slack-cli members -c general
slack-cli members -c general --limit 200 --format json
Ephemeral Messages
# Send an ephemeral message visible only to one user in a channel
slack-cli send-ephemeral -c general -u U01ABCDEF -m "Heads up: build is red"# Reply in a thread
slack-cli send-ephemeral -c general -u U01ABCDEF -m "FYI" -t 1719207629.000100
Reminders
# Create a reminder at an absolute time
slack-cli reminder create -m "Push the release" --at "2026-03-01 09:00"# Create a reminder after N minutes
slack-cli reminder create -m "Stretch break" --after 60
# List your reminders
slack-cli reminder list
slack-cli reminder list --format json
# Mark a reminder as complete
slack-cli reminder complete --id Rm12345678
# Delete a reminder
slack-cli reminder delete --id Rm12345678
Bookmarks (Save for Later)
# Save a message for later
slack-cli bookmark add -c general -t 1234567890.123456
# List saved items
slack-cli bookmark list
slack-cli bookmark list --limit 50 --format json
# Remove a saved item
slack-cli bookmark remove -c general -t 1234567890.123456
Reactions
# Add a reaction to a message
slack-cli reaction add -c general -t 1234567890.123456 -e thumbsup
# Remove a reaction from a message
slack-cli reaction remove -c general -t 1234567890.123456 -e thumbsup
Pins
# Pin a message
slack-cli pin add -c general -t 1234567890.123456
# Unpin a message
slack-cli pin remove -c general -t 1234567890.123456
# List pinned items in a channel
slack-cli pin list -c general
# Output in different formats
slack-cli pin list -c general --format json
slack-cli pin list -c general --format simple
Users
# List workspace users
slack-cli users list
# Limit number of users
slack-cli users list --limit 50
# Output in different formats
slack-cli users list --format json
slack-cli users list --format simple
# Get detailed info for a specific user
slack-cli users info --id U01ABCDEF
# Look up user by email address
slack-cli users lookup --email user@example.com
# Check user presence status (active/away)
slack-cli users presence --id U01ABCDEF
slack-cli users presence --name @alice --format json
# Use specific profile
slack-cli users list --profile work
Scheduled Messages
# List scheduled messages
slack-cli scheduled list
# Filter by channel
slack-cli scheduled list -c general
# Limit results
slack-cli scheduled list --limit 20
# Output in different formats
slack-cli scheduled list --format json
slack-cli scheduled list --format simple
# Cancel a scheduled message
slack-cli scheduled cancel -c general --id Q1298393284
Drafts
Drafts are stored locally in ~/.slack-cli/drafts.json (Slack does not expose a public API for drafts).
# Save a draft for a channel
slack-cli draft save -c general -m "Draft message"# Save a draft for a DM
slack-cli draft save --user alice -m "Draft DM"# Save a draft as a thread reply
slack-cli draft save -c general -m "Reply draft" -t 1234567890.123456
# List drafts
slack-cli draft list
slack-cli draft list --format json
# Show the full content of a draft
slack-cli draft show --id a1b2c3d4
# Send a draft (deleted after sending by default)
slack-cli draft send --id a1b2c3d4
# Send a draft but keep it
slack-cli draft send --id a1b2c3d4 --keep
# Delete a draft
slack-cli draft delete --id a1b2c3d4
Canvases
# Get sections of a Canvas
slack-cli canvas read -i F01234567890
# Output in different formats
slack-cli canvas read -i F01234567890 --format json
slack-cli canvas read -i F01234567890 --format simple
# List canvases linked to a channel
slack-cli canvas list -c general
# Output in different formats
slack-cli canvas list -c general --format json
slack-cli canvas list -c general --format simple
# Use specific profile
slack-cli canvas read -i F01234567890 --profile work
slack-cli canvas list -c general --profile work
Other Commands
# Show help
slack-cli --help
# Show version
slack-cli --version
# Show current configuration
slack-cli config get
# Update token for default profileprintf'%s\n'"$NEW_TOKEN"| slack-cli config set --token-stdin
Options
Global Options
Option
Short
Description
--profile
-p
Use specific workspace profile
send command
Option
Short
Description
--channel
-c
Target channel name or ID (one of --channel/--user/--email)
--user
Send DM to user by username
--email
Send DM to user by email address
--message
-m
Message to send
--file
-f
File containing message content
--blocks
-b
Block Kit JSON array (inline string)
--blocks-file
File containing Block Kit JSON array
--thread
-t
Thread timestamp to reply to
--at
Schedule time (Unix seconds or ISO 8601)
--after
Schedule message after N minutes
channels command
Option
Short
Description
--type
Channel type: public, private, im, mpim, all (default: public)