Agent Skillsdaymade/claude-code-skills › setup-notifications-via-wecom

setup-notifications-via-wecom

GitHub

用于通过企业微信机器人 Webhook 发送技术状态通知、警报及备份报告。支持配置接收者身份(自动或需确认),确保消息清晰无歧义,适用于服务监控与自动化告警场景。

setup-notifications-via-wecom/SKILL.md daymade/claude-code-skills

Trigger Scenarios

用户要求发送企业微信通知或警报 需要为备份、同步或 Cron 任务设置状态更新

Install

npx skills add daymade/claude-code-skills --skill setup-notifications-via-wecom -g -y
More Options

Non-standard path

npx skills add https://github.com/daymade/claude-code-skills/tree/main/setup-notifications-via-wecom -g -y

Use without installing

npx skills use daymade/claude-code-skills@setup-notifications-via-wecom

指定 Agent (Claude Code)

npx skills add daymade/claude-code-skills --skill setup-notifications-via-wecom -a claude-code -g -y

安装 repo 全部 skill

npx skills add daymade/claude-code-skills --all -g -y

预览 repo 内 skill

npx skills add daymade/claude-code-skills --list

SKILL.md

Frontmatter
{
    "name": "setup-notifications-via-wecom",
    "description": "Set up and send technical status notifications through WeCom (Enterprise WeChat) webhooks. Use this skill whenever the user needs to send notifications, alerts, backup completion reports, or status updates via WeCom; when they mention 企业微信, 企微机器人, webhook, or alerting; or when a message needs to be clear, unambiguous, and technically precise rather than vague or condescending."
}

Setup Notifications via WeCom

Overview

This skill helps you send clear, unambiguous technical notifications through a WeCom group bot webhook. It covers two things:

  1. One-time setup: store the webhook URL, test connectivity, and create a reusable sender script.
  2. Send messages: craft messages that distinguish state from delta, define every number, and avoid the misleading patterns that made earlier backup-sync notifications confusing.

The bundled script scripts/send_wecom.py handles the actual HTTP call, including the proxy-unset rule required for Tencent services in mainland China. Recipient identity is explicit configuration: self may send automatically; others requires human confirmation; missing identity fails fast.

When to Use This Skill

Trigger this skill when the user:

  • Says "send a WeCom notification", "企业微信通知", "企微机器人", or "webhook 通知".
  • Wants to set up alerting for a backup, sync, cron job, or service status.
  • Asks you to write a status/alert message and you need to make it clear and unambiguous.
  • Mentions a message was confusing or misleading and wants it fixed.

Quick Start: Configure the Webhook

  1. Check existing config:

    cat ~/.config/setup-notifications-via-wecom/config.json
    

    If it exists and contains webhook_url, skip to Send a Message.

  2. Get the webhook URL from the WeCom group bot settings. It looks like:

    https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY
    
  3. Store it privately (outside the skill bundle, so it survives updates):

    mkdir -p ~/.config/setup-notifications-via-wecom
    echo '{"webhook_url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY"}' \
      > ~/.config/setup-notifications-via-wecom/config.json
    chmod 600 ~/.config/setup-notifications-via-wecom/config.json
    
  4. Classify the exact target and bind the canonical sender without exposing or rewriting the webhook value:

    uv run --no-project python scripts/set_recipient.py \
      --scope self --label "My private self channel"
    

    Use self only when the configured webhook is visible only to the user. Use others for every other person or group. Do not guess when the target is unknown. The command also records this sender's absolute path and digest; after the sender is upgraded, rerun the command before sending again.

  5. Test connectivity by sending a test message (run from the skill directory):

    uv run --no-project python scripts/send_wecom.py --message "WeCom webhook test ✅"
    

    If you see the message in the WeCom group, setup is done.

Message Best Practices

These rules come from real corrections. Apply them to every notification.

1. Headline First

The first line must say what happened. Do not bury the conclusion.

Claude Code 备份同步完成 ✅

2. Distinguish State vs Delta

  • State: current totals (e.g., source has 1075 main sessions, backup has 2328).
  • Delta: what changed in this run (e.g., 13 main sessions + 230 other files were added since 03:00).

Never say "synced 1075 sessions" if only 13 were new today.

3. Define Every Number

Every count must be accompanied by what it counts. Prefer:

- 源目录主 session:1075 个
- 备份主 session:2328 个

Avoid undefined terms like "session" alone — it may include workflow journals, subagent files, or tool outputs.

4. Use Plain Location Names, Not Jargon

Prefer:

  • "电脑上" / "源目录"
  • "备份里" / "备份仓库"

Avoid:

  • "当前"
  • "含历史"
  • "旧 session" (unless defined)

5. Omit Noise

Do not include commit hashes, file paths, internal documentation references, or verbose explanations unless the user explicitly asks for them.

6. Be Technically Precise, Not Condescending

Use correct technical terms and define them. Do not translate everything into "大白话" simplifications that hide precision.

7. Include Verification Metrics

When the user asked "does it miss anything?", answer directly:

- 验证:0 缺失,0 滞后

8. End with a Next Action

Tell the user whether they need to do anything:

- 下一步:无需操作,下次自动同步 03:00

Notification Templates

Backup Sync Completion

Use when a backup/sync job finishes and you need to report completeness.

Claude Code 备份同步完成 ✅

- 自动同步:今日 03:00 正常执行
- 本次手动同步:补充 03:00 后的增量
  - 主 session:13 个
  - 子代理/工具输出/工作流:230 个
  - 合计:243 个文件
- 验证:0 缺失,0 滞后
- 当前状态:
  - 源目录主 session:1075 个
  - 备份主 session:2328 个
- 下一步:无需操作,下次自动同步 03:00

Alert

Use when something requires immediate action. Do not use this template for routine "all good" updates.

🚨 [P?] [服务/任务名] [症状]

- 影响:[谁/什么受影响,程度如何]
- 严重程度:[P1–P5 等级]
- 开始时间:[YYYY-MM-DD HH:MM TZ]
- 已采取:[正在做的动作]
- 下一步:[建议动作或预计下次更新时间]
- 相关链接:[dashboard/runbook,可选]

Rules:

  • Alert on symptoms, not causes (e.g., "API error rate > 10%" not "CPU 99%").
  • If the recipient cannot do anything concrete, do not send it as an alert.
  • Be honest about uncertainty; do not guess at root cause.

Status Update

Use for routine "all good" updates.

[任务名] 状态正常 ✅

- 检查时间:2026-06-24 03:00 CST
- 关键指标:
  - 源目录主 session:1075 个
  - 备份主 session:2328 个
- 本次变更:无
- 下一步:无需操作

Send a Message

Read recipient_scope and recipient_label before sending. A self target is the user's own delivery channel and needs no authorization. An others target is an external send: show the exact label and message and wait for the active human-confirmation gate. Missing/invalid metadata is a configuration error, not permission to guess.

Option A: Use the bundled script directly

uv run --no-project python scripts/send_wecom.py \
  --message "你的消息内容"

For multiline messages, use a file:

cat > /tmp/wecom_msg.txt <<'EOF'
Claude Code 备份同步完成 ✅

- 验证:0 缺失,0 滞后
EOF

uv run --no-project python scripts/send_wecom.py \
  --file /tmp/wecom_msg.txt

Option B: Inline curl

If you prefer not to use the script:

env -u http_proxy -u https_proxy -u all_proxy -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
  curl -s -X POST 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "msgtype": "text",
    "text": {
      "content": "YOUR_MESSAGE"
    }
  }'

Critical: Tencent services (WeChat/WeCom) must bypass the local proxy. The env -u ... prefix is required.

Workflow: Add WeCom Notification to a Script

When a user asks "let my backup script send WeCom notifications", do the following:

  1. Confirm the webhook is configured (see Quick Start).
  2. Read the explicit recipient scope/label; auto-send only when scope is self.
  3. Identify the notification type (backup-complete, alert, status-update, custom).
  4. Collect the exact numbers and their definitions from the script output.
  5. Craft the message using the templates above.
  6. For others, obtain human confirmation; then call scripts/send_wecom.py.
  7. Verify the message arrived at the configured target.

What This Skill Does NOT Do

  • It does not create or manage WeCom group bots — get the webhook key from WeCom first.
  • It does not infer who a webhook reaches — classify the target explicitly with set_recipient.py.
  • It does not handle rich media messages (markdown cards, news, images) — only plain text.
  • Manual --message / --file sends retry transient errors up to 3 times. Guard-owned automatic --outbox delivery makes exactly one HTTP attempt and requires the guard-approved payload digest; a later run never sends a pre-existing payload.
  • It does not send messages without the proxy-unset guard.

Troubleshooting

Connection closed or timeout

WeCom endpoints may fail if local proxy env vars leak into the request. The script and inline curl examples already unset them. If it still fails:

env | grep -i proxy

Unset any that are set before running the sender.

Message not received, but curl returned 200

Check the response body. WeCom returns 200 even for errors like invalid key or message-too-long. The script prints the full response; read it.

Config file not found

Run the setup step again. The script expects ~/.config/setup-notifications-via-wecom/config.json with a webhook_url field.

References

  • references/message_best_practices.md — condensed checklist distilled from this session's corrections.
  • scripts/send_wecom.py — the sender script.
  • scripts/set_recipient.py — atomically records self versus others plus the canonical sender path/digest without printing the webhook.

Version History

  • 98c21cf Current 2026-08-28 22:52

    新增绑定自动发送至确切个人频道的功能,引入规范发送者身份验证,优化出站箱检查逻辑及载荷摘要校验。

  • e00a2ec 2026-08-20 11:29

Same Skill Collection

capture-screen/SKILL.md
cloudflare-troubleshooting/SKILL.md
codex-image-gallery/SKILL.md
daymade-claude-code/claude-skills-troubleshooting/SKILL.md
daymade-claude-code/claude-usage-analyst/SKILL.md
daymade-claude-code/continue-claude-work/SKILL.md
daymade-claude-code/lark-cli-router/SKILL.md
daymade-codex/codex-image-gallery/SKILL.md
daymade-codex/design-style-picker/SKILL.md
daymade-docs/doc-to-markdown/SKILL.md
daymade-docs/excel-automation/SKILL.md
daymade-docs/mermaid-tools/SKILL.md
daymade-docs/ppt-creator/SKILL.md
daymade-financial/ashare-news-fetcher/SKILL.md
daymade-financial/devils-advocate/SKILL.md
daymade-financial/gangtise-copilot/SKILL.md
daymade-financial/pharma-daily-report/SKILL.md
daymade-macos/capture-screen/SKILL.md
daymade-skill/skill-reviewer/SKILL.md
daymade-skill/skills-search/SKILL.md
design-style-picker/SKILL.md
douban-skill/SKILL.md
download-gemini-images/SKILL.md
excel-automation/SKILL.md
fact-checker/SKILL.md
gemini-history-analyzer/SKILL.md
github-ops/SKILL.md
github-sensitive-data-cleanup/SKILL.md
i18n-expert/SKILL.md
llm-icon-finder/SKILL.md
macos-cleaner/SKILL.md
notify-wecom/SKILL.md
openclaw/SKILL.md
product-analysis/SKILL.md
prompt-optimizer/SKILL.md
promptfoo-evaluation/SKILL.md
repomix-unmixer/SKILL.md
scrapling-skill/SKILL.md
slides-creator/SKILL.md
tibo-reset-codex/SKILL.md
ui-designer/SKILL.md
video-comparer/SKILL.md
wps-doc-scraper/SKILL.md
youtube-downloader/SKILL.md
auto-repo-setup/SKILL.md
benchmark-due-diligence/SKILL.md
bilibili-source/SKILL.md
cli-demo-generator/SKILL.md
competitors-analysis/SKILL.md

Metadata

Files
0
Version
98c21cf
Hash
a4503008
Indexed
2026-08-20 11:29

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 21:37
浙ICP备14020137号-1 $bản đồ khách truy cập$