wecomcli-smartpage

Original🇨🇳 Chinese
Translated

WeCom Smart Document (formerly known as Smart Homepage, smartpage) management skill. Provides capabilities for creating Smart Documents (publishing local Markdown files as Smart Documents) and exporting content (asynchronously exporting to Markdown). Applicable scenarios: (1) Create one or more local Markdown files as Smart Documents (2) Asynchronously export Smart Document content to Markdown. Supports locating documents via docid or document URL. This skill is triggered when the user explicitly mentions "Smart Document" or "Smart Homepage", or when the link is in the format `https://doc.weixin.qq.com/smartpage/xxx`. Note: For regular documents (`/doc/*`), use `wecomcli-doc`; for online spreadsheets (`/sheet/*`), use `wecomcli-sheet`; for smart spreadsheets (`/smartsheet/*`), use `wecomcli-smartsheet`.

11installs
Added on

NPX Install

npx skill4agent add wecomteam/wecom-cli wecomcli-smartpage

SKILL.md Content (Chinese)

View Translation Comparison →

WeCom Smart Document Management

wecom-cli
is a command-line program provided by WeCom, and all operations are completed by executing the
wecom-cli
command.
This is a resource-type skill responsible for creating and exporting Smart Documents (formerly known as Smart Homepage,
/smartpage/*
).

Calling Method

Call via
wecom-cli
, with the category
doc
:
bash
wecom-cli doc <tool_name> '<json_params>'

Return Format Description

All interfaces return a JSON object containing the following public fields:
FieldTypeDescription
errcode
integerReturn code,
0
indicates success, non-
0
indicates failure
errmsg
stringError message,
"ok"
when successful
When
errcode
is not
0
, it means the interface call failed, and you can retry once; if it still fails, display
errcode
and
errmsg
to the user.

Special Error Codes

errcodeerrmsgMeaningHandling Method
851002
incompatible doc type
The document category does not match the called interfaceConfirm that the target URL is
/smartpage/*
; if not, switch to the corresponding category skill

Interface Details

Create Smart Document

Create a Smart Document (formerly known as Smart Homepage), supporting the input of a title and multiple subpages. Each subpage can specify a title, content type, and local file path. Returns
docid
and
url
upon successful creation.
Special Syntax: This command must use
+smartpage_create
(with the
+
prefix), the plus sign cannot be omitted; this
+
only applies to this command, do not generalize it to other
doc
subcommands.
Command
bash
wecom-cli doc +smartpage_create '<JSON parameters>'
Parameters
ParameterTypeRequiredDefault ValueDescription
title
stringNoSmart Document title
pages
arrayYesList of subpages
pages[].page_title
stringNoSubpage title
pages[].content_type
intNo1Content type: 1-Markdown, 0-Text (plain text)
pages[].page_filepath
stringNoLocal file path corresponding to the subpage content
Notes
  • content_type
    must match the actual content of the file:
    .md
    files or content containing Markdown syntax must pass
    1
    , only plain text should pass
    0
    .
    1
    should be used in most scenarios.
  • docid
    is only returned during creation, please save it properly.
  • The size of each subpage's Markdown file must not exceed 10MB, otherwise creation will fail; if the file is too large, split it into multiple subpages before creation.
  • Smart Documents also support extended syntax such as background blocks (
    <card>
    ) and columns (
    <grid>
    ), see references/smartpage-create.md for details.

Export Smart Document Content

Obtain the complete content of a Smart Document and export it to Markdown. Uses asynchronous two-step operation: first submit an export task with
smartpage_export_task
to get
task_id
, then poll the task with
smartpage_get_export_result
until
task_done
is
true
, then return
content
.
Step 1: Submit Export Task
bash
# Via docid
wecom-cli doc smartpage_export_task '{"docid": "DOCID", "content_type": 1}'
# Via url
wecom-cli doc smartpage_export_task '{"url": "https://doc.weixin.qq.com/smartpage/xxx", "content_type": 1}'
ParameterTypeRequiredDefault ValueDescription
docid
stringEither
docid
or
url
is required
docid of the Smart Document
url
stringEither
docid
or
url
is required
Access link of the Smart Document
content_type
intYesExport content format, currently only supports
1
(Markdown)
Step 2: Poll Export Result
bash
wecom-cli doc smartpage_get_export_result '{"task_id": "TASK_ID"}'
ParameterTypeRequiredDefault ValueDescription
task_id
stringYesTask ID returned by
smartpage_export_task
Usage Rules
  • After obtaining
    task_id
    in the first step, call the second step with it; if
    task_done
    is
    false
    , continue polling until
    task_done
    is
    true
    , and the returned
    content
    field is the complete Markdown content.
See API Details.

Cross-Skill Dependencies

Dependent SkillTypical Collaboration ScenarioData Flow
wecomcli-msg
User requests to send the Smart Document link to someone/some groupThis skill returns
url
after creation →
wecomcli-msg
sends the link