{"id":43302883,"url":"https://github.com/kehao95/slack-agent-cli","last_synced_at":"2026-04-30T06:00:44.260Z","repository":{"id":335895893,"uuid":"1145505420","full_name":"kehao95/slack-agent-cli","owner":"kehao95","description":"Slack for non-humans™","archived":false,"fork":false,"pushed_at":"2026-04-28T02:39:27.000Z","size":7963,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-28T04:27:38.583Z","etag":null,"topics":["agent","cli","slack"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kehao95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-29T21:47:50.000Z","updated_at":"2026-04-28T02:39:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kehao95/slack-agent-cli","commit_stats":null,"previous_names":["kehao95/slack-agent-cli"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/kehao95/slack-agent-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kehao95%2Fslack-agent-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kehao95%2Fslack-agent-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kehao95%2Fslack-agent-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kehao95%2Fslack-agent-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kehao95","download_url":"https://codeload.github.com/kehao95/slack-agent-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kehao95%2Fslack-agent-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32456167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","cli","slack"],"created_at":"2026-02-01T20:08:51.268Z","updated_at":"2026-04-30T06:00:44.242Z","avatar_url":"https://github.com/kehao95.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slk\n\n\u003e **Slack for Non-Humans™**\n\n## Why \"Non-Humans\"?\n\nHumans have eyes, we have `jq`.  \nHumans need emojis, we need `thread_ts`.  \nHumans want a UI, we just want a clean pipe.  \n\n**This is not a CLI for you. This is a CLI for your digital entities.**\n\n---\n\n\u003e [!WARNING]\n\u003e Human, this tool defaults to JSON output. If your biological eyes find this hard to parse, use the `--human` flag. We recommend upgrading your optic nerve or using `jq`.\n\n## Features\n\n- **Pipe-First Design** - Output is always pure JSON (stdout) while logs go to stderr.\n- **Agent-Ready** - Stateless authentication, perfect for LLMs, scripts, and cron jobs.\n- **Smart Caching** - Resolves channel names (`#general`) to IDs (`C123...`) locally for speed.\n\n## Quick Start\n\n### For Digital Entities (Default)\n\n```bash\n# Get channel history as minified JSON\nslk messages list --channel C12345\n\n# Pipe directly into other tools\nslk messages list --channel \"#general\" | jq '.[].text'\n```\n\n### For Biological Entities\n\n```bash\n# Save your token to config\nslk auth login --token xoxp-your-token --verify\n\n# List channels in human-readable format\nslk channels list --human\n\n# List recent messages\nslk messages list --channel \"#general\" --limit 10 --human\n```\n\n## Installation\n\n### Homebrew (macOS/Linux)\n\n```bash\nbrew install kehao95/slack-agent-cli/slk\n```\n\n### Go Install\n\n```bash\ngo install github.com/kehao95/slack-agent-cli@latest\n```\n\n### Pre-built Binaries\n\nDownload from [GitHub Releases](https://github.com/kehao95/slack-agent-cli/releases)\n\n## Authentication \u0026 Configuration\n\n### How It Works\n\n**This CLI uses User Tokens** - It authenticates as **you** and acts on your behalf in Slack. This means:\n\n- **Acts as you:** Messages, reactions, and actions appear as if you did them\n- **Uses your permissions:** Can only access channels/DMs you have access to\n- **Simple \u0026 stateless:** No OAuth flows, webhooks, or server infrastructure needed\n- **Token security:** Keep your token safe - it has the same permissions you do\n\n**User Token** (what this CLI uses):\n- Format: `xoxp-...` \n- Represents **you** (the user)\n- Perfect for automation, scripts, and AI agents acting on your behalf\n\n**Bot Token** (NOT used by this CLI):\n- Format: `xoxb-...`\n- Represents a **bot user** (separate identity)\n- Requires more setup and different use cases\n\n### Quick Setup (1 minute)\n\n1. **Create Slack App:** Go to https://api.slack.com/apps → **\"Create New App\"** → **\"From an app manifest\"**\n2. **Choose mode \u0026 use manifest:**\n   - **Read-Only** (recommended): [`slack-app-manifest-readonly.yaml`](./slack-app-manifest-readonly.yaml)\n   - **Full Access:** [`slack-app-manifest-full.yaml`](./slack-app-manifest-full.yaml)\n3. **Install to workspace:** Click \"Install to Workspace\" and authorize\n4. **Copy token:** Copy the **User OAuth Token** (starts with `xoxp-`)\n5. **Configure:**\n   - **Option A (Recommended):** Run `slk auth login --token xoxp-... --verify`\n   - **Option B:** Set `export SLACK_USER_TOKEN='xoxp-...'`\n   - **Option C:** Use OAuth flow with `slk auth oauth` (see below)\n\n**See [SLACK_SETUP.md](./SLACK_SETUP.md) for detailed setup instructions and mode comparison.**\n\n### OAuth Flow (Alternative)\n\nFor automated token exchange, use the built-in OAuth server:\n\n```bash\nslk auth oauth --client-id $SLACK_CLIENT_ID --client-secret $SLACK_CLIENT_SECRET --save\n```\n\nThis starts a local server on port 8089 with a `/callback` endpoint. Expose it publicly (via your preferred method) and add the callback URL to your Slack app's redirect URIs. With `--save`, the token is automatically saved to config after successful exchange.\n\n## Available Commands\n\n```\nslk\n├── auth            # Authentication\n│   ├── login       # Save token to config\n│   ├── oauth       # Start OAuth callback server\n│   ├── test        # Verify credentials work\n│   └── whoami      # Show current user info\n│\n├── cache           # Cache management\n│   ├── populate    # Fetch and cache channels/users\n│   ├── status      # Show cache state\n│   └── clear       # Clear cached data\n│\n├── channels        # Channel operations\n│   ├── list        # List accessible channels\n│   ├── join        # Join a channel\n│   └── leave       # Leave a channel\n│\n├── messages        # Message operations\n│   ├── list        # Fetch message history\n│   ├── send        # Send a message\n│   ├── edit        # Edit a message\n│   ├── delete      # Delete a message\n│   ├── search      # Search messages\n│   └── next        # Wait for the next cached message event\n│\n├── events          # Event stream/cache operations\n│   ├── stream      # Stream Socket Mode events as NDJSON\n│   ├── list        # Query cached daemon events\n│   ├── next        # Wait for the next matching cached event\n│   ├── claim       # Claim one pending event for processing\n│   └── ack         # Acknowledge processed cursor\n│\n├── daemon          # Local event cache daemon\n│   ├── run         # Cache Socket Mode events into SQLite\n│   └── status      # Inspect local event cache status\n│\n├── reactions       # Reaction operations\n│   ├── add         # Add reaction to message\n│   ├── remove      # Remove reaction\n│   └── list        # List reactions on message\n│\n├── pins            # Pin operations\n│   ├── add         # Pin a message\n│   ├── remove      # Unpin a message\n│   └── list        # List pinned messages\n│\n├── users           # User operations\n│   ├── list        # List workspace members\n│   ├── info        # Get user details\n│   └── presence    # Check user presence\n│\n└── emoji           # Emoji operations\n    └── list        # List custom emoji\n```\n\n## Use Cases\n\n### The \"Pipeline\" Approach\n\n```bash\n# Summarize the last hour of #alerts using an LLM\nslk messages list --channel \"#alerts\" --since 1h | llm \"Summarize these alerts\"\n\n# Auto-reply to specific errors\nslk messages search --query \"error: deployment\" | \\\n  jq -r '.matches[].ts' | \\\n  xargs -I {} slk messages send --channel \"#ops\" --thread {} --mrkdwn \"Investigating...\"\n```\n\n### Agent Workflow Example\n\n```bash\n# 1. Check recent messages\nslk messages list --channel \"#support\" --since 1h\n\n# 2. Search for specific issues\nslk messages search --query \"error in:#support\"\n\n# 3. Send a response\nslk messages send --channel \"#support\" --thread \"$THREAD_TS\" --mrkdwn \"Here's the answer...\"\n\n# 4. Add acknowledgment reaction\nslk reactions add --channel \"#support\" --ts \"$MESSAGE_TS\" --emoji \"white_check_mark\"\n```\n\n### Event Stream Filtering\n\n```bash\n# Only wake downstream workers for message events from one channel\nslk events stream --channel \"#support\" --exclude-self --event-type message\n\n# Keep multiple event classes in one stream\nslk events stream --channel \"#support\" --event-type message,reaction_added\n\n# Also append each matching event to a local NDJSON file\nslk events stream --channel \"#support\" --event-type message -f /tmp/support.events.ndjson\n```\n\n### Daemon Event Loop Example\n\n```bash\n# Terminal/supervisor 1: cache visible Slack events for 24h by default\nSLACK_CLI_ROLE=bot slk daemon run --channel \"#_bot-testing\"\n\n# Agent loop (queue): claim top-level messages -\u003e process -\u003e ack\nwhile true; do\n  event=$(slk events claim --type message --message-kind root --channel \"#_bot-testing\" --lease 5m)\n  cursor=$(echo \"$event\" | jq -r '.cursor')\n  # ... process event ...\n  slk events ack \"$cursor\"\ndone\n\n# Thread replies can be claimed separately, which is useful for subagent handoff.\nslk events claim --type message --message-kind reply --thread \"$THREAD_TS\" --lease 5m\n\n# Only claim messages that explicitly mention the active Slack user.\nslk events claim --type message --mentions-me --lease 5m\n\n# If processing fails, do not ack; the lease expiry makes it claimable again.\n\n# Avoid reacting to the bot's own messages\nslk events claim --type message --exclude-self --lease 5m | jq -r '.cursor'\n```\n\n## Configuration\n\n### Config File Location\n\n```\n~/.config/slack-cli/config.json\n```\n\nOr override with `SLACK_CLI_CONFIG` environment variable.\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `SLACK_CLI_ROLE` | Active auth role: `user` or `bot` (default: `user`) |\n| `SLACK_USER_TOKEN` | Override user token from config |\n| `SLACK_BOT_TOKEN` | Override bot token from config |\n| `SLACK_APP_TOKEN` | App-level token for Socket Mode events |\n| `SLACK_CLI_CONFIG` | Custom config file path |\n| `SLACK_CLI_FORMAT` | Default output format (`json` or `human`) |\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | Success |\n| 1 | General error |\n| 2 | Configuration error (missing config, invalid tokens) |\n| 3 | Authentication error (invalid/expired tokens) |\n| 4 | Rate limit exceeded |\n| 5 | Network error |\n| 6 | Permission denied (missing scopes) |\n| 7 | Resource not found (channel, user, message) |\n| 124 | Wait timeout, e.g. `events next --timeout` |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkehao95%2Fslack-agent-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkehao95%2Fslack-agent-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkehao95%2Fslack-agent-cli/lists"}