add-feishu
Skill139 starsChanged 9 months agoMITView on GitHub
Add Feishu (飞书/Lark) as a channel. Uses WebSocket long connection mode — no public URL needed. Bot responds to all messages (no trigger required).
- Reads credentials
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- claude-session-managerSkill
- codex-cliSkill
- codex-session-managerSkill
- cover-designSkill
- cover-imageSkill
- diagram-to-imageSkill
- fpl-copilotSkill
- interactive-inputSkill
- mining-session-skillsSkill
- Next.js Security ScanSkill
- personal-chinese-writing-styleSkill
- producing-videoSkill
- promote-postSkill
- publish-substack-articleSkill
- publish-x-articleSkill
- publish-zsxq-articleSkill
- Python Security ScanSkill
- share-readingSkill
- slides-videoSkill
- subtitle-correctionSkill
- tweet-insightSkill
- video-plannerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 4 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Read .nanoclaw/state.yaml.
- Very specific: line 18
Use AskUserQuestion to collect configuration:
- Very specific: line 22
If they have one, collect FEISHU_APP_ID and FEISHU_APP_SECRET now.
- Very specific: line 26
Run the skills engine to apply this skill's code package.
- Very specific: line 30
If .nanoclaw/ directory doesn't exist yet:
- Distinctive: line 49
If the apply reports merge conflicts, read the intent file:
- Distinctive: line 64
If the user doesn't have a Feishu app, tell them:
- Distinctive: line 77
Wait for the user to provide the App ID and App Secret.
- Very specific: line 161
Verify the app has im:message permission
- Very specific: line 162
Verify the event im.message.receive_v1 is subscribed
- Distinctive: line 163
Check that the app version is published and approved
- Very specific: line 179
Remove FeishuChannel import and creation block from src/index.ts
- Very specific: line 180
Remove readEnvFile import if no other channel uses it
- Very specific: line 181
Remove FEISHU_APP_ID and FEISHU_APP_SECRET from .env
- Very specific: line 182
Remove Feishu registrations: sqlite3 store/messages.db "DELETE FROM registered_groups WHERE jid LIKE '%@feishu'"
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Feishu Channel
This skill adds Feishu (飞书) support to NanoClaw using the skills engine for deterministic code changes, then walks through interactive setup.
Phase 1: Pre-flight
Check if already applied
Read .nanoclaw/state.yaml. If feishu is in applied_skills, skip to Phase 3 (Setup). The code changes are already in place.
Ask the user
Use AskUserQuestion to collect configuration:
AskUserQuestion: Do you have a Feishu app already, or do you need to create one?
If they have one, collect FEISHU_APP_ID and FEISHU_APP_SECRET now. If not, we'll create one in Phase 3.
Phase 2: Apply Code Changes
Run the skills engine to apply this skill's code package. The package files are in this directory alongside this SKILL.md.
Initialize skills system (if needed)
If .nanoclaw/ directory doesn't exist yet:
npx tsx scripts/apply-skill.ts --initApply the skill
npx tsx scripts/apply-skill.ts .claude/skills/add-feishuThis deterministically:
- Adds
src/channels/feishu.ts(FeishuChannel class implementing Channel interface) - Three-way merges Feishu support into
src/index.ts(reads credentials viareadEnvFile, creates FeishuChannel if configured) - Installs the
@larksuiteoapi/node-sdknpm dependency - Updates
.envwithFEISHU_APP_IDandFEISHU_APP_SECRET - Records the application in
.nanoclaw/state.yaml
If the apply reports merge conflicts, read the intent file:
modify/src/index.ts.intent.md— what changed and invariants for index.ts
Validate code changes
npm run buildBuild must be clean before proceeding.
Phase 3: Setup
Create Feishu App (if needed)
If the user doesn't have a Feishu app, tell them:
I need you to create a Feishu bot:
- Go to Feishu Open Platform and create a new app
- Under Credentials, copy the App ID and App Secret
- Under Event Subscriptions, enable Long Connection (WebSocket) mode
- Add the event:
im.message.receive_v1(Receive messages)- Under Permissions, add:
im:message:send_as_bot(Send messages as bot)im:message(Read messages)- Publish the app (or create a version and approve it)
Wait for the user to provide the App ID and App Secret.
Configure environment
Add to .env:
FEISHU_APP_ID=<their-app-id>
FEISHU_APP_SECRET=<their-app-secret>Build and restart
npm run build
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
# Linux: systemctl --user restart nanoclawPhase 4: Registration
Get Chat ID
Tell the user:
- Start the bot:
npm run dev- Send any message to the bot in Feishu (DM or group)
- Check the logs — the chat_id will appear in the metadata
- The JID format is
{chat_id}@feishu
Or check the database directly:
sqlite3 store/messages.db "SELECT jid FROM chats WHERE jid LIKE '%@feishu'"Register the chat
Register directly in SQLite:
INSERT INTO registered_groups (jid, name, folder, trigger_pattern, added_at, requires_trigger)
VALUES ('{chat_id}@feishu', 'feishu', 'feishu', '@{ASSISTANT_NAME}', datetime('now'), 0);Note: requires_trigger is set to 0 (false) so the bot responds to all messages without needing @mention.
Then restart the service to pick up the new registration.
Phase 5: Verify
Test the connection
Tell the user:
Send a message to the bot in Feishu. It should respond within a few seconds.
Check logs if needed
tail -f logs/nanoclaw.log
# Or run interactively:
npm run devLook for:
Feishu bot info fetched— bot connected and identified itselfConnected to Feishu via WebSocket— WebSocket establishedFeishu message sent— outbound message delivered
Troubleshooting
Bot not responding
Check:
FEISHU_APP_IDandFEISHU_APP_SECRETare set in.env- Chat is registered:
sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE '%@feishu'" - App is published on Feishu Open Platform (draft apps don't receive events)
- Event subscription
im.message.receive_v1is enabled - Long Connection (WebSocket) mode is enabled (not webhook)
- Service is running:
launchctl list | grep nanoclaw(macOS) orsystemctl --user status nanoclaw(Linux)
Bot connects but doesn't receive messages
- Verify the app has
im:messagepermission - Verify the event
im.message.receive_v1is subscribed - Check that the app version is published and approved
Bot receives but can't send
- Verify the app has
im:message:send_as_botpermission - For group chats: the bot must be added to the group first
"Failed to fetch Feishu bot info"
Non-critical warning. Bot message detection (filtering own messages) won't work, but message sending/receiving still functions. Usually means the bot API endpoint isn't accessible — check network connectivity.
Removal
To remove Feishu integration:
- Delete
src/channels/feishu.ts - Remove
FeishuChannelimport and creation block fromsrc/index.ts - Remove
readEnvFileimport if no other channel uses it - Remove
FEISHU_APP_IDandFEISHU_APP_SECRETfrom.env - Remove Feishu registrations:
sqlite3 store/messages.db "DELETE FROM registered_groups WHERE jid LIKE '%@feishu'" - Uninstall:
npm uninstall @larksuiteoapi/node-sdk - Rebuild:
npm run build && launchctl kickstart -k gui/$(id -u)/com.nanoclaw(macOS) ornpm run build && systemctl --user restart nanoclaw(Linux)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

