SkillsMar 30, 2026·1 min read

Lark CLI Skill: Events — Real-Time Event Subscriptions

Lark/Feishu CLI skill for event-driven workflows. WebSocket real-time event listening with regex routing and NDJSON output.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Stage only
Trust
Trust: Community
Entrypoint
Lark CLI Skill: Events — Real-Time Event Subscriptions
Safe staging command
npx -y tokrepo@latest install d74aa20d-6376-47bd-8e48-8e9af76504e9 --target codex

Stages files first; activation requires review of the staged README and plan.

TL;DR
Lark CLI skill that enables real-time WebSocket event listening with regex routing and NDJSON output.
§01

What it is

This is a Lark/Feishu CLI skill for event-driven workflows. It provides WebSocket real-time event listening with regex-based routing and NDJSON output, designed for automation pipelines and integrations.

The skill is part of the Lark CLI, a command-line tool for the Lark/Feishu Open Platform. It is best for teams using Lark/Feishu for workplace collaboration who want to build event-driven automations.

§02

How it saves time or tokens

Instead of polling the Lark API for changes, this skill uses WebSocket connections to receive events in real time. Regex routing filters events at the source, reducing noise in your pipeline. NDJSON output integrates directly with tools like jq, making it easy to chain event processing without writing custom parsers. The estimated token cost is around 500 tokens.

§03

How to use

  1. Install the Lark CLI and this skill:
npm install -g @larksuite/cli
npx skills add larksuite/cli -y -g
  1. Configure authentication:
lark-cli config init
lark-cli auth login --recommend
  1. Start listening for events with regex filtering
§04

Example

# Listen for all message events
lark-cli events listen --pattern 'im.message.*'

# Filter to specific event types with NDJSON output
lark-cli events listen --pattern 'im.message.receive_v1' --format ndjson

# Pipe to jq for processing
lark-cli events listen --pattern 'im.message.*' --format ndjson | \
  jq '.event.message.content'
§05

Related on TokRepo

§06

Common pitfalls

  • Not completing the auth setup before trying to listen for events
  • Using overly broad regex patterns that flood your pipeline with irrelevant events
  • Forgetting that WebSocket connections need to be re-established after network interruptions

Frequently Asked Questions

What is the Lark CLI?+

The Lark CLI is a command-line tool for the Lark/Feishu Open Platform with 200+ commands and 19 AI Agent Skills. It provides programmatic access to Lark workspace features including messaging, documents, and event subscriptions.

How does regex routing work for events?+

You specify a regex pattern when subscribing to events. Only events whose type matches the pattern are forwarded to your listener. This filters at the WebSocket level, reducing the data your pipeline processes.

What is NDJSON output format?+

NDJSON (Newline Delimited JSON) outputs one JSON object per line. This format works well with streaming tools like jq, grep, and awk, making it easy to build Unix-style processing pipelines for Lark events.

Can I use this skill with Feishu (the China version)?+

Yes. The Lark CLI supports both Lark (international) and Feishu (China) platforms. The events skill works with both, using the appropriate API endpoints based on your configuration.

Does the skill handle reconnection automatically?+

The WebSocket connection management is handled by the Lark CLI. If the connection drops, the CLI attempts to reconnect automatically. For production use, wrap the listener in a process manager like PM2.

Citations (3)
🙏

Source & Thanks

Created by LarkSuite. Licensed under MIT. larksuite/cli — 4,100+ GitHub stars

Part of the Lark CLI Official Skills Collection on TokRepo.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets