wecom-doc-fetcherFetch and convert WeChat Work developer docs pages into clean Markdown files for use in Obsidian, handling SPA content and required authentication.
Install via ClawdBot CLI:
clawdbot install mouzhi/wecom-doc-fetcherUse this skill when the user wants to save any page from the WeChat Work (企业微信) developer documentation site (developer.work.weixin.qq.com/document/path/*) as a clean Markdown file in their Obsidian vault.
wecom-doc-fetcher/
├── SKILL.md # this file
└── wx_doc_fetch.py # the fetch & convert script
Run these once before using the skill:
pip install requests playwright
playwright install chromium
playwright install chromiumdownloads a ~150 MB headless Chromium binary. This is required for automaticdoc_iddetection.
Python 3.8+ is required.
Place wx_doc_fetch.py anywhere convenient (e.g. your vault's scripts folder), then run:
# Basic: auto-detect doc_id, print to stdout
python wx_doc_fetch.py <URL>
# Save to file
python wx_doc_fetch.py <URL> output.md
# Skip Playwright, supply doc_id manually
python wx_doc_fetch.py <URL> output.md --doc-id <integer>
# Override cookies at runtime
python wx_doc_fetch.py <URL> output.md --cookies "wwapidoc.sid=xxx; ..."
python wx_doc_fetch.py https://developer.work.weixin.qq.com/document/path/94677 发送消息.md
# [info] path_id=94677 doc_id=31152
# [done] 已写入:发送消息.md
The WeChat Work docs site is a Vue SPA — the visible content is not in the initial HTML. It is loaded at runtime via a private POST API:
POST https://developer.work.weixin.qq.com/docFetch/fetchCnt?lang=zh_CN&ajax=1&f=json
Body: doc_id=<integer> (application/x-www-form-urlencoded)
The response includes data.content_md — the page content as a Markdown string. The script fetches this field, cleans it, and writes the result.
The page renders client-side. WebFetch and defuddle only see the pre-JS HTML skeleton — no content. Scraping innerText via browser tools works but produces a very large accessibility tree with poor formatting. The content_md API field is the cleanest, most token-efficient source.
The number in the browser URL (e.g. 94677) is a routing slug — not the doc_id the API needs. The actual doc_id (e.g. 31152) is determined at runtime by loading the page with Playwright and intercepting the fetchCnt XHR request.
If Playwright is unavailable or times out:
fetchCntdoc_id value--doc-id:python wx_doc_fetch.py https://developer.work.weixin.qq.com/document/path/94677 发送消息.md --doc-id 31152
The fetchCnt API requires an authenticated session. Playwright's headless browser obtains session cookies automatically when loading the page — no manual cookie setup needed for normal use.
If you see errCode: -30001 in the output, the session is rejected. Fix:
fetchCnt request → Copy as cURL-b '...' cookie string in the copied commandCOOKIES_RAW at the top of wx_doc_fetch.py, or pass it via --cookies "..."Key cookies and their lifetimes:
| Cookie | Purpose | Lifetime |
|--------|---------|---------|
| wwapidoc.sid | Session identifier | ~24 hours |
| wwapidoc.token_wt | JWT auth token | ~30 minutes |
| Item | Detail |
|------|--------|
| Endpoint | POST /docFetch/fetchCnt?lang=zh_CN&ajax=1&f=json&random= |
| Body | doc_id= (form-urlencoded) |
| Auth | Session cookies |
| Key response field | data.content_md |
| Other response fields | data.content_html, data.content_html_v2, data.content_txt, data.title, data.time |
The content_md field is mostly valid CommonMark but has site-specific issues. The clean_md() function in wx_doc_fetch.py handles all of them:
| # | Problem | Raw example | After cleaning |
|---|---------|-------------|----------------|
| 1 | [TOC] marker at top | [TOC]\n# 概述 | # 概述 |
| 2 | Heading missing space after # | ##接口定义 | ## 接口定义 |
| 3 | Internal numeric anchor links | 接收事件 | 接收事件 |
| 3 | Anchors with sub-path | 开启API | 开启API |
| 4 | HTML line breaks inside table cells | 说明补充 | 说明 补充 |
| 5 | bold tags | 注意 | 注意 |
| 6 | inline tags | | `open_kfid open_kfid ` |
| 7 | color tags | 警告 | 警告 |
| 8 | !!#rrggbb text!! site-specific highlight | !!#ff0000 重要!! | 重要 |
| 9 | Leading spaces before table rows | ··\| 参数 \| | \| 参数 \| |
| 10 | No blank line before table (Obsidian won't render) | 文字\n\| col \| | 文字\n\n\| col \| |
| 11 | Excess blank lines | 3+ \n in a row | 2 \n max |
The blank-line-before-table rule must match on lines that don't start with |, not just on the trailing character of the previous line:
# CORRECT — matches on start of line, avoids breaking table rows apart
re.sub(r"^([^|\n][^\n]*)\n(\|)", r"\1\n\n\2", content, flags=re.MULTILINE)
# WRONG — table rows end with "| " (trailing space), so last char is space,
# causing blank lines to be inserted between every table row
re.sub(r"([^\n])\n(\|)", r"\1\n\n\2", content)
Generated Mar 1, 2026
Software development teams at companies using WeChat Work APIs need to maintain up-to-date documentation in their knowledge bases. This skill allows them to automatically fetch and convert official API documentation into clean Markdown format for storage in Obsidian vaults, ensuring developers always have accessible reference materials without manual copying and formatting.
Consultants and integration specialists working on WeChat Work implementation projects need to gather requirements and document API specifications. This tool enables them to systematically collect official documentation pages as they research different endpoints, creating organized project documentation that can be easily referenced during development and client meetings.
Technical writers creating tutorials, guides, or training materials about WeChat Work APIs need accurate source documentation. This skill helps them extract clean Markdown from official sources to incorporate into their own documentation, blog posts, or educational content while maintaining proper formatting and avoiding manual transcription errors.
IT administrators managing WeChat Work deployments need to maintain internal knowledge bases about API configurations and troubleshooting procedures. This tool allows them to capture official documentation updates and store them alongside their internal notes in Obsidian, creating comprehensive reference systems for their support teams.
QA teams testing WeChat Work integrations need access to accurate API specifications to create test cases and validate implementations. This skill enables them to fetch the latest documentation directly into their testing documentation systems, ensuring test plans remain synchronized with official API changes and requirements.
Companies could integrate this functionality into documentation management platforms that serve businesses using WeChat Work. The tool would automatically sync official API docs into customer knowledge bases, with revenue generated through subscription fees based on the number of users, API endpoints monitored, or documentation pages maintained.
Consulting firms could offer this as part of comprehensive WeChat Work integration packages. The documentation fetching capability would be bundled with implementation services, custom development, and ongoing support, with revenue coming from project-based fees and retainer agreements for maintaining documentation synchronization over time.
Platforms selling productivity tools to developers could feature this skill in their marketplace. The tool would be offered as a premium plugin or standalone utility, with revenue generated through one-time purchases, tiered licensing for teams, or as part of bundle packages with other documentation management tools.
💬 Integration Tip
Ensure Python 3.8+ and required dependencies are properly installed before use, and verify session cookies are valid when encountering authentication errors during API calls.
iMessage/SMS CLI for listing chats, history, watch, and sending.
Use when you need to control Discord from Clawdbot via the discord tool: send messages, react, post or upload stickers, upload emojis, run polls, manage threads/pins/search, fetch permissions or member/role/channel info, or handle moderation actions in Discord DMs or channels.
Use when you need to control Slack from Clawdbot via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
Build or update the BlueBubbles external channel plugin for Clawdbot (extension package, REST send/probe, webhook inbound).
OpenClaw skill for designing Telegram Bot API workflows and command-driven conversations using direct HTTPS requests (no SDKs).