pachca-users
pachca-users
Quick start
Ask user for Pachca token (bot: Automations → Integrations → API, or user: Automations → API).
Run commands with npx @pachca/cli and --token flag:
npx @pachca/cli <command> --token $PACHCA_TOKEN
Or set PACHCA_TOKEN for multiple commands:
export PACHCA_TOKEN=<token>
npx @pachca/cli <command>
Help: npx @pachca/cli --help | Scenarios: npx @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 user has a saved profile — check status:
npx @pachca/cli auth statusIf OK — use commands without
--token. -
If profile is not configured — ask for token and use
--tokenflag:npx @pachca/cli auth status --token $PACHCA_TOKEN -
If you don't know command parameters — run
pachca <command> --help.
Step-by-step scenarios
Get employee by ID
- Get employee info:
pachca users get <ID>
Returns all fields including
custom_properties,user_status,list_tags.
Bulk create employees with tags
-
Create tag (if needed):
pachca group-tags create --name="Backend" -
For each employee: create account with tags:
pachca users create --first-name="Иван" --last-name="Петров" --email="ivan@example.com" --list-tags='[{"name":"Backend"}]'Tags are assigned via
list_tagsfield in request body -
Or update existing:
pachca users update <ID> --list-tags='[{"name":"Backend"}]'
Creation available only to admins and owners (not bots). No separate "add user to tag" endpoint.
Find employee by name or email
- Search by name/email (partial match):
pachca users list --query=Иван
Cursor-based pagination:
limitandcursorfrommeta. For exact email — iterate pages.
Onboard new employee
-
Create account:
pachca users create --email="new@example.com" --first-name="Иван" --last-name="Петров" -
Add to required channels:
pachca members add <chat_id> --member-ids='[<user_id>]' -
Send welcome message:
pachca messages create --entity-type=user --entity-id=<user_id> --content="Добро пожаловать!"
Step 1 requires admin/owner token. Steps 2-3 can be done by bot.
Offboard employee
-
Suspend access:
pachca users update <ID> --suspended -
Optionally: delete account permanently:
pachca users delete <ID> --force
Suspension (
suspended) preserves data, deletion is irreversible.
Get all employees of a tag/department
-
Find tag by name, take
id:pachca group-tags list --names='["Backend"]'namesfilter — server-side filtering by tag name -
Get all tag members:
pachca group-tags list-users <tag_id> --all
Manage employee status
-
Get current status:
pachca users get-status <user_id> -
Set status:
pachca users update-status <user_id> --emoji="🏖️" --title="В отпуске" --is-awayis_away: true— away mode.away_message— max 1024 chars -
Delete status:
pachca users remove-status <user_id> --force
Constraints and gotchas
- Rate limit: ~50 req/sec. On 429 — wait and retry.
user.role: allowed values —admin(Администратор),user(Сотрудник),multi_guest(Мульти-гость),guest(Гость)status.away_message: max 1024 characterslimit: max 50- Pagination: cursor-based (limit + cursor)
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /group_tags | Новый тег |
| GET | /group_tags | Список тегов сотрудников |
| GET | /group_tags/{id} | Информация о теге |
| PUT | /group_tags/{id} | Редактирование тега |
| DELETE | /group_tags/{id} | Удаление тега |
| GET | /group_tags/{id}/users | Список сотрудников тега |
| POST | /users | Создать сотрудника |
| GET | /users | Список сотрудников |
| GET | /users/{id} | Информация о сотруднике |
| PUT | /users/{id} | Редактирование сотрудника |
| DELETE | /users/{id} | Удаление сотрудника |
| GET | /users/{user_id}/status | Статус сотрудника |
| PUT | /users/{user_id}/status | Новый статус сотрудника |
| DELETE | /users/{user_id}/status | Удаление статуса сотрудника |
If you don't know how to complete a task — read the corresponding file from references/ for step-by-step instructions.