wecom-cli Documentation

repository·main·Indexed 22 days ago

https://github.com/wecomteam/wecom-cli

The official command-line interface for WeCom (Enterprise WeChat), enabling humans and AI Agents to interact with services including documents, smart tables, messages, contacts, to-dos, meetings, and schedules directly from the terminal. Supports macOS, Linux, and Windows.

Tokens
31.5K
Snippets
80
Records
164
Agent score
84%

What's inside wecom-cli

  1. Overview of the wecomcli-todo skill

    main

    The wecomcli-todo skill provides management capabilities for WeCom (Enterprise WeChat) To-Do items via the wecom-cli. It allows for reading and writing operations such as creating, updating, deleting, and querying To-Do tasks.

    Common use cases include:

    • Creating new tasks or reminders.
    • Assigning tasks to specific users.
    • Marking tasks as completed, accepted, or rejected.
    • Updating task content or deadlines.
    • Listing or searching for To-Do items and their details.
  2. Overview of wecomcli-smartsheet skill

    main

    The wecomcli-smartsheet skill is a resource-based skill for managing Enterprise WeChat Smartsheets (/smartsheet/*, doc_type=10). It allows for the creation of new smartsheets, management of structures (sub-sheets and fields/columns), and management of data (records).

    All interfaces support locating a document using either a docid or a url.

    Important Distinctions:

    • For regular documents (/doc/*), use wecomcli-doc.
    • For online spreadsheets (/sheet/*), use wecomcli-sheet.
    • For smart pages (/smartpage/*), use wecomcli-smartpage.
  3. Overview of wecom-cli capabilities

    main

    wecom-cli is a command-line tool designed to allow both humans and AI Agents to interact with WeCom (Enterprise WeChat) directly from the terminal. It covers several core business categories:

    • Documents (📄 文档): Create, read, and edit documents, including intelligent document creation and reading.
    • Smart Tables (📊 智能表格): Manage smart tables, sub-tables, fields, and perform CRUD operations on records.
    • Messages (💬 消息): Query conversation lists, pull message records (text, images, files, voice, video), download multimedia, and send text messages.
    • Contacts (👤 通讯录): Retrieve member lists within visible scope and search by name or alias.
    • To-dos (✅ 待办): Create, read, update, and delete to-dos, and update user processing status.
    • Meetings (🎥 会议): Create, cancel, or update meeting appointments and invited members; query meeting lists and details.
    • Schedules (📅 日程): Manage schedules and query availability for multiple members.

    Use Case Scenarios:

    • Enterprises (10+ people): Focuses on Document and To-do CLI capabilities for API-mode intelligent robots to improve office efficiency.
    • Individuals/Small Teams (≤10 people): Provides a broader range of capabilities including Messages, Documents, Schedules, Meetings, and To-dos.
  4. Getting started with wecom-cli documentation

    main

    The wecom-cli documentation is organized into specialized guides located in the docs/ directory. Use the following resources to navigate the project:

    • CLI Reference: For detailed usage methods, runtime paths, and environment variables, refer to docs/cli-reference.md.
    • Skills Navigation: To understand the division of labor and entry points for built-in Skills, refer to docs/skills.md.
    • Local Development: For information on local development, debugging, and the repository structure, refer to docs/development.md.
  5. Manage WeCom Online Sheets with wecom-cli

    main

    The wecomcli-sheet skill allows you to manage WeCom Online Sheets (/sheet/*). You can create new blank sheets, read full content in Markdown format, retrieve basic document information and sub-sheet (worksheet) lists, modify specific cell ranges, append rows, and manage sub-sheets.

    Important Distinctions:

    • For Smart Sheets (/smartsheet/*), use wecomcli-smartsheet.
    • For regular documents (/doc/*), use wecomcli-doc.
    • For Smart Pages (/smartpage/*), use wecomcli-smartpage.

    Prerequisites:

    • You must have wecom-cli installed.
    • All commands are executed via the wecom-cli doc category.
    wecom-cli doc <tool_name> '<json_params>'
  6. Manage WeCom Smartpages with wecom-cli

    main

    The wecomcli-smartpage skill allows you to manage WeCom Smartpages (formerly known as Smart Homepages, /smartpage/*). It provides capabilities to:

    1. Create Smartpages: Publish one or more local Markdown files as a Smartpage.
    2. Export Smartpage Content: Asynchronously export Smartpage content back into Markdown format.

    Important Distinctions:

    • Use wecomcli-smartpage for /smartpage/* URLs.
    • Use wecomcli-doc for regular documents (/doc/*).
    • Use wecomcli-sheet for online spreadsheets (/sheet/*).
    • Use wecomcli-smartsheet for smart spreadsheets (/smartsheet/*).

    All commands are executed via the wecom-cli binary using the doc category.

  7. Use the wecomcli-schedule skill for Enterprise WeChat schedule management

    main

    The wecomcli-schedule skill allows users to manage Enterprise WeChat schedules via the wecom-cli command line. It supports querying schedule lists, retrieving detailed information, creating, updating, and canceling schedules, managing attendees, and checking user availability.

    Usage Pattern: All interactions follow the pattern: wecom-cli schedule <interface_name> '<json_input>'.

    Important Constraints:

    • Time Range: Schedule list queries are only supported for 30 days before and after the current day.
    • Time Formats: Input parameters use string formats like YYYY-MM-DD HH:mm:ss. However, returned values like start_time and end_time are Unix timestamps (seconds) and must be converted to human-readable formats.
    • User IDs: When managing attendees, you must first use the wecomcli-contact skill to obtain the correct userid. Do not expose raw userids to users; if multiple users have the same name, present candidates for selection.
  8. Understand the wecom-cli repository structure

    main

    The repository is organized into several key directories that separate the core logic, the entry point, and platform-specific binaries:

    • src/: Contains the main Rust CLI implementation, including command parsing, authentication, JSON-RPC, logging, and media processing.
    • bin/wecom.js: The npm entry point script responsible for locating and executing the binary for the current platform.
    • packages/*: Contains the npm binary packages for various platforms.
    • skills/*: Contains Agent Skills and supplementary reference materials.
    • docs/: Contains usage and development documentation.
    • README.md: The project homepage.
  9. How to call wecom-cli meeting commands

    main

    All WeCom meeting management operations are performed using the wecom-cli meeting command followed by a specific tool name and a JSON string containing the parameters.

    Command Syntax:

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

    Available tool names include create_meeting, list_user_meetings, get_meeting_info, cancel_meeting, and set_invite_meeting_members.

    wecom-cli meeting <tool_name> '<json_params>'
  10. Configure the follower_list object for todo commands

    main

    When calling commands that involve participants (like create_todo or update_todo), the follower_list must be provided as an object containing a followers array.

    Important Behavior for update_todo:

    • update_todo performs a full replacement, not an append. To add a new participant, you must first call get_todo_detail to retrieve the existing list, merge the new participant into it, and then submit the full list.
    • update_todo will not change the follower_status of participants. To change a user's status in a task, use the change_todo_user_status command instead.

    Field Definitions:

    • follower_id: The user's userid (follow the retrieval priority rules).
    • follower_status: The participant's status. This field is only effective during create_todo:
      • 0: Rejected
      • 1: Accepted
      • 2: Completed
    "follower_list": {
        "followers": [
            {
                "follower_id": "FOLLOWER_ID",
                "follower_status": 1
            }
        ]
    }
  11. Rules for time ranges and chat ID lookup

    main

    Time Range Rules

    • Format: Use YYYY-MM-DD HH:mm:ss.
    • Default: If unspecified, defaults to the last 7 days.
    • Limits: Start time cannot be earlier than 7 days ago; end time cannot be later than the current time.
    • Relative Time: Supports terms like "yesterday" or "last three days".

    chatid Lookup Rules

    When a user provides a name or group name instead of an ID:

    1. Call get_msg_chat_list for the relevant time range.
    2. Match against chat_name in the returned chats list.
    3. Matching Strategy:
      • Unique match: Use the ID directly.
      • Multiple matches: Present a list for the user to choose.
      • No match: Inform the user.
    4. chat_type Inference: If the user mentions a "group" (群), use chat_type=2. Otherwise, default to chat_type=1 (single chat).
  12. Search for personnel by name or alias

    main

    Since get_userlist returns the full visible list, searching is performed via local filtering of the results.

    Filtering Strategies:

    • Exact Match: If name or alias matches the keyword exactly, use the result directly.
    • Fuzzy Match (Single Result): If the keyword is contained within name or alias and only one result is found, use that result.
    • Fuzzy Match (Multiple Results): If multiple members match the keyword, you must present a candidate list to the user and ask them to select the correct person. Do not attempt to guess.
    • No Match: Inform the user that no matching personnel were found.

    Note: Always perform a null/empty check on the alias field before searching.