Proposal: global `search` command across conversations, contacts, messages, and articles
- Dominant language
- Go
- Stars
- 8
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
I'd like to add a top-level `chatwoot search ""` command that returns matches across **conversations, contacts, messages, and help-center articles** in one call, with `--only=` to restrict the output. This complements the existing per-resource search (`contacts --search`, `convs --query`) with a single cross-resource entry point.
## Endpoint
It would call the account-scoped dashboard search endpoint:
```
GET /api/v1/accounts/{account_id}/search # all four buckets
```
This is what the Chatwoot dashboard's global search uses (`Api::V1::Accounts::SearchController`). Two questions before I open the PR:
1. **Is `/search` a supported API surface** for the CLI to depend on? It isn't in the published OpenAPI spec (`internal/sdk/testdata/application_swagger.json` only lists `/contacts/search`), so I'd cover it with `httptest`-based tests rather than the swagger contract harness — matching the existing `internal/cmd/*_test.go`. Happy to add the path to the bundled spec instead if you'd prefer to treat it as official.
2. **Top-level command vs. flag?** A new top-level `search` reads naturally for cross-bucket search, but it overlaps conceptually with `contacts --search` / `convs --query`. Would you prefer a top-level command, or a different shape?
## Follow-up (separate PR)
A second, optional PR adds date-range filtering (`--after` / `--before` / `--on`, `--tz`) mapping to `since` / `until` query params on `/search`. Heads-up: those params are also dashboard-internal (not in the published spec) and only take effect when the account has the `advanced_search` feature — so it's cleanly separable and easy to defer.
Both PRs are ready to open once you confirm the direction. Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the existing per-resource search commands and internal/cmd/*_test.go, then inspect the dashboard search endpoint and internal/sdk/testdata/application_swagger.json. Resolve whether /search is a supported API surface and whether this should be a top-level command or a flag before implementing. Done means the direction is agreed and the cross-resource command is covered by httptest-based tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100