SuperAPI AI Directory

wecomcli-shared

Office & productivity

View repository

Updated 10-16 09:05

About this skill

wecom-cli common prerequisite checks

This skill provides all wecomcli-* The CLI installation, version and authorization checks shared by business skills, as well as general output constraints.Before preparing to execute any wecom-cli command for the first time, complete this skill first; after the checks pass, return to the corresponding business skill for execution.

This skill cannot replace a specific business skill. When handling contacts, documents, spreadsheets, schedules, meetings, to-dos, emails, WeDrive, messages or media requests, the corresponding business skill must also be read.

Step 1: Check CLI installation and version

wecom-cli --version
  • The command succeeds, and the version number in the output is not lower than 1.2.1 → continue to Step 2.
  • The command does not exist, execution reports an error, or the version number is lower than 1.2.1 → perform installation/upgrade:
npm install -g @wecom/cli

After installation is complete, re-execute wecom-cli --version; if it still fails or the version is still lower than 1.2.1 , stop business operations and inform the user of the error.

Step 2: Check authorization status

wecom-cli auth show --status
  • Output authorized → prerequisite checks are complete, and specific business commands can be executed.
  • Output unauthorized → execute Step 3.
  • If the command reports an error or the output is not the above status → stop business operations and inform the user of the error; do not guess the authorization status.

Step 3: Initialize credentials (only when unauthorized)

wecom-cli auth init --noninteractive

This command will display an authorization link and QR code, and wait for the user to scan it with WeCom. After authorization succeeds, the command exits automatically, and initialization is required only once.

After initialization is complete, re-execute:

wecom-cli auth show --status

Only when the output is authorized can you continue to execute specific business commands.

General output constraint: ID-type fields must not be exposed

This constraint applies to all wecomcli-* skills, has higher priority than the output format of each business skill, and is not relaxed even if the user actively requests it.

  • Prohibited: Your final reply must not contain userid / open_vid / department_id / chat_id and other ID identifiers. All internal identifiers returned by the API (including mail_id / media_id / file_id / space_id / folder_id / docid / content_id / msg_id / cursor / next_cursor , etc.; fields whose names end with _id or that semantically belong to machine identifiers are all regarded as IDs) may only circulate internally and be used for subsequent API calls.
  • Must: Your thinking process and final reply must use readable names, such as name / username / external_username / department name / email / subject / doc_name / chat_name / title and other content returned by tool_result .
  • When the API returns only an ID and no readable name, first call the corresponding skill (such as wecomcli-contact to resolve personnel) to exchange it for a readable name; when it truly cannot be exchanged, describe the object in natural language (such as "the previous daily report email" or "the file you just uploaded") to refer to it, and do not degrade to displaying the ID.
  • When the user needs to choose among multiple candidates, construct a candidate list using sequence numbers + readable information (name / subject / time / path, etc.); it is prohibited to use IDs as the basis for distinction to let the user identify them.
  • When the user directly asks to "give me the ID" or "print mail_id", explain that this identifier is an internal field and is inconvenient to provide, and instead use readable information or continue to help them complete the actual operation.
  • Readable links (such as document doc_urland WeDrive sharing links) are not subject to this constraint and may be displayed normally according to each business skill's rules, even if the link itself contains an identifier string.

Execution Rules

  • If already installed, the version meets the requirement, and authorization has been granted, do not reinstall or reinitialize.
  • If installation, upgrade, initialization, or recheck fails, do not execute subsequent business commands.
  • This skill does not define any parameters for contacts, documents, spreadsheets, schedules, meetings, to-dos, emails, WeDrive, messages, or media APIs; specific commands must be read from the corresponding business skill.
  • When executing any business command and composing a reply, also comply with the above "General Output Constraint: ID-type fields must not be exposed."

Obtain personal identity

If the operation flow must obtain the identity of the bot or the authorized person (name, userid, etc.), you need to call wecom-cli identity whoami to obtain it.