Community写作与编辑github.com

shuangying0001-beep/wechat-notify

微信消息通知接入(企业微信机器人+公众号模板):5 分钟接消息推送。适合任何需通知用户的微信应用。

wechat-notify 是什么?

wechat-notify is a Claude Code agent skill that 微信消息通知接入(企业微信机器人+公众号模板):5 分钟接消息推送。适合任何需通知用户的微信应用。.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add shuangying0001-beep/wechat-notify

Installed? Explore more 写作与编辑 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

WeChat Notification Integration

Source: Child Growth Diary Construction Kit AI要怎么做.md §3.3 WeChat/WeCom Notification, extracted from the project name and turned into a general integration specification.

What This Is

Notifications are a standard feature of most mini-programs. This skill provides integration specifications and generation scripts for the two most common approaches: WeCom Bot (simplest, 5 minutes) and Official Account template messages (requires user follow). It also enforces key storage rules.

The script includes --self-test: it mocks httpx to verify the payload structure of three send types (text / markdown card / template message) is correct, proving the generated module is usable—no real webhook needed, no internet required.

When to Use

  • The user says: "Integrate WeChat notifications" / "WeCom Bot" / "Official Account template message" / "WeChat message push"
  • Any scenario where system messages need to be pushed to WeChat (groups / users): task reminders, status notifications, alerts

Option 1: WeCom Bot Webhook (Recommended, 5-minute integration)

  • POST {webhook_url} sends JSON: {"msgtype":"text","text":{"content":"Message content"}}
  • Supports markdown format, can include links and images
  • No application required; a group admin can create it (Group → Add Bot → Copy Webhook URL)

Option 2: Official Account Template Message

  • First obtain access_token (valid for 7200 seconds, must be cached in Redis/memory, never fetch on every call)
  • POST https://api.weixin.qq.com/cgi-bin/message/template/send
  • Requires the user to follow the Official Account, and the template must be approved in the Official Account backend

Security Requirements (P0)

  • The WeCom Bot Webhook URL is treated as a secret, only stored in .env, never appearing in code
  • Official Account AppSecret is stored only server-side, not passed to the frontend
  • Credentials are never committed to Git; use in conjunction with the wechat-miniprogram-devrules security boundary

Script Usage (Generate Notification Module)

# 0) First verify the generated send structure is correct (recommended before first use)
python gen_notify.py --self-test

# 1) Generate module
python gen_notify.py --out ./notify_module

Generates:

  • notify_module/wecom_bot.py — WeCom Bot send (text / markdown, with rate limiting and retry, additionally provides markdown_card() to compose broadcast cards)
  • notify_module/mp_template.py — Official Account template message (access_token cache + send, with rate limiting and retry)
  • notify_module/.env.example — Required key fields to fill in

Notes

  • WeCom Bot is suitable for "system → group" alerts/broadcasts; Official Account template messages are suitable for "system → specific user" reach (e.g., task reminders, points received)
  • The access_token cache key includes an expiration time and refreshes early to avoid duplicate fetches triggering rate limits under concurrency
  • Template message content is constrained by the Official Account's category and template fields; confirm field name matching before sending
  • Use in conjunction with ai-work-acceptance for verification: focus on ensuring Webhook URL / AppSecret are not hardcoded or stored in the database

相关技能