lark-event
Skill này làm gì
Skill này giúp agent AI nhận cập nhật thời gian thực từ Lark hoặc Feishu, như tin nhắn mới trong nhóm chat hoặc thay đổi công việc. Skill dành cho người xây dựng bot hoặc quy trình cần phản ứng ngay khi sự việc xảy ra.
Khi nào nên dùng
- ✓Khi bạn muốn một bot Lark hoặc Feishu trả lời tin nhắn mới ngay khi chúng đến.
- ✓Khi bạn cần theo dõi thay đổi trạng thái phê duyệt trong Lark và xử lý từng thay đổi.
- ✓Khi bạn xây dựng một trình lắng nghe chạy lâu dài, xử lý từng sự kiện Lark một.
Liên kết skill
https://github.com/larksuite/cli/blob/main/skills/lark-event/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể thiết lập một trình lắng nghe phản ứng với tin nhắn mới trong nhóm Lark của chúng tôi và ghi lại từng tin nhắn không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent chạy một lệnh Lark để lắng nghe các loại sự kiện đã chọn, và nhận từng sự kiện dưới dạng một dòng dữ liệu. Agent có thể lọc sự kiện, giới hạn số lượng đọc hoặc dừng sau một khoảng thời gian đã định.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Lark Events
Prerequisite: Read
../lark-shared/SKILL.mdfirst for authentication,--as user/botswitching,Permission deniedhandling, and safety rules.
Core commands
| Command | Purpose |
|---|---|
lark-cli event list [--json] |
List all subscribable EventKeys |
lark-cli event schema <EventKey> [--json] |
Show an EventKey's params and output schema |
lark-cli event consume <EventKey> [flags] |
Blocking consume; events → stdout NDJSON |
lark-cli event status [--json] [--fail-on-orphan] |
Inspect the local bus daemon status |
lark-cli event stop [--all] [--force] |
Stop the bus daemon |
Common flags
| Flag | Description |
|---|---|
--param key=value / -p |
Business params (repeatable; comma-separated for multi-value). Unknown keys fail with valid names listed inline |
--jq <expr> |
jq expression to filter / transform each event; empty output skips the event |
--max-events N |
Exit after N events. Default 0 = unlimited |
--timeout D |
Exit after duration D (e.g. 30s, 2m). Default 0 = no timeout. Whichever of --max-events / --timeout fires first wins |
--output-dir <dir> |
Write each event as a file (relative paths only; prevents traversal) |
--quiet |
Suppress ready/exit markers and per-event stderr diagnostics, including drop warnings. This can hide event loss. AI should not use this — it removes readiness and integrity signals |
--as user|bot|auto |
Identity for the session (see lark-shared) |
Examples
# Default: stream every event for the key (no filter, no projection)
lark-cli event consume im.message.receive_v1 --as bot
# List every EventKey of one domain (the authoritative, always-current catalog)
lark-cli event list --domain vc --json
# Grab one sample event to inspect payload shape
lark-cli event consume im.message.receive_v1 --max-events 1 --timeout 30s --as bot
# Run for 10 minutes then auto-exit
lark-cli event consume im.message.receive_v1 --timeout 10m --as bot
# Consume multiple EventKeys concurrently (one shape per process, no dispatcher)
lark-cli event consume im.message.receive_v1 --as bot > receive.ndjson &
lark-cli event consume im.message.reaction.created_v1 --as bot > reaction.ndjson &
wait
Call flow
lark-cli event list --json→ pick a legal key.--domain <d>narrows to one domain; the domains areapplication,approval,board,card,im,minutes,task,vc. An unknown domain fails with the valid set listed in the hint.lark-cli event schema <key> --json→ readresolved_output_schema+jq_root_pathto determine field pathslark-cli event consume <key> [--jq '<expr>']→ consume
Subprocess contract
Ready marker
event consume's stderr emits a fixed line [event] ready event_key=<key>. Parent processes should block on stderr until this line appears, then start reading stdout. Do not fall back to sleep.
stdin EOF = graceful exit
event consume treats stdin close as a shutdown signal (wired for AI subprocess callers). Bounded runs are exempt: when --max-events or --timeout is set (> 0), stdin EOF is ignored and the run exits only via its own bound, timeout, or SIGTERM. For unbounded runs, < /dev/null / nohup / systemd's default StandardInput=null will cause an immediate graceful exit (stderr reason: signal). To keep an unbounded run alive:
- Feed stdin a source that never EOFs:
< <(tail -f /dev/null) - Or run bounded:
--max-events N/--timeout D
Exit codes & reason
On exit, the last stderr line is [event] exited — received N event(s) in Xs (reason: ...).
| exit code | reason | Trigger |
|---|---|---|
| 0 | reason: limit |
--max-events reached |
| 0 | reason: timeout |
--timeout reached |
| 0 | reason: signal |
Ctrl+C / SIGTERM / stdin EOF (stdin EOF applies to unbounded runs only) |
| 1 | JSON error envelope on stderr | Lark API business failure during pre-consume setup (for example subscription create/delete) |
| 2 | JSON error envelope on stderr (no exited line) |
Validation failure (unknown EventKey, bad --param / --jq, another bus already connected) |
| 3 | JSON error envelope on stderr | Auth failure (missing token, missing scopes) |
| 4 / 5 | JSON error envelope on stderr | Network / internal failure (bus startup, handshake, file I/O) |
Startup and runtime failures emit a structured JSON envelope on stderr: `{"ok":false,"error":{"type"
Câu hỏi thường gặp
Tôi có cần đăng nhập Lark trước khi dùng không?
Có. Skill trỏ đến một hướng dẫn thiết lập Lark dùng chung, gồm đăng nhập và quyền truy cập, và nên đọc trước.
Agent có thể giới hạn số sự kiện nhận được không?
Có. Trình lắng nghe có thể dừng sau một số sự kiện đã định hoặc sau một khoảng thời gian đã định.
Tôi có thể lưu mỗi sự kiện vào file không?
Có. Skill có thể ghi từng sự kiện vào một file trong thư mục bạn chọn.
Chi tiết
Mô tả gốc của tác giả
Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Approval status changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses.
repo: larksuite/cli
Độ phổ biến
- Sao GitHub
- 18k
- Vị trí xếp hạng
- #10731
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Skill tương tự
knowledge-automation
394kGiúp agent của bạn thiết lập tác vụ định kỳ đưa nội dung mới vào kho Knowledge theo lịch, rồi kiểm tra tác vụ có chạy không.
knowledge-source-ingest
394kGiúp agent của bạn cập nhật Knowledge vault với các mục mới từ kênh chat, nguồn tin hoặc hộp thư, mà không thêm lại những gì đã có.
benchmark
280kGiúp agent của bạn đo tốc độ và hiệu suất của code, hữu ích để đảm bảo mọi thứ nhanh và tìm ra những chỗ chậm.