Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Post articles and image-text content to WeChat Official Account via API or Chrome CDP, with markdown-to-WeChat HTML conversion.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/multi-account.md
1# Multi-Account Support23Details for managing multiple WeChat Official Accounts through one EXTEND.md. SKILL.md only covers single-account flow and the selection prompt — read this file when the user has an `accounts:` block, asks to publish to a specific account, or needs per-account credentials.45## Compatibility67| Condition | Mode | Behavior |8|-----------|------|----------|9| No `accounts` block | Single-account | Original behavior, no changes |10| `accounts` with 1 entry | Single-account | Auto-select, no prompt |11| `accounts` with 2+ entries | Multi-account | Prompt to select before publishing |12| `accounts` with `default: true` | Multi-account | Pre-select default; user can switch |1314## EXTEND.md Example1516```md17default_theme: default18default_color: blue1920accounts:21- name: 宝玉的技术分享22alias: baoyu23default: true24default_publish_method: api25default_author: 宝玉26need_open_comment: 127only_fans_can_comment: 028app_id: your_wechat_app_id29app_secret: your_wechat_app_secret30- name: AI工具集31alias: ai-tools32default_publish_method: browser33default_author: AI工具集34need_open_comment: 135only_fans_can_comment: 036```3738## Per-Account vs Global Keys3940**Per-account** (also accepted globally as fallback): `default_publish_method`, `default_author`, `need_open_comment`, `only_fans_can_comment`, `app_id`, `app_secret`, `chrome_profile_path`.4142**Global-only** (always shared): `default_theme`, `default_color`.4344## Account Selection (Step 0.5)4546Insert between Step 0 (Load EXTEND.md) and Step 1 (Determine input type):4748```49if no accounts block:50→ single-account mode (original behavior)51elif accounts.length == 1:52→ auto-select the only account53elif --account <alias> CLI arg:54→ select matching account55elif one account has default: true:56→ pre-select, display: "Using account: <name> (--account to switch)"57else:58→ prompt user to choose from the list59```6061## Credential Resolution (API Method)6263For the selected account with alias `{alias}`, try in this order (first hit wins):64651. `app_id` / `app_secret` inline in the EXTEND.md account block662. Env vars `WECHAT_{ALIAS}_APP_ID` / `WECHAT_{ALIAS}_APP_SECRET` (alias uppercased, hyphens → underscores)673. `.baoyu-skills/.env` with the prefixed key `WECHAT_{ALIAS}_APP_ID`684. `~/.baoyu-skills/.env` with the prefixed key695. Fallback to unprefixed `WECHAT_APP_ID` / `WECHAT_APP_SECRET`7071### .env Multi-Account Example7273```bash74# Account: baoyu75WECHAT_BAOYU_APP_ID=your_wechat_app_id76WECHAT_BAOYU_APP_SECRET=your_wechat_app_secret7778# Account: ai-tools79WECHAT_AI_TOOLS_APP_ID=your_ai_tools_wechat_app_id80WECHAT_AI_TOOLS_APP_SECRET=your_ai_tools_wechat_app_secret81```8283## Chrome Profile (Browser Method)8485Each account uses an isolated Chrome profile so logins don't collide.8687| Source | Path |88|--------|------|89| Account `chrome_profile_path` in EXTEND.md | Use as-is |90| Auto-generated from alias | `{shared_profile_parent}/wechat-{alias}/` |91| Single-account fallback | Shared default profile |9293## CLI `--account` Flag9495All publishing scripts accept `--account <alias>`:9697```bash98${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme default --account ai-tools99${BUN_X} {baseDir}/scripts/wechat-article.ts --markdown <file> --theme default --account baoyu100${BUN_X} {baseDir}/scripts/wechat-browser.ts --markdown <file> --images ./photos/ --account baoyu101```102