Skip to main content
skill CX Codex

add-feishu — Claude Code skill: Feishu channel for NanoClaw

Adds Feishu (飞书/Lark) as a NanoClaw channel over WebSocket. No public URL, and the bot answers every message without a mention.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add sugarforever/01coder-agent-skills --skill add-feishu -a claude-code
Open on GitHub

What add-feishu does

The skill makes deterministic code changes to NanoClaw: it adds src/channels/feishu.ts with a FeishuChannel class, three-way merges Feishu support into src/index.ts, installs the @larksuiteoapi/node-sdk dependency and writes FEISHU_APP_ID and FEISHU_APP_SECRET into .env. Setup is interactive — the agent asks whether you already have a Feishu app and, if not, walks you through creating one on the Feishu Open Platform.

Because the connection uses Long Connection (WebSocket) mode, no inbound webhook or public address is involved. In the app you enable the im.message.receive_v1 event and grant im:message:send_as_bot plus im:message. A draft app receives no events, so an unpublished version is the first thing to check when the bot stays quiet.

Chat registration is manual, straight in SQLite: the JID looks like {chat_id}@feishu, and the row in registered_groups is inserted with requires_trigger set to 0, which is why the bot reacts to any message in the chat. After the edits the skill has you run npm run build and restart the service. If the merge into src/index.ts reports conflicts, the intent file modify/src/index.ts.intent.md is where you sort them out.

What it helps with

  • wire Feishu into NanoClaw without a public URL
  • create a Feishu bot and grant the right permissions
  • register a chat in SQLite so replies need no mention
  • rebuild the project and restart the service after edits
  • resolve merge conflicts in src/index.ts

Example prompts for the agent

  • apply the add-feishu skill to this project
  • I already have a Feishu app, here is the App ID and App Secret — set up the channel
  • the bot is not answering in Feishu, check the permissions and event subscription

How to install add-feishu

1Skills CLI (Vercel)

npx skills add sugarforever/01coder-agent-skills --skill add-feishu -a claude-code

2Manually: put the files in place

~/.claude/skills/add-feishu/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/add-feishu/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about add-feishu

How do I install add-feishu in Claude?

Run npx skills add sugarforever/01coder-agent-skills --skill add-feishu -a claude-code. The skill file lands at ~/.claude/skills/add-feishu/SKILL.md.

What does add-feishu do?

It adds Feishu support to NanoClaw: creates the src/channels/feishu.ts channel, edits src/index.ts, installs @larksuiteoapi/node-sdk and writes the credentials to .env, then guides you through app setup and chat registration.

Why does the bot connect but never receive messages?

Check the im:message permission, the im.message.receive_v1 subscription, and that the app version is published and approved. In group chats the bot has to be added to the group first.

Source text

SKILL.md · MIT
---
name: add-feishu
description: Add Feishu (飞书/Lark) as a channel. Uses WebSocket long connection mode — no public URL needed. Bot responds to all messages (no trigger required).
---

# 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:

```bash
npx tsx scripts/apply-skill.ts --init
```

### Apply the skill

```bash
npx tsx scripts/apply-skill.ts .claude/skills/add-feishu
```

This deterministically:
- Adds `src/channels/feishu.ts` (FeishuChannel class implementing Channel interface)
- Three-way merges Feishu support into `src/index.ts` (reads credentials via `readEnvFile`, creates FeishuChannel if configured)
- Installs the `@larksuiteoapi/node-sdk` npm dependency
- Updates `.env` with `FEISHU_APP_ID` and `FEISHU_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

```bash
npm run build
```

Build 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:
>
> 1. Go to [Feishu Open Platform](https://open.feishu.cn/app) and create a new app
> 2. Under **Credentials**, copy the **App ID** and **App Secret**
> 3. Under **Event Subscriptions**, enable **Long Connection (WebSocket)** mode
> 4. Add the event: `im.message.receive_v1` (Receive messages)
> 5. Under **Permissions**, add:
>    - `im:message:send_as_bot` (Send messages as bot)
>    - `im:message` (Read messages)
> 6. **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`:

```bash
FEISHU_APP_ID=<their-app-id>
FEISHU_APP_SECRET=<their-app-secret>
```

### Build and restart

```bash
npm run build
launchctl kickstart -k gui/$(id -u)/com.nanoclaw  # macOS
# Linux: systemctl --user restart nanoclaw
```

## Phase 4: Registration

### Get Chat ID

Tell the user:

> 1. Start the bot: `npm run dev`
> 2. Send any message to the bot in Feishu (DM or group)
> 3. Check the logs — the chat_id will appear in the metadata
> 4. The JID format is `{chat_id}@feishu`

Or check the database directly:

```bash
sqlite3 store/messages.db "SELECT jid FROM chats WHERE jid LIKE '%@feishu'"
```

### Register the chat

Register directly in SQLite:

```sql
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

```bash
tail -f logs/nanoclaw.log
# Or run interactively:
npm run dev
```

Look for:
- `Feishu bot info fetched` — bot connected and identified itself
- `Connected to Feishu via WebSocket` — WebSocket established
- `Feishu message sent` — outbound message delivered

## Troubleshooting

### Bot not responding

Check:
1. `FEISHU_APP_ID` and `FEISHU_APP_SECRET` are set in `.env`
2. Chat is registered: `sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE '%@feishu'"`
3. App is published on Feishu Open Platform (draft apps don't receive events)
4. Event subscription `im.message.receive_v1` is enabled
5. Long Connection (WebSocket) mode is enabled (not webhook)
6. Service is running: `launchctl list | grep nanoclaw` (macOS) or `systemctl --user status nanoclaw` (Linux)

### Bot connects but doesn't receive messages

- Verify the app has `im:message` permission
- Verify the event `im.message.receive_v1` is subscribed
- Check that the app version is published and approved

### Bot receives but can't send

- Verify the app has `im:message:send_as_bot` permission
- 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:

1. Delete `src/channels/feishu.ts`
2. Remove `FeishuChannel` import and creation block from `src/index.ts`
3. Remove `readEnvFile` import if no other channel uses it
4. Remove `FEISHU_APP_ID` and `FEISHU_APP_SECRET` from `.env`
5. Remove Feishu registrations: `sqlite3 store/messages.db "DELETE FROM registered_groups WHERE jid LIKE '%@feishu'"`
6. Uninstall: `npm uninstall @larksuiteoapi/node-sdk`
7. Rebuild: `npm run build && launchctl kickstart -k gui/$(id -u)/com.nanoclaw` (macOS) or `npm run build && systemctl --user restart nanoclaw` (Linux)

© sugarforever · MIT · sugarforever/01coder-agent-skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set5

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor