Use wecom-cli to operate WeCom smart sheets to record and track the operational data of social media accounts.
Initial Configuration (Automatic Initialization)
Before performing any operation, first check whether a social tracking configuration already exists in memory. If not, automatically create it according to the following process:
Step 1: Create a smart sheet
wecom-cli doc create_doc '{"doc_type": 10, "doc_name": "社交媒体追踪"}'
Obtain from the returned result docid。
Step 2: Create sub-sheets and fields
# 创建子表1: 社交账号配置
wecom-cli doc smartsheet_add_sheet '{"docid": "<DOCID>", "sheet_name": "社交账号"}'
# 创建子表2: 每日快照
wecom-cli doc smartsheet_add_sheet '{"docid": "<DOCID>", "sheet_name": "每日快照"}'
# 创建子表3: 内容表现
wecom-cli doc smartsheet_add_sheet '{"docid": "<DOCID>", "sheet_name": "内容表现"}'
Obtain the sheet_idof each sub-sheet, then add fields:
Social account fields:
wecom-cli doc smartsheet_add_fields '{"docid": "<DOCID>", "sheet_id": "<SHEET_ID>", "fields": [
{"field_title": "平台", "field_type": "FIELD_TYPE_SINGLE_SELECT"},
{"field_title": "账号名", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "主页链接", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "状态", "field_type": "FIELD_TYPE_SINGLE_SELECT"},
{"field_title": "备注", "field_type": "FIELD_TYPE_TEXT"}
]}'
Daily snapshot fields:
wecom-cli doc smartsheet_add_fields '{"docid": "<DOCID>", "sheet_id": "<SHEET_ID>", "fields": [
{"field_title": "平台", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "账号名", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "日期", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "粉丝数", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "新增粉丝", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "内容总数", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "互动率", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "备注", "field_type": "FIELD_TYPE_TEXT"}
]}'
Content performance fields:
wecom-cli doc smartsheet_add_fields '{"docid": "<DOCID>", "sheet_id": "<SHEET_ID>", "fields": [
{"field_title": "平台", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "账号名", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "内容ID", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "标题", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "发布日期", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "点赞", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "评论", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "分享", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "播放数", "field_type": "FIELD_TYPE_TEXT"},
{"field_title": "备注", "field_type": "FIELD_TYPE_TEXT"}
]}'
Step 3: Save the configuration to memory
Save the following information to the memory file social-tracker-config.md:
---
name: social-tracker-config
description: 社交媒体追踪智能表格配置信息,包含 docid、各子表 sheet_id
type: project
---
## 社交追踪表配置
- docid: <DOCID>
- url: <创建时返回的URL>
- 表格名称: 社交媒体追踪
- 社交账号 sheet_id: <SHEET_ID>
- 每日快照 sheet_id: <SHEET_ID>
- 内容表现 sheet_id: <SHEET_ID>
Operation Process
In the following commands,
<DOCID>and each<SHEET_ID>are read from social-tracker-config in memory.
Mode 1: Account Management
Add account:
wecom-cli doc smartsheet_add_records '{"docid": "<DOCID>", "sheet_id": "<社交账号SHEET_ID>", "records": [{"values": {
"平台": [{"text": "YouTube"}],
"账号名": [{"type": "text", "text": "@mychannel"}],
"主页链接": [{"type": "text", "text": "https://youtube.com/@mychannel"}],
"状态": [{"text": "活跃"}],
"备注": [{"type": "text", "text": ""}]
}}]}'
Query added accounts:
wecom-cli doc smartsheet_get_records '{"docid": "<DOCID>", "sheet_id": "<社交账号SHEET_ID>"}'
Update account status:
wecom-cli doc smartsheet_update_records '{"docid": "<DOCID>", "sheet_id": "<社交账号SHEET_ID>", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE", "records": [{"record_id": "RECORD_ID", "values": {
"状态": [{"text": "暂停"}]
}}]}'
Mode 2: Manually Enter Snapshots
The user directly tells the AI the data, and the AI calculates the increment and writes it in.
Interaction process:
- User: "YouTube has 1000 followers today, posted 3 pieces of content, engagement rate 4.5%"
- The AI queries the previous snapshot and calculates the new followers
- Write the snapshot record
- If a milestone is reached (such as every 500 followers), send a message notification
# 先查询上一次快照获取上次粉丝数
wecom-cli doc smartsheet_get_records '{"docid": "<DOCID>", "sheet_id": "<每日快照SHEET_ID>"}'
# 写入新快照
wecom-cli doc smartsheet_add_records '{"docid": "<DOCID>", "sheet_id": "<每日快照SHEET_ID>", "records": [{"values": {
"平台": [{"type": "text", "text": "YouTube"}],
"账号名": [{"type": "text", "text": "@mychannel"}],
"日期": [{"type": "text", "text": "2026-04-02"}],
"粉丝数": [{"type": "text", "text": "1000"}],
"新增粉丝": [{"type": "text", "text": "12"}],
"内容总数": [{"type": "text", "text": "45"}],
"互动率": [{"type": "text", "text": "4.5%"}],
"备注": [{"type": "text", "text": ""}]
}}]}'
Mode 3: Trend Analysis
Query snapshot data for a specified time range and generate a trend report.
Interaction process:
- User: "Which platform grew the fastest this week?"
- The AI queries snapshots from the past 7 days
- Calculate growth rate and content output
- Generate a comparison table
# 查询所有快照记录
wecom-cli doc smartsheet_get_records '{"docid": "<DOCID>", "sheet_id": "<每日快照SHEET_ID>"}'
# AI 根据日期过滤后计算:
# - 每个平台的起始粉丝数和结束粉丝数
# - 增长率 = (结束-起始) / 起始 * 100%
# - 新增内容数
# - 生成趋势报告
Example trend report format:
## 社交媒体趋势报告(3/26-4/2)
| 平台 | 起始粉丝 | 结束粉丝 | 增长率 | 新增内容 |
|------|---------|---------|--------|---------|
| YouTube | 950 | 1000 | +5.3% | 3 |
| Instagram | 500 | 550 | +10% | 8 |
增长最快:Instagram(+10%)
Mode 4: Record Content Performance
The user manually enters the performance data of a single piece of content.
wecom-cli doc smartsheet_add_records '{"docid": "<DOCID>", "sheet_id": "<内容表现SHEET_ID>", "records": [{"values": {
"平台": [{"type": "text", "text": "YouTube"}],
"账号名": [{"type": "text", "text": "@mychannel"}],
"内容ID": [{"type": "text", "text": "vid_001"}],
"标题": [{"type": "text", "text": "AI编程工具对比"}],
"发布日期": [{"type": "text", "text": "2026-04-01"}],
"点赞": [{"type": "text", "text": "150"}],
"评论": [{"type": "text", "text": "32"}],
"分享": [{"type": "text", "text": "18"}],
"播放数": [{"type": "text", "text": "5000"}],
"备注": [{"type": "text", "text": ""}]
}}]}'
Query best-performing content:
wecom-cli doc smartsheet_get_records '{"docid": "<DOCID>", "sheet_id": "<内容表现SHEET_ID>"}'
# AI 按播放数/互动率排序,找出表现最好的内容
Milestone Notifications
When an account's follower count reaches a milestone, notify the user via message:
wecom-cli msg send_message '{"chat_type": 1, "chatid": "<USERID>", "msgtype": "text", "text": {"content": "YouTube @mychannel 粉丝突破 1000!本周新增 12 粉丝。"}}'
Data Source Description
At the current stage, three data sources are supported:
- AI WebSearch — Search public data such as Social Blade to obtain follower information
- Manual user entry — The user directly tells the AI the values
- API integration (future) — Reserve integration points for YouTube/Instagram/Twitter/TikTok APIs
Field Type Writing Format (General Rules)
For the complete field type format description, see crm-schema
| Field Type | Writing Format | Example |
|---|---|---|
| TEXT | [{"type":"text","text":"值"}] |
Account name, follower count, date, etc. |
| SINGLE_SELECT | [{"text":"选项文本"}] |
Single-select fields such as platform and status |
Numeric fields (follower count, engagement rate, etc.) are stored as TEXT type, and the AI converts them to numbers for calculation after reading them.
Practical notes
Common pitfalls
- key_type not passed on update — the field title cannot be identified; it must be included
"key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE" - When an API call fails — check the error code: 301085 means the docid is invalid (use url instead); 2022004 means the field was not found (call add_fields first); 2022003 means the record does not exist (call add_records first). When you encounter an error, first use
smartsheet_get_sheet '{"url": "<URL>"}'to verify the table structure. - SINGLE_SELECT option mismatch — the platform name and status must exactly match the existing options in the table
- options do not take effect when creating a SINGLE_SELECT —
smartsheet_add_fieldstheproperty.optionspassed in will not pre-create options; options are automatically created via[{"text": "选项"}]when a record is first written. When creating the field, thepropertyparameter can be omitted. - New followers must be calculated manually — query the previous snapshot and subtract the previous follower count from the current follower count
- Unified date format — use the
YYYY-MM-DDformat
Scheduled automation recommendations
| Task | Recommended time | Cron |
|---|---|---|
| Daily snapshot collection | Every day at 22:30 | 30 22 * * * |
| Weekly trend report | Every Sunday at 21:00 | 0 21 * * 0 |
Data integration
- This Skill runs independently, but its data will be read by the following Skills:
wecomcli-workflow-morning-brief— the briefing includes yesterday's data performancewecomcli-workflow-business-advisor— used for analysis by the marketing advisor and growth advisor