Skip to content

feat: add api command for raw Slack Web API calls - #182

Open
aliir74 wants to merge 2 commits into
stablyai:mainfrom
aliir74:feat/api-command
Open

aliir74 wants to merge 2 commits into
stablyai:mainfrom
aliir74:feat/api-command

Conversation

@aliir74

@aliir74 aliir74 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Note

Claude writing on behalf of Ali.

What

agent-slack api <method> calls any Slack Web API method with the configured workspace auth (same --workspace selection and auto-refresh as every other command) and prints Slack's JSON response unchanged, like gh api.

  • -f key=value adds a string argument (repeatable); --params '<json>' takes a JSON object for non-string values. Fields win over --params.
  • Non-object --params and keyless fields are rejected before any call is made.

Why

Agents keep hitting methods agent-slack has no command for. My case: per-conversation read markers (client.counts last_read) and per-thread read markers (subscriptions.thread.getView, conversations.replies last_read) to show a user a voice-clip transcript the moment they open the conversation. An escape hatch avoids a new command for every such method.

Testing

  • bun test: all pass, including new parseApiParams cases (merge order, = inside values, rejected inputs).
  • bun run typecheck clean; lint has no new warnings.
  • Live with a browser-session workspace: client.counts, subscriptions.thread.getView, conversations.replies and conversations.history all return the raw JSON (an 89 KB response piped intact).
  • I have assessed security implications of this change
  • I have tested this change (automating where feasible)
  • I have updated the documentation (where applicable)

🤖 Generated with Claude Code

aliir74 and others added 2 commits October 30, 2026 11:45
`agent-slack api <method>` calls any Web API method with the configured
workspace auth (including auto-refresh) and prints the raw JSON, like
`gh api`. Arguments come from `--params <json>` and repeatable
`-f key=value` fields. Useful for methods agent-slack has no command for
yet, such as client.counts read markers or subscriptions.thread.getView.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Print Slack's error JSON on stdout (exit 1) instead of only a stderr
message, add --multipart for methods that ignore form-urlencoded args,
and allow only read methods in safe mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant