wecomcli-manage-doc
wecomteam/wecom-cli
Create, read, and edit WeChat Work documents and smart sheets via CLI.
What is wecomcli-manage-doc?
Manages WeChat Work documents (doc_type=3) and smart sheets (doc_type=10) with support for docid or URL-based operations. Use this skill when you need to view document content, create new documents, or edit document body text in Markdown format.
- Export document content in Markdown format with async polling mechanism
- Create new documents or smart sheets and retrieve their docid and URL
- Overwrite document content using Markdown format
- Support both docid and document URL for document identification
- Handle both standard documents and smart sheet operations
How to install wecomcli-manage-doc
npx skills add https://github.com/wecomteam/wecom-cli --skill wecomcli-manage-doc- wecom-cli binary installed and configured
- Valid WeChat Work credentials configured in wecom-cli
How to use wecomcli-manage-doc
- 1.Install the skill: npx skills add https://github.com/wecomteam/wecom-cli --skill wecomcli-manage-doc
- 2.To read a document: call get_doc_content with docid or url; if task_done is false, poll again with the returned task_id until complete
- 3.To create a document: call create_doc with doc_type (3 for document, 10 for smart sheet) and doc_name; save the returned docid
- 4.To edit a document: call edit_doc_content with docid, Markdown content, and content_type=1 to overwrite the document body
Use cases
- Retrieve and display full document content for review or analysis
- Create new project reports or task tracking sheets programmatically
- Update document body text with Markdown-formatted content
- Migrate or backup document content by exporting and re-importing
- Automate document creation workflows in enterprise WeChat
- Enterprise WeChat users managing documents programmatically
- Teams automating document creation and content updates
- Developers building document management workflows
- Knowledge workers needing to export and edit documents via CLI
wecomcli-manage-doc FAQ
Use get_doc_content with either docid or url parameter and type=2. The first call returns a task_id; if task_done is false, poll again with that task_id until task_done becomes true.
Standard documents (doc_type=3) and smart sheets (doc_type=10). Both can be created and edited through this skill.
The create_doc endpoint returns both url and docid in the response. Store the docid for future operations on that document.
All content must be in Markdown format. The content_type parameter is fixed at 1 (Markdown) for edit operations.
For reading (get_doc_content) you can use either docid or url. For editing (edit_doc_content), you must use docid.
Full instructions (SKILL.md)
Source of truth, from wecomteam/wecom-cli.
name: wecomcli-manage-doc description: 企业微信文档管理技能。提供文档的创建、读取和编辑能力,支持通过 docid 或文档 URL 操作企业微信文档(doc_type=3)和智能表格(doc_type=10)。适用场景:(1) 以 Markdown 格式导出获取文档完整内容(异步轮询) (2) 新建文档或智能表格 (3) 用 Markdown 格式覆写文档内容。当用户需要查看文档内容、创建新文档、编辑文档正文时触发此 Skill。 metadata: requires: bins: ["wecom-cli"] cliHelp: "wecom-cli doc --help"
企业微信文档管理
wecom-cli是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。
管理企业微信文档的创建、读取和编辑。所有接口支持通过 docid 或 url 二选一定位文档。
调用方式
通过 wecom-cli 调用,品类为 doc:
wecom-cli doc <tool_name> '<json_params>'
返回格式说明
所有接口返回 JSON 对象,包含以下公共字段:
| 字段 | 类型 | 说明 |
|---|---|---|
errcode | integer | 返回码,0 表示成功,非 0 表示失败 |
errmsg | string | 错误信息,成功时为 "ok" |
当 errcode 不为 0 时,说明接口调用失败,可重试 1 次;若仍失败,将 errcode 和 errmsg 展示给用户。
get_doc_content
获取文档完整内容数据,只能以 Markdown 格式返回。采用异步轮询机制:首次调用无需传 task_id,接口返回 task_id;若 task_done 为 false,需携带该 task_id 再次调用,直到 task_done 为 true 时返回完整内容。
- 首次调用(不传 task_id):
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2}'
- 轮询(携带上次返回的 task_id):
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2, "task_id": "xxx"}'
- 或通过 URL:
wecom-cli doc get_doc_content '{"url": "https://doc.weixin.qq.com/doc/xxx", "type": 2}'
参见 API 详情。
create_doc
新建文档(doc_type=3)或智能表格(doc_type=10)。创建成功返回 url 和 docid。
wecom-cli doc create_doc '{"doc_type": 3, "doc_name": "项目周报"}'
wecom-cli doc create_doc '{"doc_type": 10, "doc_name": "任务跟踪表"}'
注意:docid 仅在创建时返回,需妥善保存。创建智能表格时默认包含一个子表,可通过 smartsheet_get_sheet 查询其 sheet_id。
参见 API 详情。
edit_doc_content
用 Markdown 内容覆写文档正文。content_type 固定为 1(Markdown)。
wecom-cli doc edit_doc_content '{"docid": "DOCID", "content": "# 标题\n\n正文内容", "content_type": 1}'
参见 API 详情。
典型工作流
- 读取文档 →
wecom-cli doc get_doc_content '{"docid": "DOCID", "type": 2}'
,若 task_done 为 false 则携带 task_id 继续轮询
2. 创建新文档 →
wecom-cli doc create_doc '{"doc_type": 3, "doc_name": "文档名"}'
,保存返回的 docid 3. 编辑文档 → 先 get_doc_content 了解当前内容,再 edit_doc_content 覆写
Related skills
More from wecomteam/wecom-cli and the wider catalog.

wecomcli-manage-schedule
Manage WeCom (企业微信) schedules: create, modify, cancel, and find free time slots.

wecomcli-manage-smartsheet-data
Manage WeChat Work smartsheet records with CRUD operations via CLI.

wecomcli-manage-smartsheet-schema
Manage WeChat Work smartsheet structure: add, update, delete sheets and fields via CLI.

wecomcli-meeting
Create, manage, and query WeCom enterprise meetings with full control over participants and settings.

wecomcli-msg
Query WeChat Work conversations, retrieve message history with media support, and send text messages.

wecomcli-schedule
Manage WeCom enterprise calendar schedules: query, create, modify, and coordinate availability.