Skip to content

feat: add raw API command #13

Merged
scmmishra merged 5 commits into
mainfrom
feat/raw-api
May 13, 2026
Merged

feat: add raw API command #13
scmmishra merged 5 commits into
mainfrom
feat/raw-api

Conversation

@scmmishra
Copy link
Copy Markdown
Member

This PR adds chatwoot api as an authenticated raw API escape hatch for Chatwoot endpoints that do not yet have first-class CLI commands.

Account-relative paths like /conversations/123 are expanded to /api/v1/accounts/<id>/conversations/123, so users do not need to type the full account API path. The command reuses the existing authenticated client and sends the configured Chatwoot API token headers automatically.

First-class commands remain preferred. Raw API usage is documented as an escape hatch with stricter safety expectations.

Details

chatwoot api supports curl-like options for endpoint-level calls:

  • -X/--method
  • -d/--data
  • @file
  • @-
  • repeatable -H/--header

JSON responses are pretty-printed. Non-JSON responses are passed through as-is.

Absolute URLs are rejected to avoid sending saved API tokens to arbitrary hosts.

The bundled agent skill now includes:

  • the raw API command
  • the application Swagger reference
  • stricter write-safety guidance

Agents are instructed to consult the application Swagger before making raw API calls. Mutating raw API calls are treated as privileged actions and must show the exact method, path, and body before execution. Writes must not be performed without explicit user confirmation.

@scmmishra
Copy link
Copy Markdown
Member Author

@codex please review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions
Copy link
Copy Markdown

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/chatwoot/cli/internal/cmd 30.22% (+4.91%) 👍
github.com/chatwoot/cli/internal/sdk 51.13% (-5.47%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/chatwoot/cli/internal/cmd/api.go 70.00% (+70.00%) 60 (+60) 42 (+42) 18 (+18) 🌟
github.com/chatwoot/cli/internal/cmd/app.go 75.00% (ø) 16 12 4
github.com/chatwoot/cli/internal/cmd/cli.go 0.00% (ø) 0 0 0
github.com/chatwoot/cli/internal/sdk/client.go 55.91% (-14.93%) 127 (+31) 71 (+3) 56 (+28) 💀

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/chatwoot/cli/internal/cmd/api_test.go
  • github.com/chatwoot/cli/internal/cmd/conversation_test.go

@scmmishra scmmishra merged commit 4e1a0a5 into main May 13, 2026
10 checks passed
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