wecomcli-doc

wecomcli-doc

Popular

Manage WeCom documents, spreadsheets (online tables), smart tables, and smart pages (formerly smart homepages). Supports creating, reading, and editing documents; reading spreadsheet and smart table content; creating smart tables; and creating and exporting smart pages. Use cases: (1) Get full document/spreadsheet/smart table content in Markdown (2) Create a new document or smart table (3) Overwrite document content with Markdown (4) Create a smart page from a local Markdown file (5) Export smart page content as Markdown. Supports locating documents by docid or URL. Triggered when the user mentions a URL in the format `https://doc.weixin.qq.com/xxxx`.

2.4Kstars
166forks
Updated 7/2/2026
SKILL.md
readonlyread-only
name
wecomcli-doc
description

Manage WeCom documents, spreadsheets (online tables), smart tables, and smart pages (formerly smart homepages). Supports creating, reading, and editing documents; reading spreadsheet and smart table content; creating smart tables; and creating and exporting smart pages. Use cases: (1) Get full document/spreadsheet/smart table content in Markdown (2) Create a new document or smart table (3) Overwrite document content with Markdown (4) Create a smart page from a local Markdown file (5) Export smart page content as Markdown. Supports locating documents by docid or URL. Triggered when the user mentions a URL in the format `https://doc.weixin.qq.com/xxxx`.

WeCom Document Management

wecom-cli is the command-line program provided by WeCom. All operations are performed by executing wecom-cli commands.

Manage the creation, reading, and editing of WeCom documents and smart pages (formerly smart homepages). The document interface supports locating documents by either docid or url.

⚠️ Important Trigger Rule: Only use smart page related interfaces (smartpage_* series) when the user explicitly mentions "smart page" or "smart homepage". For all other "document" scenarios (e.g., "create a document", "write a document", "help me create a document"), always use the WeCom document interfaces (create_doc / get_doc_content / edit_doc_content).

URL Category Identification and Interface Routing

WeCom documents have four categories, each with different URL formats and different interfaces for reading content. Do not mix them. Note that spreadsheets (online tables) and smart tables are two different categories. Distinguish them strictly by URL:

URL Pattern Category Read Content Interface
https://doc.weixin.qq.com/doc/* Document (doc_type=3) get_doc_content
https://doc.weixin.qq.com/sheet/* Spreadsheet / Online Table get_doc_content
https://doc.weixin.qq.com/smartsheet/* Smart Table (doc_type=10) See wecomcli-smartsheet skill
https://doc.weixin.qq.com/smartpage/* Smart Page (formerly smart homepage) smartpage_export_tasksmartpage_get_export_result

Determination Rules:

  • URL path starts with /doc/* → Document → Use get_doc_content
  • URL path starts with /smartsheet/* → Smart Table → Use wecomcli-smartsheet skill
  • URL path starts with /sheet/* → Spreadsheet (online table) → Use get_doc_content
  • URL path starts with /smartpage/* → Smart Page (formerly smart homepage) → Use smartpage_export_task

⚠️ Spreadsheet ≠ Smart Table: They are different categories (/sheet/ vs /smartsheet/), but both use the same get_doc_content interface for reading content. Distinction is only needed when writing/managing structure (smart table structure and record management see wecomcli-smartsheet skill; this skill only supports reading regular spreadsheets).

Invocation

Call via wecom-cli with category doc:

wecom-cli doc <tool_name> '<json_params>'

Return Format

All interfaces return a JSON object with the following common fields:

Field Type Description
errcode integer Return code, 0 for success, non-zero for failure
errmsg string Error message, "ok" on success

If errcode is not 0, the interface call failed. Retry once; if it still fails, show errcode and errmsg to the user.

Special Error Codes

errcode errmsg Meaning Handling
851002 incompatible doc type Document category does not match the called interface Re-identify the category based on the document URL (see the "URL Category Identification and Interface Routing" table above), then retry with the correct interface for that category

Documents

get_doc_content

Get the full content of documents / spreadsheets (online tables) / smart tables, returned in Markdown format. Uses an asynchronous polling mechanism: the first call does not need task_id; the interface returns a task_id. If task_done is false, call again with that task_id until task_done is true, then the full content is returned.

Applicable URLs: /doc/*, /sheet/*. Not applicable for /smartsheet/* (smart tables) — use wecomcli-smartsheet skill instead; not applicable for /smartpage/* (smart pages) — use smartpage_export_task instead.

  • First call (without task_id):
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2}'
  • Polling (with previous task_id):
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2, "task_id": "xxx"}'
  • Read document by URL:
wecom-cli doc get_doc_content '{"url": "https://doc.weixin.qq.com/doc/xxx", "type": 2}'
  • Read spreadsheet (online table) by URL:
wecom-cli doc get_doc_content '{"url": "https://doc.weixin.qq.com/sheet/xxx", "type": 2}'

⚠️ Smart tables (/smartsheet/*) do not use this interface. Use the wecomcli-smartsheet skill instead.

See API Details.

create_doc

Create a new document (doc_type=3) or smart table (doc_type=10). On success, returns url and docid.

  • Create a document:
wecom-cli doc create_doc '{"doc_type": 3, "doc_name": "Weekly Report"}'
  • Create a smart table:
wecom-cli doc create_doc '{"doc_type": 10, "doc_name": "Project Task Table"}'

Note:

  • docid is only returned at creation; save it properly
  • Detailed management of smart tables (doc_type=10) (sub-tables, fields, data records, etc.) has been moved to the wecomcli-smartsheet skill; use that skill for advanced operations
  • Regular spreadsheets (online tables, URL contains /sheet/) are read-only in this skill (via get_doc_content); creation is not supported

See API Details.

edit_doc_content

Overwrite the document body with Markdown content. content_type is fixed to 1 (Markdown).

wecom-cli doc edit_doc_content '{"docid": "DOCID", "content": "# Title\n\nBody content", "content_type": 1}'

See API Details.


Smart Pages (formerly Smart Homepages)

Applicable category: Smart pages (triggered when the user says "smart page" or "smart homepage")
Applicable URL: /smartpage/*

⚠️ Only use the following interfaces when the user explicitly specifies "smart page" or "smart homepage". For other "document" scenarios, use the WeCom document interfaces above.

Use cases:

  1. Create a smart page from a local Markdown file
  2. Asynchronously export smart page content as Markdown

smartpage_create

Create a smart page (formerly smart homepage). Supports specifying a title and multiple sub-pages. Each sub-page can specify a title, content type, and local file path. On success, returns docid and url.

⚠️ Special Syntax: This command must use +smartpage_create (with + prefix); the plus sign is mandatory. This + only applies to this command; do not generalize it to other doc subcommands.

wecom-cli doc +smartpage_create '{"title": "Project Overview", "pages": [{"page_title": "Requirements Doc", "content_type": 1, "page_filepath": "/path/to/requirements.md"}]}'

Note:

  • content_type must match the actual file content: .md files or content containing Markdown syntax must use 1 (Markdown); only plain text uses 0. Most scenarios should use 1
  • docid is only returned at creation; save it properly
  • Each sub-page's Markdown file must not exceed 10MB; larger files will cause creation failure. If the file is too large, split it into multiple sub-pages before creating

See API Details.

smartpage_export_task

Initiate a smart page content export task (asynchronous). Pass docid (or url) and content_type; returns task_id. This is the first step of asynchronous export; combine with smartpage_get_export_result polling to get the export result.

  • By docid:
wecom-cli doc smartpage_export_task '{"docid": "DOCID", "content_type": 1}'
  • Or by URL:
wecom-cli doc smartpage_export_task '{"url": "https://doc.weixin.qq.com/smartpage/xxx", "content_type": 1}'

See API Details.

smartpage_get_export_result

Query the progress of a smart page export task. Pass task_id for polling; when task_done is true, returns content (the exported full document content).

wecom-cli doc smartpage_get_export_result '{"task_id": "TASK_ID"}'

When task_done is true, the content field contains the exported Markdown content.

See API Details.

Typical Workflows

Key Tip: Before reading content, check the URL to determine the category. /doc/, /sheet/get_doc_content; /smartsheet/wecomcli-smartsheet skill; /smartpage/smartpage_export_task. Only use the smartpage flow when the user explicitly mentions "smart page" or "smart homepage"; for other document scenarios, always use the WeCom document interfaces.

Document / Spreadsheet Reading and Document Editing

  1. Read document / spreadsheet
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2}'

or by URL (applicable to /doc/*, /sheet/*):

wecom-cli doc get_doc_content '{"url": "https://doc.weixin.qq.com/sheet/xxx", "type": 2}'

If task_done is false, continue polling with task_id

For smart tables (/smartsheet/*), use the wecomcli-smartsheet skill

  1. Create a new document
wecom-cli doc create_doc '{"doc_type": 3, "doc_name": "Document Name"}'

Save the returned docid
3. Edit a document → First use get_doc_content to understand current content, then edit_doc_content to overwrite

Smart Page Operations

  1. Create a smart page (only when the user explicitly requests "smart page" or "smart homepage") →
wecom-cli doc +smartpage_create '{"title": "Title", "pages": [{"page_title": "Subpage", "content_type": 1, "page_filepath": "/path/to/file.md"}]}'

Save the returned docid
2. Get smart page content (URL contains /smartpage/, asynchronous two-step):

  • Step 1: Initiate export task →
wecom-cli doc smartpage_export_task '{"docid": "DOCID", "content_type": 1}'

Get task_id

  • Step 2: Poll export result →
wecom-cli doc smartpage_get_export_result '{"task_id": "TASK_ID"}'

If task_done is false, continue polling until task_done is true; the returned content field is the Markdown content