|
| 1 | +# nori-slack-cli |
| 2 | + |
| 3 | +A CLI for the Slack Web API, designed for coding agents. |
| 4 | + |
| 5 | +`nori-slack-cli` is a thin command-line wrapper around the Slack Web API that maps **1:1 to Bolt** (`@slack/web-api`). Every method Bolt exposes is reachable through a single dynamic command — there is no curated subset, no opinionated abstraction layer, and no business logic. If Bolt can call it, this CLI can call it. |
| 6 | + |
| 7 | +## Why this exists |
| 8 | + |
| 9 | +Bolt is built for human developers writing TypeScript. This CLI is built for coding agents that need to drive Slack from a shell. That shapes every design decision: |
| 10 | + |
| 11 | +- **No interactive prompts, no ASCII art.** Every successful response is a single line of JSON on stdout. Errors are JSON on stdout *and* a human-readable line on stderr. |
| 12 | +- **Exhaustive surface.** The agent has access to the full Slack Web API — not a hand-picked subset. Capability boundaries are enforced through **bot token scopes**, not through code. |
| 13 | +- **Bot tokens only.** Uses `SLACK_BOT_TOKEN` exclusively. There is no user-OAuth flow because there is no human in the loop. |
| 14 | +- **Self-locating errors.** Every error response includes a `source` field with the on-disk path to the CLI, so an agent can read the source code to debug. |
| 15 | +- **Distributed as source.** Build it locally; the postbuild step makes `nori-slack` available on your `PATH`. |
| 16 | + |
| 17 | +## Install |
| 18 | + |
| 19 | +```bash |
| 20 | +git clone https://github.com/tilework-tech/nori-slack-cli.git |
| 21 | +cd nori-slack-cli |
| 22 | +npm install |
| 23 | +npm run build |
| 24 | +npm link # makes `nori-slack` available globally |
| 25 | +``` |
| 26 | + |
| 27 | +Then set your bot token: |
| 28 | + |
| 29 | +```bash |
| 30 | +export SLACK_BOT_TOKEN=xoxb-... |
| 31 | +``` |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +The general shape is `nori-slack <method> [--param value ...]`, where `<method>` is any Slack Web API method (e.g. `chat.postMessage`, `conversations.list`, `users.info`). |
| 36 | + |
| 37 | +```bash |
| 38 | +# Send a message |
| 39 | +nori-slack chat.postMessage --channel C123 --text "Hello" |
| 40 | + |
| 41 | +# List channels |
| 42 | +nori-slack conversations.list --limit 10 |
| 43 | + |
| 44 | +# Auto-paginate and merge results |
| 45 | +nori-slack conversations.list --paginate |
| 46 | + |
| 47 | +# Pipe parameters in as JSON |
| 48 | +echo '{"channel":"C123","text":"hi"}' | nori-slack chat.postMessage --json-input |
| 49 | + |
| 50 | +# Preview a request without sending it (no token required) |
| 51 | +nori-slack chat.postMessage --channel C123 --text "Hello" --dry-run |
| 52 | +``` |
| 53 | + |
| 54 | +Flags are converted from `--kebab-case` to `snake_case` to match Slack's parameter names. Values are auto-coerced (`true`/`false` → boolean, numerics → number, inline JSON → object/array). A bare `--flag` with no value is treated as boolean `true`. |
| 55 | + |
| 56 | +### Discovery (no token required) |
| 57 | + |
| 58 | +```bash |
| 59 | +# List every known method, optionally filtered by namespace |
| 60 | +nori-slack list-methods --namespace chat |
| 61 | +nori-slack list-methods --descriptions |
| 62 | + |
| 63 | +# Get parameter docs, required/optional fields, pagination support, and docs URL for a method |
| 64 | +nori-slack describe chat.postMessage |
| 65 | +``` |
| 66 | + |
| 67 | +### Top-level flags |
| 68 | + |
| 69 | +| Flag | Purpose | |
| 70 | +| --- | --- | |
| 71 | +| `--json-input` | Read parameters as JSON from stdin (CLI flags override stdin values). | |
| 72 | +| `--paginate` | Use cursor pagination and return a single merged JSON response. | |
| 73 | +| `--dry-run` | Resolve params and print the planned request without calling the API. | |
| 74 | + |
| 75 | +### Exit codes |
| 76 | + |
| 77 | +- `0` — success |
| 78 | +- `1` — Slack API error or missing token |
| 79 | +- `2` — bad CLI usage (missing args, invalid stdin JSON) |
| 80 | + |
| 81 | +## Authentication |
| 82 | + |
| 83 | +Set `SLACK_BOT_TOKEN` in the environment. The CLI does not read tokens from any other source. To control what the agent can do, scope the bot token in the Slack app's OAuth & Permissions page — the CLI itself imposes no method-level restrictions. |
| 84 | + |
| 85 | +## License |
| 86 | + |
| 87 | +See [LICENSE](LICENSE) and [LICENSE-ADDENDUM.txt](LICENSE-ADDENDUM.txt). |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +Created and maintained by [Nori](https://noriagentic.com). |
0 commit comments