WeCom CLI Tool: Let AI Agents Directly Operate Messages, Docs, Calendar, and Contacts
WeCom (Enterprise WeChat) recently open-sourced a CLI tool. It’s not a command-line tool for regular employees to use directly—it’s an official channel for AI agents to operate WeCom programmatically.
Once installed, agents can send messages, query documents, create calendar events, schedule meetings, search contacts, and upload files to WeDrive. The whole process requires no integration code and no callback configuration.
This article walks through the actual operation sequence: what it can do, how to install it, how to use it, and how permissions work.
What Business Capabilities Does the CLI Cover
The official documentation describes it as covering “messages, emails, documents, to-dos, calendar, meetings, WeDrive, and contacts.” Here’s the breakdown of what each module actually does:
Messages: Actively push messages to single chats or groups the bot has recently communicated with. Supports Markdown, images, files, voice, and video messages.
Emails: Send, reply to, and forward emails. Search emails and retrieve detailed email content.
Documents: Create online documents, import content, read content, and append or overwrite writes. Supports searching across multiple document types, plus rename, permission management, and join rule configuration.
Spreadsheets: Create new spreadsheets, import CSV/Excel, read and modify content, append rows, and manage sheets.
Smart Sheets: Create smart sheets, manage fields, records, views, charts, and modify row and column styling.
Smart Documents: Create smart documents, retrieve page content, edit content, and access embedded data table information.
To-Dos: Create, read, update, and delete to-do items. Assign participants and mark tasks as complete.
Calendar: Create, update, delete, and retrieve calendar events. Manage participants, check availability of multiple members, and search for and book meeting rooms.
Meetings: Create scheduled meetings, cancel meetings, update attendees, query lists and details, and retrieve meeting minutes and transcripts.
WeDrive: Search WeDrive files, retrieve basic information, upload, and download.
Contacts: Search members by name, pinyin, or alias. Retrieve member profiles, used in scenarios like meetings and calendar events that involve multiple people.
This set covers the most frequently used WeCom operations. A few real-world scenarios:
In one official example, an agent was asked to “send the generated report document to the Product Group 4 group chat.” The agent returned confirmation with the target group, document name, and send time. The message went from generation to delivery in one command.
For documents, the agent can “create documents, search documents, read document content, and edit documents created by the bot.” One limitation to note: edit permissions only apply to documents the bot created itself—it can’t modify every document in the system.
Spreadsheets and smart sheets work similarly—create, search, read, and edit bot-created sheets. An actual scenario from the official screenshots: given a spreadsheet link and asked to “find all records marked as ‘overdue’ in this WeCom sheet and summarize them,” the agent actually read the sheet, filtered by the condition, and returned structured results.
Calendar has a particularly useful feature: checking availability. The agent can check multiple members’ calendars for free time, then create the event directly. Official example: “Schedule a review meeting—check my availability and that of Xing Zi, Wu Youyin, and Lao Dongjie for next week, find an evening when everyone’s free, and book an hour.” From checking availability to creating the event, one conversation closes the loop.
Contacts work the same way: “Find a colleague named Chen Zihao in the directory and schedule a meeting.” The agent returns matching member info and then creates the meeting.
Installation: Four Paths, Choose the One That Fits
The official documentation provides four installation methods.
Method 1: Install via conversation with an agent
Send this directly to your agent:
帮我安装 npx skills add WecomTeam/wecom-unified -y -g
The agent automatically downloads and installs the CLI tool, then triggers a QR code flow. Scan it with WeCom, and you’ve completed bot creation and authorization. This is the simplest approach—no manual credential configuration needed.
Method 2: Install in the system terminal
Prerequisites: Node.js >= version 18, and a WeCom account. For long-connection mode, you’ll also need to create a bot and retrieve its Bot ID and Secret.
Step 1: install the CLI:
npm install -g @wecom/cli
Step 2: install the CLI Skill (required—don’t skip this):
npx skills add WeComTeam/wecom-cli -y -g
Step 3: configure credentials. Interactive configuration, run once:
wecom-cli auth init
Default is QR code login. If you need to input credentials manually, add the --manual flag.
Check authorization status with:
wecom-cli auth show
Method 3: Install via agent platform skill marketplace
Major Chinese agent platforms have been gradually integrating the WeCom CLI tool. Take WorkBuddy as an example—it has the WeCom CLI Skill built in. The path is WorkBuddy -> Connectors -> Add WeCom. After scanning to create and authorize the bot, you can use it directly in conversations.
Method 4: Copy MCP configuration from within WeCom
If your agent supports the MCP protocol, use this approach.
Prerequisite: you’ve already created an API-mode bot in WeCom. The path is Workspace -> AI Bot -> Management, find the bot and click Edit. In the edit page, click “Available Permissions” -> “Authorize,” check the required permissions. Then click the arrow on the permission item to enter the detail page and copy the MCP configuration—available as either MCP URL or MCP JSON Config.
Actual Usage: From Command to Result
Once installed, usage is straightforward—issue natural language commands to the agent. The CLI translates them into actual WeCom operations.
For document creation: the agent receives a command like “generate a WeCom online document, 2027 annual financial budget, outline the report structure,” creates the online document, and returns the link. From command to link, no extra confirmation steps.
For spreadsheet queries: given a spreadsheet link and asked to “find all overdue records in this WeCom sheet and summarize them,” the agent reads the sheet, filters by condition, and returns structured results. This means you can query business data directly in conversation without opening the spreadsheet yourself.
For calendar creation: the agent checks availability across multiple members, finds a common free slot, creates the event, and returns the details. Participants, time, and subject—all done in one command.
For contact search plus meeting scheduling: the agent first searches the directory to match members, then uses the returned profiles to create the meeting. Find people and book a meeting in one flow.
For WeDrive upload: upload a local file to the specified WeDrive space. The agent returns upload time, file size, and exact location.
One common thread across all these examples: every operation includes specific parameters—documents with titles and outlines, sheets with filter conditions, calendar entries with participants and times, meetings with subjects and links. The more specific the instruction, the more usable the result.
Permissions: Which Operations Require Approval and How to Bypass It
Permissions in the CLI fall into two categories.
Write operations: creating documents, scheduling calendar events, sending messages—these work immediately after the bot is authorized.
Read operations: searching and retrieving email content, document content, meeting information, WeDrive file content, and searching enterprise members—these involve data access and require approval by default.
The first time you ask the bot to “search document content” or “find someone in the directory,” the bot initiates an approval request. An admin needs to approve it in the backend before it can proceed.
If you want to skip the approval step, the enterprise can configure exemptions in the admin console.
Path: Admin Console -> Security & Management -> Management Tools -> AI Bot -> Management.
Two independent settings here:
-
In the section “Members whose created bots do not require approval for data access permissions,” add exempt members. Bots created by these members won’t require approval for document, email, meeting, or WeDrive data access permissions.
-
In the section “Members whose created bots do not require approval to search enterprise members,” add exempt members. Bots created by these members won’t require approval for the contact search permission.
To exempt the entire enterprise, select the root organizational unit as exempt.
These settings split “data reading” and “member search” into two separate controls. For example, an enterprise might allow bots to read documents but not search contacts—they can enable the first and leave the second off.
An Important Note
The CLI is typically used inside an agent, where the LLM translates natural language instructions into CLI calls. That makes the quality of the Skill definition critical—it determines whether the agent can correctly translate “schedule a meeting for me” into the proper calendar creation command.
The officially maintained Skill covers the dozen or so modules mentioned above, sufficient for daily office scenarios.
However, the official documentation also includes a risk notice: AI agents invoking CLI operations on internal WeCom applications may be affected by model hallucinations, posing risks of data leakage and privilege escalation. It’s recommended to test in a sandbox environment before deploying to production.
Quick Reference
Installation (simplest): Send 帮我安装 npx skills add WecomTeam/wecom-unified -y -g to your agent, scan the QR code.
Terminal installation:
npm install -g @wecom/cli
npx skills add WeComTeam/wecom-cli -y -g
wecom-cli auth init
Supported platforms: macOS (x64/arm64), Linux (x64/arm64), Windows (x64)
Node.js requirement: >= 18
Read operations requiring approval by default: searching email/document/meeting/WeDrive content, searching enterprise members
Exemption configuration path: Admin Console -> Security & Management -> Management Tools -> AI Bot -> Management
FAQ
What’s the relationship between CLI and MCP?
CLI is the command-line tool itself. MCP is an alternative integration method. The CLI capabilities are also available via MCP, for agents that require MCP protocol support. Both share the same underlying capabilities—just different integration approaches.
Is the Skill mandatory?
Yes. The npx skills add WeComTeam/wecom-cli -y -g step is required. Without the Skill, the CLI can’t be properly called by the agent.
Can the bot only edit documents it created itself?
Yes. Edit permissions for documents, spreadsheets, smart sheets, and smart documents are all limited to “bot-created” items. The bot cannot modify every document in the system.
Which operations require admin approval?
Searching and retrieving email content, document content, meeting information, WeDrive file content, and searching enterprise members. Create and send operations don’t require approval.
How do I configure exemption?
Admin Console -> Security & Management -> Management Tools -> AI Bot -> Management. Data read exemptions and member search exemptions are two separate switches, configurable independently.
Does it work on Windows?
Yes, Windows x64 is supported.
Is the CLI open source?
Yes, MIT License. GitHub: https://github.com/WecomTeam/wecom-cli

