
If you've ever needed to interact with Slack programmatically—whether for automation, AI agents, or just quick terminal access—you know the friction: switching between browser/desktop app, creating Slack apps, managing OAuth tokens. **SlackCLI** solves this by bringing Slack directly to your command line.

## The Problem: Context Switching Kills Productivity

Imagine you're working in your terminal and need to:
- Check messages from a specific channel
- Send a quick update to your team
- Extract thread timestamps to reply programmatically
- Integrate Slack with your automation scripts

The traditional flow? Open Slack app → find channel → copy/paste → switch back. Repeat endlessly.

For developers building automation or AI agents that need Slack context, it's even worse: create a Slack app, configure OAuth scopes, install, manage tokens, handle permissions...

**SlackCLI eliminates all this friction.**

## What is SlackCLI?

SlackCLI is a fast, open-source command-line interface tool that lets you interact with Slack workspaces directly from your terminal. Built with TypeScript and [Bun](https://bun.sh), it's designed for:

- 🤖 **AI Assistants** - Provide AI agents with Slack context and interaction capabilities
- 🔧 **Automation Engineers** - Script workflows that integrate with Slack
- 💻 **Developers** - Quick CLI access without switching to browser/desktop app
- 📊 **Data Engineers** - Extract Slack data for processing and analysis

## Why SlackCLI? Key Benefits

### 1. Dual Authentication: Choose Your Style

**Standard Tokens (Production)**
- Use official Slack app tokens (xoxb/xoxp)
- Recommended for team deployments
- Long-term, stable authentication

**Browser Tokens (Quick Start)**
- Extract tokens from your browser session (xoxd/xoxc)
- No Slack app creation required
- Perfect for personal automation
- Uses your existing user permissions

[Learn how to extract browser tokens](https://shaharia.com/blog/slack-browser-tokens-golang-sdk-bypass-app-creation/)

### 2. Multi-Workspace Management

Work with multiple Slack workspaces seamlessly:

```bash
# List all authenticated workspaces
slackcli auth list

# Switch between workspaces
slackcli conversations list --workspace="Work Team"
slackcli conversations list --workspace="Side Project"
```

### 3. JSON Output for Automation

Need to integrate with scripts or AI agents? Get structured JSON output with thread timestamps:

```bash
# Get JSON with thread timestamps for replies
slackcli conversations read C1234567890 --json

# Output includes ts and thread_ts for programmatic replies
{
  "messages": [
    {
      "ts": "1762709049.367939",
      "thread_ts": "1762709049.367939",
      "text": "Message content",
      "user": "U1234567"
    }
  ]
}
```

### 4. Fast & Lightweight

Built with Bun, SlackCLI starts in < 100ms. Single binary distribution—no dependencies to install.

## How It Works

```mermaid
graph LR
    A[User/AI Agent] -->|Commands| B[SlackCLI]
    B -->|Browser Tokens| C[Slack API]
    B -->|Standard Tokens| C
    C -->|JSON/Text| B
    B -->|Formatted Output| A
    
    D[Multiple Workspaces] -->|Stored| E[~/.config/slackcli/]
    B -->|Reads| E
```

SlackCLI acts as a bridge between your terminal (or automation scripts) and Slack's API, supporting both authentication methods and managing multiple workspace credentials securely.

## Getting Started

### Installation

**Linux/macOS:**
```bash
# Download and install
curl -L https://github.com/shaharia-lab/slackcli/releases/latest/download/slackcli-linux -o slackcli
chmod +x slackcli
mkdir -p ~/.local/bin && mv slackcli ~/.local/bin/

# Verify installation
slackcli --version
```

**Windows:**
Download `slackcli-windows.exe` from the [latest release](https://github.com/shaharia-lab/slackcli/releases/latest).

### Quick Start: Browser Token Authentication

The fastest way to get started (no Slack app needed):

```bash
# 1. Extract tokens from your browser (see guide in README)
slackcli auth extract-tokens

# 2. Login with extracted tokens
slackcli auth login-browser \
  --xoxd="xoxd-YOUR-TOKEN" \
  --xoxc="xoxc-YOUR-TOKEN" \
  --workspace-url="https://yourteam.slack.com"

# 3. Start using SlackCLI!
slackcli conversations list
```

## Common Use Cases

### 1. AI Agents Reading Slack Context

```bash
# AI agent fetches recent team discussions
slackcli conversations read C1234567890 --limit=50 --json | \
  jq -r '.messages[].text' | \
  ai-agent process
```

### 2. Automated Status Updates

```bash
#!/bin/bash
# Send deployment notification
slackcli messages send \
  --recipient-id=C1234567890 \
  --message="🚀 Deployment v2.1.0 completed successfully"
```

### 3. Thread Monitoring & Replies

```bash
# Get thread timestamp
THREAD_TS=$(slackcli conversations read C1234567890 --json | \
  jq -r '.messages[0].ts')

# Reply to the thread
slackcli messages send \
  --recipient-id=C1234567890 \
  --thread-ts="$THREAD_TS" \
  --message="Acknowledged!"
```

### 4. Data Extraction for Analysis

```bash
# Export channel messages to JSON
slackcli conversations read C1234567890 --limit=1000 --json > messages.json

# Process with any data tool
cat messages.json | jq '.messages[] | select(.user == "U1234567")'
```

## Core Features

### Authentication Management
```bash
slackcli auth login              # Standard tokens
slackcli auth login-browser      # Browser tokens
slackcli auth list               # List workspaces
slackcli auth set-default T123   # Set default workspace
```

### Conversation Commands
```bash
slackcli conversations list                    # List all channels/DMs
slackcli conversations list --types=im         # List only DMs
slackcli conversations read C123               # Read messages
slackcli conversations read C123 --json        # Get JSON output
```

### Message Commands
```bash
slackcli messages send --recipient-id=C123 --message="Hello!"
slackcli messages send --recipient-id=U456 --message="DM"
slackcli messages send --recipient-id=C123 --thread-ts="123.456" --message="Reply"
```

### Auto-Update
```bash
slackcli update check    # Check for updates
slackcli update          # Install latest version
```

## Security & Privacy

- **Credentials stored locally**: `~/.config/slackcli/` with 0600 permissions
- **No telemetry**: Your data stays on your machine
- **Open source**: Audit the code on [GitHub](https://github.com/shaharia-lab/slackcli)
- **Browser tokens expire**: Use standard tokens for production

## Real-World Example: AI Assistant Integration

Here's how you can use SlackCLI with AI assistants like Claude, ChatGPT, or any AI agent with terminal access:

**Example Prompt to AI:**

> "Using SlackCLI, read the last 50 messages from our #engineering channel (ID: C1234567890), 
> summarize the key discussion points, identify any action items mentioned, and draft a response 
> to the thread with timestamp 1762709049.367939 acknowledging the tasks and providing an ETA."

**What the AI Assistant Does:**

1. Executes: `slackcli conversations read C1234567890 --limit=50 --json`
2. Parses the JSON output to understand context
3. Analyzes messages to extract key points and action items
4. Drafts a response message
5. Executes: `slackcli messages send --recipient-id=C1234567890 --thread-ts=1762709049.367939 --message="[AI-generated response]"`

**Another Example - Daily Standup Summary:**

> "Check our #team-standup channel for today's updates, create a summary of what each team member 
> is working on, any blockers mentioned, and send it to the #management channel."

The AI reads messages, processes them, and sends the summary—all through SlackCLI commands.

## Technical Architecture

**Built With:**
- **Runtime**: Bun v1.x (fast JavaScript runtime)
- **Language**: TypeScript (type-safe)
- **CLI Framework**: Commander.js
- **Slack SDK**: @slack/web-api + custom HTTP client for browser tokens

**Distribution:**
- Single compiled binary per platform
- No Node.js or dependencies required
- Binary size: ~100MB (includes Bun runtime)

## Roadmap

Current version: **v0.1.1**

**Coming Soon:**
- File upload/download support
- Reaction management
- User and channel search
- Interactive REPL mode
- Shell completion (bash, zsh, fish)
- MCP (Model Context Protocol) server mode

## Get Started Today

**GitHub Repository**: https://github.com/shaharia-lab/slackcli

**Documentation**: Full guide with examples in the [README](https://github.com/shaharia-lab/slackcli#readme)

**Installation**: Pre-built binaries for Linux, macOS, Windows

**License**: MIT (open source)

## Conclusion

SlackCLI brings Slack to your terminal, making it accessible for automation, AI agents, and developers who prefer command-line interfaces. Whether you're building an AI assistant that needs Slack context, automating team notifications, or just want quick terminal access to Slack, SlackCLI eliminates the friction.

The dual authentication support means you can start immediately with browser tokens for personal use, or deploy with standard tokens for production. Multi-workspace management, JSON output, and fast performance make it a powerful tool for modern development workflows.

Try it today and streamline your Slack interactions!

---

**Resources:**
- [SlackCLI on GitHub](https://github.com/shaharia-lab/slackcli)
- [Browser Token Guide](https://shaharia.com/blog/slack-browser-tokens-golang-sdk-bypass-app-creation/)
- [Latest Release](https://github.com/shaharia-lab/slackcli/releases/latest)

Have questions or suggestions? Open an issue on [GitHub](https://github.com/shaharia-lab/slackcli/issues)!

