CommunityWriting & Editinggithub.com

WeChat Notify

WeChat message notification integration (WeCom Bot + Official Account Template): Get message push up and running in 5 minutes. Suitable for any WeChat application that needs to notify users.

What is WeChat Notify?

This skill provides a standardized approach to integrating WeChat notifications into your application, covering two popular methods: WeCom (WeChat Work) Bot webhooks and Official Account template messages. The WeCom Bot method is recommended for its simplicity—you can send text or markdown messages to a group chat within 5 minutes by simply posting JSON to a webhook URL created by a group admin. The Official Account template message method requires users to follow the account and necessitates prior approval of templates, but allows sending personalized notifications to individual users. The skill also enforces critical security practices: all secrets (webhook URLs, AppSecret) must be stored in environment variables and never committed to code. A self-contained Python script (`gen_notify.py`) is provided to generate the notification module; it includes a `--self-test` flag that validates the payload structure of all three message types (text, markdown card, template message) using mocked HTTP requests, ensuring the generated code works correctly without needing real webhooks or network access.

Works with~Claude Code~Codex CLI~Cursor
npx skills add shuangying0001-beep/wechat-notify

Installed? Explore more Writing & Editing skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

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

Related Skills