wacli/docs/chats.md
Peter Steinberger af671e16a9
feat: add local store cleanup commands
Add local-only cleanup commands for store stats, chat cleanup, group pruning, and age-based store cleanup. Rework group pruning so targets are listed first, dry-run never deletes, confirmation gates every destructive path, and active stale groups require an explicit include flag.

Document the cleanup workflow across README and docs/, including the local-only semantics.

Closes #210.
Co-authored-by: Davy <95214375+thedavidweng@users.noreply.github.com>
2026-05-06 04:50:20 +01:00

2.4 KiB

chats

Read when: listing known chats, filtering chat state, archiving/pinning/muting/marking chats, or pruning stale local chat rows.

wacli chats reads chat rows from wacli.db. It can use session-backed PN/LID mappings to make historical @lid chat rows display as phone-number chats when possible. State commands send WhatsApp app-state patches through the authenticated session and update the local index after WhatsApp accepts the change.

Commands

wacli chats list [--query TEXT] [--limit N] [--archived|--no-archived] [--pinned|--no-pinned] [--muted|--no-muted] [--unread|--no-unread]
wacli chats show --jid JID
wacli chats archive --chat CHAT [--pick N]
wacli chats unarchive --chat CHAT [--pick N]
wacli chats pin --chat CHAT [--pick N]
wacli chats unpin --chat CHAT [--pick N]
wacli chats mute --chat CHAT [--duration DURATION] [--pick N]
wacli chats unmute --chat CHAT [--pick N]
wacli chats mark-read --chat CHAT [--pick N]
wacli chats mark-unread --chat CHAT [--pick N]
wacli chats cleanup [--days N] [--jid JID] [--dry-run] [--confirm]

Notes

  • list is local and sorted by pinned chats first, then newest known message timestamp.
  • --query filters by chat name or JID.
  • list --json and show --json include archived, pinned, muted_until, and unread.
  • show accepts the stored JID. If a phone JID maps to a historical @lid row, it can show that row too.
  • State commands use --chat and resolve names, phone numbers, groups, and JIDs like send commands. Use --pick N for ambiguous matches.
  • State commands print a compact success line by default and a stable JSON object with --json.
  • mute --duration 0 or omitting --duration mutes forever. Use unmute to clear it.
  • Run wacli sync to catch up chat-state changes made on other devices; run wacli contacts refresh to improve chat names.
  • cleanup only deletes local wacli.db rows. It does not delete chats or messages from WhatsApp.
  • cleanup --days N skips chats with no known local activity timestamp; use --jid for an explicit local row.
  • Use cleanup --dry-run before deleting and --confirm only for scripts that already reviewed the target list.

Examples

wacli chats list
wacli chats list --query family --limit 20
wacli chats list --pinned
wacli chats show --jid 1234567890@s.whatsapp.net
wacli chats mute --chat "+1 555 123 4567" --duration 8h
wacli chats mark-read --chat family --pick 1
wacli chats cleanup --days 365 --dry-run