Skip to content

CLI reference

Run wx --help for command groups, wx accounts --help for a group’s subcommands, or wx accounts select --help for a specific action. Help lists commands alphabetically and explains what they do. Commands show readable results by default. Use --json for machine-readable output.

Commands

CommandSubcommands
wx serveRun the daemon in the foreground
wx daemonstart, status, logs [--follow], stop
wx authlogin [--official[=PATH]] [--qr] [--saved-only], status, qr ID, attempts get/cancel ID, logout [--local], forget --yes
wx accountsalias ID NAME, capabilities, connect, create [ID] [--alias NAME], disconnect, get [ID], list, remove ID --confirm ID, select ID, settings [--auto-download-max-mb MB], status
wx chatslist, get ID, find TEXT, read ID --expected-version V, mute ID, unmute ID, pin ID, unpin ID
wx messageslist CHAT, get CHAT ID, send CHAT --text/--image/--file/--video/--voice/--share, media CHAT ID, --video-quality normal/original with --video, recall ID --server-id S, sends lookup/get/cancel
wx contactslist, find TEXT, get ID, lookup ID..., refresh ID, sync, avatar ID
wx groupslist, get ID, lookup ID [--version N], members list/get/refresh/add/remove, create MEMBERS..., rename ID NAME, leave ID, my-name ID NAME, clear-announcement ID, refresh ID, sync
wx eventswatch [--cursor-file F], list, ack --consumer NAME --through CURSOR
wx callsCalling: status, monitor [--json], dial CONTACT, answer [CALL_ID]
wx jobsget ID, cancel ID, retry ID [--reuse-completed-upload], repair-writeback
wx operationsget ID
wx syncFetch new messages now
wx tokenslist, create NAME --accounts ID --scopes S, revoke ID
wx configclient, servers add/list/select, show
wx profilesRead a stopped profile directly, without a daemon (add, avatars, chats, contacts, groups, images, inspect, keys export, list, messages, select)
wx storeExperimental: copy, import and export profiles
wx versionVersion and build target

contacts find and groups find search the saved catalog. contacts lookup requests one or more exact contact IDs from WeChat. The display name uses the contact ID if both the remark and nickname are blank. groups lookup requests the member roster for an exact group ID from WeChat.

select saves a default in this CLI’s configuration:

CommandSaved choice
wx config servers select NAMEServer used by subsequent commands
wx accounts select IDAccount ID or alias for the selected named server
wx profiles select NAMELocal profile for the selected named server, or the standalone profile when no server is selected

Selection does not sign in or start a connection. Use --server-name, --account or --local-profile to override a choice for one command. Previous spellings remain accepted for existing scripts, but help shows the canonical commands.

Global flags

FlagEnvironment variableMeaning
--account IDAGENT_WECHAT_ACCOUNTAccount ID or alias
--server-name NAMEAGENT_WECHAT_SERVERSaved server from wx config servers add
--server URLAGENT_WECHAT_URLDaemon URL
--token-file PATHAGENT_WECHAT_TOKEN_FILEFile holding the API token
AGENT_WECHAT_TOKENThe token itself (prefer a file)
--config PATHAGENT_WECHAT_CONFIGCLI config file
--jsonMachine-readable results and errors. Event watches emit one JSON event per line.

Flags win over environment variables, which win over saved settings. Commands that start background work (sends, downloads, login, recall) also take --detach to return as soon as the work is queued.

Use wx daemon status --json to parse daemon status in a script. wx serve --json prints its readiness record to stderr. wx daemon logs streams the saved log in its original format.

messages send --wait SECONDS waits up to 3,600 seconds for attachment jobs and 900 seconds for text or shared links (default 30). Use --wait 3600 for a larger file. A wait ending returns exit code 7 while the same job continues; inspect it with wx jobs get JOB_ID. See Send attachments.

Exit codes

CodeMeaning
0Done, or queued with --detach
2Bad input or configuration
3Can’t reach the daemon
4Token rejected or missing a scope
5Login needed
6Needs you: approve on the phone or scan the QR
7Still running when the wait ended; check again later
8Unknown outcome (needs_review): don’t resend
9Failed
130Interrupted (the daemon keeps working)