Multi-Account Publishing
Run multiple WeChat official accounts with named credentials and explicit selection.
Multi-Account Publishing
Use case
Teams, client accounts, and account matrices publish to several official accounts from one machine. Named accounts keep credentials separated and make the target explicit on every side effect.
Config
wechat:
default_account: main
accounts:
main:
appid: wx1234567890abcdef
secret: your_main_secret
client-a:
appid: wx0987654321fedcba
secret: your_client_secretAccount names must match ^[a-z0-9][a-z0-9_-]{0,63}$.
Selection order
--wechat-account <name>flagWECHAT_ACCOUNTenvironment variablewechat.default_account- Direct
wechat.appid/wechat.secret - The single named account, if exactly one exists
Multiple named accounts without a default (and without an explicit selection) fail with:
WECHAT_ACCOUNT_AMBIGUOUSDiscovery, without secrets
md2wechat config wechat-accounts --jsonLists accounts[{name, appid, current}], current, and default_account. This command never outputs secrets, not even masked.
Per-command selection
md2wechat convert article.md --draft --cover cover.jpg --wechat-account client-a--wechat-account is available on every WeChat side-effect command (draft creation, image upload, image posts).
API key boundary
- Named accounts and fixed-egress proxy mode require a valid
MD2WECHAT_API_KEY, validated viaHEAD /api/auth/validatebefore any side effect. - The legacy single-account path (
wechat.appid/wechat.secretdirectly) keeps working without an API key.