Documentation
Complete command reference for the openzca CLI. Both openzca and zca work as the command name.
Installation
Requires Node.js 18+. Works on macOS, Linux, and Windows.
Quick Start
Global Options
These options can be used with any command.
account — Multi-account profile management
Manage multiple Zalo accounts with named profiles. Each profile stores its own credentials, cache, and database.
| Command | Description |
|---|---|
account list ls, l | List all account profiles |
account current whoami | Show current active profile |
account switch <name> use | Set default profile |
account add [name] new | Create a new profile (default: "default") |
account label <name> <label> | Set a display label for a profile |
account remove <name> rm | Remove a profile and its data |
auth — Authentication & cache
Login, logout, and manage the local friends/groups cache.
| Command | Description |
|---|---|
auth login | Login with QR code |
auth login-cred [file] login-creds | Login using a credential JSON file |
auth logout | Remove saved credentials from active profile |
auth status | Show login status |
auth cache-refresh | Refresh friends/groups cache from server |
auth cache-info | Show cache metadata (last updated, counts) |
auth cache-clear | Clear local cache |
auth login options
msg — Messaging
Send text, media, files, reactions, and manage conversations. Use -g to target group threads.
| Command | Description |
|---|---|
msg send <threadId> <message> | Send text with formatting and @mentions |
msg image <threadId> [file] | Send image(s) from file or URL |
msg video <threadId> [file] | Send video(s); single .mp4 uses native video mode |
msg voice <threadId> [file] | Send voice message (.aac, .mp3, .m4a, .wav, .ogg) |
msg sticker <threadId> <stickerId> | Send a sticker |
msg link <threadId> <url> | Send a link preview |
msg card <threadId> <contactId> | Send a contact card |
msg react <msgId> <cliMsgId> <threadId> <reaction> | React to a message |
msg typing <threadId> | Send typing indicator |
msg forward <message> <targets...> | Forward text to multiple targets |
msg delete <msgId> <cliMsgId> <uidFrom> <threadId> | Delete a message |
msg undo <msgId> <cliMsgId> <threadId> | Recall your sent message |
msg edit <msgId> <cliMsgId> <threadId> <message> | Edit a message (undo + resend) |
msg upload <arg1> [arg2] | Upload and send file(s) |
msg recent <threadId> | List recent messages |
msg pin <threadId> | Pin a conversation |
msg unpin <threadId> | Unpin a conversation |
msg list-pins | List pinned conversations |
msg member-info <userId> | Get member/user profile info |
msg send options
msg image / video / voice / upload options
msg recent options
live, db, or auto live
msg delete options
heart, like, haha, wow, cry, angry.
group — Group management
Create groups, manage members, handle invite links, run polls, and configure group settings.
| Command | Description |
|---|---|
group list | List all groups |
group info <groupId> | Get group details |
group members <groupId> | List group members |
group create <name> <members...> | Create a new group |
group rename <groupId> <name> | Rename a group |
group avatar <groupId> <file> | Change group avatar |
group settings <groupId> | Update group settings |
group add <groupId> <userIds...> | Add members to group |
group remove <groupId> <userIds...> | Remove members from group |
group add-deputy <groupId> <userId> | Promote member to deputy |
group remove-deputy <groupId> <userId> | Demote deputy |
group transfer <groupId> <newOwnerId> | Transfer group ownership |
group block <groupId> <userId> | Block a member |
group unblock <groupId> <userId> | Unblock a member |
group blocked <groupId> | List blocked members |
group enable-link <groupId> | Enable invite link |
group disable-link <groupId> | Disable invite link |
group link-detail <groupId> | Get invite link details |
group join-link <linkId> | Join a group via invite link |
group pending <groupId> | List pending join requests |
group review <groupId> <userId> <action> | Approve or deny join request |
group leave <groupId> | Leave a group |
group disperse <groupId> | Disperse (disband) a group |
group settings options
group poll
Create and manage polls within groups.
| Command | Description |
|---|---|
group poll create <groupId> | Create a poll |
group poll detail <pollId> | Get poll details and results |
group poll vote <pollId> | Vote on a poll |
group poll lock <pollId> | Close a poll |
group poll share <pollId> | Share a poll |
group poll create options
friend — Friend management
Search users, manage friend requests, aliases, and blocking.
| Command | Description |
|---|---|
friend list | List all friends |
friend find <query> | Find user by phone, username, or name |
friend online | List online friends |
friend recommendations | Get friend recommendations |
friend add <userId> | Send friend request |
friend accept <userId> | Accept friend request |
friend reject <userId> | Reject friend request |
friend cancel <userId> | Cancel sent friend request |
friend sent | List sent friend requests |
friend request-status <userId> | Check friend request status |
friend remove <userId> | Remove a friend |
friend alias <userId> <alias> | Set display alias for a friend |
friend remove-alias <userId> | Remove alias |
friend aliases | List all aliases |
friend block <userId> | Block a user |
friend unblock <userId> | Unblock a user |
friend block-feed <userId> | Block user from viewing your feed |
friend unblock-feed <userId> | Unblock user from viewing your feed |
friend boards <conversationId> | Get boards in a conversation |
Notable options
me — Profile & account
View and update your Zalo profile, manage avatars, and set online status.
| Command | Description |
|---|---|
me info | Get your account info |
me id | Get your user ID |
me update | Update profile fields |
me avatar <file> | Change profile avatar |
me avatars | List avatar history |
me delete-avatar <id> | Delete an avatar from history |
me reuse-avatar <id> | Reuse a previous avatar |
me status <online|offline> | Set online status |
me last-online <userId> | Check when a user was last online |
me update options
male or female)
db — Local SQLite database
Profile-scoped SQLite message persistence. Enable the database, sync data from the server, and query messages offline with time-range filters.
~/.openzca/profiles/<profile>/messages.sqlite. Uses WAL mode for concurrent reads.
Database management
| Command | Description |
|---|---|
db enable | Enable local SQLite persistence |
db disable | Disable automatic DB persistence |
db reset | Delete the local SQLite DB file |
db status | Show DB status, message counts, and file path |
db enable options
db reset options
Stored data queries
| Command | Description |
|---|---|
db me info | Show stored self profile |
db me id | Show stored self user ID |
db group list | List groups in DB |
db group info <groupId> | Show stored group info |
db group members <groupId> | List stored group members |
db group messages <groupId> | List stored messages for a group |
db friend list | List friends in DB |
db friend find <query> | Find stored friends by ID or name |
db friend info <userId> | Show stored friend info |
db friend messages <userId> | List stored DM messages |
db chat list | List all chats in DB |
db chat info <chatId> | Show stored chat info |
db chat messages <chatId> | List stored chat messages |
db message get <id> | Read one stored message by msgId, cliMsgId, or uid |
Message query options
Available on db group messages, db friend messages, and db chat messages.
7d, 24h, 1d2h30m)
7m, 24h, 1d, 2w, 1d2h30m), ISO timestamps (2026-03-21T10:00:00+07:00), Unix seconds or milliseconds, or any string parseable by Date.parse().
db sync
Sync data from the Zalo server into the local database.
| Command | Description |
|---|---|
db sync | Sync all (groups + friends + chats) |
db sync all | Explicit full sync (same as above) |
db sync groups | Sync group directory, members, and full history |
db sync friends | Sync friend directory only |
db sync chats | Sync discoverable DM/chat windows |
db sync group <groupId> | Sync one group with full history |
db sync chat <chatId> | Sync one chat |
db sync options
listen — Real-time message listener
WebSocket-powered listener for incoming messages with webhook forwarding, media caching, and supervised mode.
threadId, msgId, cliMsgId, content, type, timestamp, senderId, senderName, chatType, mentions, mediaPath, mediaUrl, quote, and more. See --raw output for full schema.
Text Formatting
When sending messages with msg send, openzca parses Markdown-style syntax into Zalo text styles. Use --raw to skip formatting.
| Syntax | Result |
|---|---|
| **bold** | Bold text |
| __bold__ | Bold text (alternative) |
| *italic* | Italic text |
| _italic_ | Italic text (alternative) |
| ***bold italic*** | Bold + italic |
| ~~strikethrough~~ | Strikethrough text |
| # Heading | Large bold heading (H1) |
| ## Heading | Bold heading (H2) |
| ### Heading | Heading (H3) |
| #### Heading | Heading (H4) |
| - item | Unordered list (also * and +) |
| 1. item | Ordered list |
| > quote | Blockquote (indented) |
| ```code``` | Fenced code block |
Color & size tags
Plain-text color and size tags for additional styling:
| Syntax | Result |
|---|---|
| {red}text{/red} | Red colored text |
| {orange}text{/orange} | Orange colored text |
| {yellow}text{/yellow} | Yellow colored text |
| {green}text{/green} | Green colored text |
| {big}text{/big} | Large text |
| {small}text{/small} | Small text |
| {underline}text{/underline} | Underlined text |
@Mentions in groups
When sending to a group (-g), @Name or @userId resolves against the group member list. Matching works against user IDs, display names, and Zalo names. Mentions work inside styled text (e.g., **@Alice**).
Environment Variables
Override defaults with environment variables. All are optional.
| Variable | Default | Description |
|---|---|---|
| Profile & Data | ||
| OPENZCA_HOME | ~/.openzca | Override default data directory |
| OPENZCA_PROFILE | Select active profile (without --profile flag) | |
| ZCA_PROFILE | Legacy profile alias | |
| Debug | ||
| OPENZCA_DEBUG | 0 | Enable debug logging (1 to enable) |
| OPENZCA_DEBUG_FILE | ~/.openzca/logs/openzca-debug.log | Debug log file path |
| QR Code Rendering | ||
| OPENZCA_QR_OPEN | 0 | Auto-open QR image (1 to enable) |
| OPENZCA_QR_AUTO_OPEN | 1 (non-interactive) | Auto-open in headless mode (0 to disable) |
| OPENZCA_QR_RENDER | auto | Force QR mode: kitty, iterm, ascii, auto |
| OPENZCA_QR_ASCII | 1 | ASCII QR fallback (0 to disable) |
| OPENZCA_QR_DISABLE_ITERM_INLINE | 0 | Disable iTerm2 inline QR (1 to force ASCII) |
| OPENZCA_QR_WIDTH | 34 | iTerm2 QR width in cells (16-80) |
| Listener | ||
| OPENZCA_LISTEN_MEDIA_DIR | Explicit inbound media cache directory | |
| OPENZCA_LISTEN_MEDIA_MAX_BYTES | 20971520 | Max bytes per inbound media file (20 MB) |
| OPENZCA_LISTEN_MEDIA_MAX_FILES | 4 | Max inbound media files per message (max 16) |
| OPENZCA_LISTEN_MEDIA_FETCH_TIMEOUT_MS | 10000 | Max download time per media URL |
| OPENZCA_LISTEN_RECYCLE_MS | 1800000 | Force listener recycle after N ms (0 to disable) |
| OPENZCA_LISTEN_HEARTBEAT_MS | 30000 | Heartbeat interval for supervised mode |
| OPENZCA_LISTEN_INCLUDE_QUOTE_CONTEXT | 1 | Include reply context in content |
| OPENZCA_LISTEN_DOWNLOAD_QUOTE_MEDIA | 1 | Download quoted attachment URLs |
| OPENZCA_LISTEN_ENFORCE_SINGLE_OWNER | 1 | Enforce one listener per profile |
| OPENZCA_LISTEN_IPC | 1 | Expose IPC socket from listener |
| OPENZCA_LISTEN_KEEPALIVE_RESTART_DELAY_MS | 2000 | Restart delay after close |
| Upload & IPC | ||
| OPENZCA_UPLOAD_IPC | 1 | Try upload via listener IPC first |
| OPENZCA_UPLOAD_IPC_CONNECT_TIMEOUT_MS | 1000 | IPC connect timeout |
| OPENZCA_UPLOAD_IPC_TIMEOUT_MS | upload + 5000 | IPC response timeout |
| OPENZCA_UPLOAD_TIMEOUT_MS | 120000 | File upload timeout |
| OPENZCA_UPLOAD_ENFORCE_SINGLE_OWNER | 1 | Fail if listener owner exists but IPC unavailable |
| OPENZCA_UPLOAD_AUTO_THREAD_TYPE | 0 | Auto-detect thread type for uploads |
| Message History | ||
| OPENZCA_RECENT_USER_MAX_PAGES | 20 | Max websocket pages for DM recent |
| OPENZCA_RECENT_GROUP_MAX_PAGES | 20 | Max websocket pages for group recent |
| System | ||
| OPENZCA_SIGNAL_FORCE_EXIT_MS | 1500 | Force exit after signal timeout |