Slack workspace apps—Bolt-style flows, bot tokens, and channel messaging from the terminal.
Official & reference links
Lists all opencli slack subcommands; request bodies follow Slack method docs, CLI entry points follow this page.
Overview
opencli slack targets teams with a Slack App: token setup, chat.postMessage helpers, and shortcuts to common admin APIs—useful alongside other OpenCLI modules in “one pipeline, many chat tools” setups.
Prerequisites
| Item | Notes |
|---|
| Slack App + Bot User | Create and install to workspace |
| Bot User OAuth Token | Usually starts with xoxb- |
| OAuth scopes | e.g. chat:write, channels:read, … |
| Node.js 20+ | For global opencli |
Install
npm install -g @opencli/cli@latest
opencli slack --help
Never commit xoxb- tokens to source control.
Environment variable (recommended)
export SLACK_BOT_TOKEN=xoxb-your-token-here
OpenCLI reads SLACK_BOT_TOKEN; some versions also support encrypted local config via opencli slack config.
Interactive example
opencli slack config set bot_token --prompt
Paste at prompt; input is hidden.
Command reference (full)
opencli slack --help
config
| Command | Description |
|---|
opencli slack config set bot_token --prompt | Interactive xoxb- entry |
opencli slack config set bot_token --value <token> | Non-interactive (watch shell history) |
opencli slack config set bot_token --from-env <ENV> | Read from environment |
opencli slack config get bot_token | Read (masked by default) |
opencli slack config path | Config file path |
chat
| Command | Description |
|---|
opencli slack chat post --channel <Cxx or #name> --text <text> [--thread-ts <ts>] | chat.postMessage |
opencli slack chat update --channel <Cxx> --ts <message ts> --text <text> | Update message |
opencli slack chat post --channel C01234567 --text "OpenCLI: production deploy done ✅"
files
| Command | Description |
|---|
opencli slack files upload --channel <Cxx> --file <path> [--title <t>] [--thread-ts <ts>] | Upload file |
opencli slack files upload --channel C01234567 --file ./build.log --title "Build log"
channels
| Command | Description |
|---|
opencli slack channels list [--types public_channel,private_channel,...] | Conversations visible to the bot |
opencli slack channels info --channel <Cxx> | Channel metadata |
users
| Command | Description |
|---|
opencli slack users lookup --email <mail> | Resolve email → user id |
opencli slack users info --user <Uxx> | User info |
conversations
| Command | Description |
|---|
opencli slack conversations open --users <U1,U2,...> | Open or create DM |
api (arbitrary Web API)
| Command | Description |
|---|
opencli slack api call --method <methods.name> [--body '<json>'] [--query k=v] | Direct call, e.g. chat.postMessage, users.list |
opencli slack api call --method chat.postMessage --body '{"channel":"C01234567","text":"hi"}'
socket (optional)
| Command | Description |
|---|
opencli slack socket dev [--app-token <xapp->] | Local Socket Mode tunnel (per implementation) |
Socket Mode vs HTTP events
- HTTP / webhooks: needs public Request URL in the Slack app.
- Socket Mode: great for local dev; needs
xapp- app-level token. Some builds expose opencli slack socket dev—confirm with opencli slack --help.
Troubleshooting
| Symptom | Fix |
|---|
not_in_channel | Invite the bot or use a channel it can access |
invalid_auth | Token expired or wrong token type |
rate_limited | Apply backoff per Slack tiers |