-
Notifications
You must be signed in to change notification settings - Fork 1
Quickstart
packy edited this page Jun 18, 2026
·
1 revision
-
Node.js >= 20(查看:
node --version) - npm 或 pnpm
npm install -g @packy-tang/wx-newspicgit clone https://github.com/lpreterite/wx-newspic.git
cd wx-newspic
npm install
npm run build
npm link验证安装:
wx-newspic --version
wx-newspic --help优先级:CLI 参数 > 环境变量 > .env 文件。
方式一:CLI 参数(每次执行时指定)
wx-newspic publish --app-id "wx_xxx" --app-secret "secret_xxx"方式二:环境变量
export WECHAT_APP_ID=your_app_id
export WECHAT_APP_SECRET=your_app_secret方式三:持久化配置
wx-newspic credential set --app-id "wx_xxx" --app-secret "secret_xxx"验证凭证:
wx-newspic credential checkwx-newspic publish \
--title "今日推荐" \
--content "正文内容" \
--images ./photos/*.pngwx-newspic publish \
--type news \
--title "标题" \
--md article.md \
--theme orangeheart成功返回:
{
"media_id": "MkFrOVhDZ3hCQUFBQVFDQUFBQlFBQUFBTUFRQUFJQUFBQUFCd0FB",
"created_at": "2026-05-19T10:30:00+08:00",
"success": true
}