Lark Report Collector
Collect weekly report data from Lark Reports, summarize into Lark Docs, and send notifications.
When to Use
- - "Collect this week's/last week's reports for Photo/Bloom/H&F"
- "Who hasn't submitted their weekly report?"
- "Summarize weekly reports into a Lark doc"
Hard Rules (battle-tested)
- 1. Reports is a SPA — curl/webfetch returns nothing. Must use
browser (profile=openclaw) - Pagination is reversed — Next = older weeks, Previous = newer weeks
- Always snapshot to confirm week title after pagination (most common error: collecting wrong week)
- One page may show multiple weeks — data is sorted by time, a single page can span 2-3 weeks
- blocktype mapping — 12=bullet, 13=ordered (NOT 9/10! Those are heading7/heading8)
- Never restart gateway inside a sub-agent (kills itself)
- Sub-agents need exact URLs and steps — don't let them explore on their own
Complete Workflow
Step 1: Navigate to Reports
CODEBLOCK0
Prerequisites: openclaw browser must have active Lark login session.
Step 2: Select Report Template
Snapshot and click the target template menuitem in the left sidebar "Received by me".
Step 3: Navigate to Target Week
Page defaults to latest data. Week title format: INLINECODE1
Pagination (critical):
- - Next button = older weeks ⬅️
- Previous button = newer weeks ➡️
- Page display: "2/25" (page 2 of 25), page 1 is newest
⚠️ Snapshot and confirm the date in the title after every page turn!
Step 4: Extract Submitted Members Data
- - Same page may show multiple weeks — only extract rows belonging to target week
- Paginate through all rows for the target week
- Append to local file after each extraction (prevents data loss)
Step 5: Get Unsubmitted List
"Not submitted: N" button has no snapshot ref. Click via JS evaluate:
CODEBLOCK1
Dialog shows: unsubmitted count + names + departments.
Step 6: Create Lark Doc
Create document via Lark Open API (see lark-api skill for auth).
block_type reference (verified):
| block_type | Type | JSON field |
|---|
| 2 | Text | INLINECODE3 |
| 3 |
Heading 1 |
"heading1" |
| 4 | Heading 2 |
"heading2" |
| 5 | Heading 3 |
"heading3" |
| 12 | Bullet list ✅ |
"bullet" |
| 13 | Ordered list ✅ |
"ordered" |
| 22 | Divider |
"divider" |
❌ 9=heading7, 10=heading8. NOT lists!
Step 7: Send Notification
Send message via Lark API with doc link.
Lessons Learned (6 real attempts)
| # | Result | Root Cause | Lesson |
|---|
| 1 | ❌ Self-killed | Sub-agent ran INLINECODE10 | Never restart gateway in sub-agent |
| 2 |
⚠️ Wrong week | Collected Feb 10-14 instead of Feb 3-7 | Always confirm week title after pagination |
| 3 | ❌ 200K tokens burned | Tried
curl on SPA | Reports is SPA, browser only |
| 4 | ❌ 200K tokens burned | Sub-agent explored on its own | Give exact URLs and steps |
| 5 | ✅ Success | Precise instructions + correct block_types | Template is key |
Known Limitations
- - Lark Report Open API unavailable on international version (returns 404) — browser only
- Browser login session may expire — re-login needed
- Export button (Excel) untested — potential alternative
Lark Report Collector
从Lark周报中收集周报数据,汇总到Lark文档中,并发送通知。
使用场景
- - 收集Photo/Bloom/H&F本周/上周的周报
- 谁还没有提交周报?
- 将周报汇总到Lark文档中
硬性规则(经过实战验证)
- 1. 周报是单页应用 — curl/webfetch无法获取数据。必须使用browser(profile=openclaw)
- 翻页方向相反 — 下一页=更早的周,上一页=更新的周
- 翻页后务必截图确认周标题(最常见的错误:收集了错误的周)
- 一页可能显示多周数据 — 数据按时间排序,单页可能跨越2-3周
- blocktype映射 — 12=无序列表,13=有序列表(不是9/10!那是标题7/标题8)
- 绝不在子代理内重启网关(会导致自身崩溃)
- 子代理需要精确的URL和步骤 — 不要让它们自行探索
完整工作流程
步骤1:导航到周报
browser action=navigate profile=openclaw targetUrl=https://oa.larksuite.com/report/record/entry
前置条件:openclaw浏览器必须已登录Lark账号。
步骤2:选择周报模板
截图并点击左侧边栏我收到的中的目标模板菜单项。
步骤3:导航到目标周
页面默认显示最新数据。周标题格式:2月2日 ~ 2月8日 已提交:18
翻页(关键):
- - 下一页按钮 = 更早的周 ⬅️
- 上一页按钮 = 更新的周 ➡️
- 页面显示:2/25(共25页的第2页),第1页为最新
⚠️ 每次翻页后务必截图并确认标题中的日期!
步骤4:提取已提交成员数据
- - 同一页面可能显示多周数据 — 只提取属于目标周的行
- 翻页遍历目标周的所有行
- 每次提取后追加到本地文件(防止数据丢失)
步骤5:获取未提交名单
未提交:N按钮没有截图引用。通过JS评估点击:
javascript
(() => {
const btns = [...document.querySelectorAll(button)].filter(
b => /Not submitted.*\d/.test(b.innerText)
);
if(btns.length) { btns[0].click(); return clicked; }
return not found;
})()
对话框显示:未提交数量 + 姓名 + 部门。
步骤6:创建Lark文档
通过Lark开放API创建文档(认证方式参见lark-api技能)。
block_type参考(已验证):
| block_type | 类型 | JSON字段 |
|---|
| 2 | 文本 | text |
| 3 |
标题1 | heading1 |
| 4 | 标题2 | heading2 |
| 5 | 标题3 | heading3 |
| 12 | 无序列表 ✅ | bullet |
| 13 | 有序列表 ✅ | ordered |
| 22 | 分割线 | divider |
❌ 9=标题7,10=标题8。不是列表!
步骤7:发送通知
通过Lark API发送包含文档链接的消息。
经验教训(6次实际尝试)
| # | 结果 | 根本原因 | 教训 |
|---|
| 1 | ❌ 自毁 | 子代理执行了gateway restart | 绝不在子代理中重启网关 |
| 2 |
⚠️ 周数错误 | 收集了2月10-14日而非2月3-7日 | 翻页后务必确认周标题 |
| 3 | ❌ 消耗20万tokens | 尝试用curl访问单页应用 | 周报是单页应用,只能用浏览器 |
| 4 | ❌ 消耗20万tokens | 子代理自行探索 | 提供精确的URL和步骤 |
| 5 | ✅ 成功 | 精确的指令+正确的block_type | 模板是关键 |
已知限制
- - 国际版无法使用Lark周报开放API(返回404)— 仅限浏览器
- 浏览器登录会话可能过期 — 需要重新登录
- 导出按钮(Excel)未测试 — 可能是替代方案