Skip to content

xu75/openclaw-wechat-gateway

Repository files navigation

openclaw-wechat-gateway

Openclaw 到本地 wechat-publisher-agent 的发布总控网关(V1)。和https://github.com/xu75/wechat-unofficial-publisher-agent 配套使用。 因为是自己用的,安装说明不是很清楚,建议用codex帮你分析后安装。欢迎对安装说明进行更新完善。

功能示例

在openclaw里面,配合wechat-notes-style生成文章,直接用/publish_wechat发布到自己公众号,如果Agent没有登录,则会返回登录二维码,扫码登录后继续执行就可以了。如果已经登录但是想换另一个账号,或者未登录状态,可用/publish_wechat_relogin来登录。

20260323-222708

V1 能力

  1. 固定三条 API:
  • POST /wechat/publish
  • POST /wechat/publish/:task_id/confirm-login
  • GET /wechat/publish/:task_id
  1. Gateway 内容处理(不下沉 Agent):
  • markdown -> html
  • HTML sanitize
  • 图片 URL 规则校验与重写(仅允许绝对 HTTPS)
  1. Agent 对接方式(Remote MCP):
  • 默认 Agent 地址 http://127.0.0.1:14273(自动走 /mcp
  • 工具调用固定使用 structuredContent 解析
  • 当前使用工具:
    • publisher_health
    • publisher_login_status
    • publisher_login_qr_get
    • publisher_publish
  • 发布成功判定:status=acceptedexecution.draft_saved=true
  1. 状态机与登录约束:
  • waiting_login 不轮询 publish
  • confirm-login 仅允许一次重试
  • waiting_login 默认 600s 超时转 manual_intervention 并告警
  1. 可观测与回放:
  • request_id 透传
  • 结构化日志(request_id/task_id/stage/status/error_code
  • sqlite 持久化 publish_tasks / publish_events / publish_audit_logs

快速开始

cp .env.example .env
npm install
npm run db:migrate
npm run dev

命令

npm run check
npm run test
npm run db:migrate
npm run dev
npm run build
npm run start:prod

最小联调

./scripts/smoke-curl.sh

文档

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors