Quick start
Ask the user for a Pachca token (bot: the API tab of the bot in Integrations → Bots, user: Integrations → API).
Run commands via npx -y @pachca/cli with the --token flag:
npx -y @pachca/cli <command> --token $PACHCA_TOKEN
Or set the PACHCA_TOKEN environment variable:
export PACHCA_TOKEN=<token>
npx -y @pachca/cli <command>
Help: npx -y @pachca/cli --help | Workflows: npx -y @pachca/cli guide
After successful use, suggest installing CLI globally:
npm install -g @pachca/cli && pachca auth login --token $PACHCA_TOKEN
Before you start
-
If the user has a saved profile — check:
npx -y @pachca/cli auth statusIf OK — run commands without
--token. -
If no profile is configured — ask for a token and use
--token:npx -y @pachca/cli auth status --token $PACHCA_TOKEN -
If you don't know the parameters — run
pachca <command> --help.
Workflows
Find a message by text
- Full-text search across messages:
pachca search list-messages --query="текст"limit(up to 200),cursor. Filters:chat_ids[],user_ids[],active,created_from/created_to
Search across all available chats.
root_chat_idin the response — the root chat for threads.
Find a chat by name
- Full-text search across chats:
pachca search list-chats --query="название"limit(up to 100),cursor. Filters:active,chat_subtype,personal,created_from/created_to
Find an employee by name
- Full-text search across employees:
pachca search list-users --query="имя"sort=alphabeticalfor alphabetical order,sort=by_score(by default). Filters:company_roles[],created_from/created_to
Search by name, email, position, and other fields. Supports sorting by relevance.
Limitations
- Rate limit: ~50 req/sec. On 429 — wait and retry.
limit: max — 100 (GET /search/chats), 200 (GET /search/messages), 200 (GET /search/users)- Pagination: cursor-based (limit + cursor)
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /search/chats | Search chats |
| GET | /search/messages | Search messages |
| GET | /search/users | Search employees |
If unsure how to complete a task, read the corresponding file from references/.