Add Feishu Channel

This skill adds Feishu (Lark) channel support to the NanoClaw AI agent framework, integrating the messaging platform for AI agent interactions and allowing for deterministic code changes and interactive setup.

6 stars
Complexity: medium

About this skill

The 'Add Feishu Channel' skill integrates Feishu (Lark) as a communication channel for AI agents built using the NanoClaw framework. It leverages a 'skills engine' to apply precise, deterministic code changes to the NanoClaw codebase, ensuring consistency and reliability. These changes include adding a `FeishuChannel` class, corresponding unit tests, updating the main channel barrel file to include Feishu, and installing the necessary `@larksuiteoapi/node-sdk` npm dependency. Beyond code modification, the skill guides the user through an interactive setup process. This setup determines if the user already has Feishu app credentials or if a new custom bot app needs to be created. If creation is needed, the skill provides step-by-step instructions for setting up the bot on the Feishu Open Platform, ensuring the agent can connect and communicate effectively. Users would deploy this skill to extend their NanoClaw AI agent's reach to the Feishu/Lark ecosystem. This enables agents to send and receive messages, automate tasks, and interact with users directly within their preferred enterprise communication platform, facilitating broader adoption and utility of AI assistants within organizations that rely on Feishu/Lark.

Best use case

The primary use case is to empower AI agents developed with the NanoClaw framework to seamlessly interact with users and systems through Feishu (Lark) messaging. This is particularly beneficial for developers and organizations that utilize Feishu as their main communication hub and aim to deploy AI assistants or automate workflows directly within that environment.

This skill adds Feishu (Lark) channel support to the NanoClaw AI agent framework, integrating the messaging platform for AI agent interactions and allowing for deterministic code changes and interactive setup.

Users will have a NanoClaw AI agent fully configured and capable of communicating through Feishu (Lark), with all necessary code changes and credentials correctly applied.

Practical example

Example input

Integrate Feishu with my NanoClaw project. I already have an existing Feishu bot app ID and secret.

Example output

Feishu channel added successfully. Your NanoClaw agent is now configured to send and receive messages through Feishu. Please verify the bot app settings to ensure full functionality.

When to use this skill

  • When you need to integrate your NanoClaw AI agent with Feishu (Lark) for communication.
  • When extending the capabilities of a NanoClaw agent to operate within the Feishu messaging ecosystem.
  • When requiring a structured and deterministic approach to add new communication channels to your agent's codebase.
  • When setting up AI assistants for enterprise users who primarily communicate via Feishu/Lark.

When not to use this skill

  • If you are not using the NanoClaw AI agent framework.
  • If you do not require integration with Feishu (Lark) as a communication channel.
  • If your project prefers manual code changes for channel integration rather than an automated skill system.
  • If your primary messaging platform for agent interaction is not Feishu/Lark.

How Add Feishu Channel Compares

Feature / AgentAdd Feishu ChannelStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexitymediumN/A

Frequently Asked Questions

What does this skill do?

This skill adds Feishu (Lark) channel support to the NanoClaw AI agent framework, integrating the messaging platform for AI agent interactions and allowing for deterministic code changes and interactive setup.

How difficult is it to install?

The installation complexity is rated as medium. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Add Feishu Channel

This skill adds Feishu (Lark) 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 ID and secret, or do you need to create a bot app?

If they have credentials, collect them now. If not, we'll create the app 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 with self-registration via `registerChannel`)
- Adds `src/channels/feishu.test.ts` (unit tests with Lark SDK mock)
- Appends `import './feishu.js'` to the channel barrel file `src/channels/index.ts`
- Installs the `@larksuiteoapi/node-sdk` npm dependency
- Records the application in `.nanoclaw/state.yaml`

If the apply reports merge conflicts, read the intent file:
- `modify/src/channels/index.ts.intent.md` — what changed and invariants

### Validate code changes

```bash
npm test
npm run build
```

All tests must pass (including the new Feishu tests) and build must be clean before proceeding.

## Phase 3: Setup

### Create Feishu Bot App (if needed)

If the user doesn't have credentials, tell them:

> I need you to create a Feishu custom bot app:
>
> 1. Go to [Feishu Open Platform](https://open.feishu.cn/app) (or Lark: https://open.larksuite.com/app)
> 2. Click **Create Custom App**
> 3. Give it a name (e.g., "Andy Assistant") and description
> 4. In the app dashboard, go to **Credentials & Basic Info** — copy the **App ID** and **App Secret**
> 5. Go to **Permissions & Scopes**, add these permissions:
>    - `im:message` (Read/Send messages)
>    - `im:message.receive_v1` (Receive message events)
>    - `contact:user.base:readonly` (Read basic user info — for sender names)
>    - `im:chat:readonly` (Read chat info — for chat names)
> 6. Go to **Event Subscriptions** > **Add Event** > search for `im.message.receive_v1` and subscribe
> 7. Go to **Bot** tab and enable the bot feature
> 8. Publish the app (submit for review, or if internal enterprise app, publish directly)

Wait for the user to provide the App ID and App Secret.

### Configure environment

Add to `.env`:

```bash
FEISHU_APP_ID=cli_xxxxxxxxxxxx
FEISHU_APP_SECRET=your_app_secret_here
```

Channels auto-enable when their credentials are present — no extra configuration needed.

Sync to container environment:

```bash
mkdir -p data/env && cp .env data/env/env
```

### Build and restart

```bash
npm run build
launchctl kickstart -k gui/$(id -u)/com.nanoclaw
```

## Phase 4: Registration

### Get Chat ID

Tell the user:

> To get the chat ID for registration, you can:
>
> **Option A — From a group chat:**
> 1. Add the bot to the group (search for it in Feishu/Lark)
> 2. Send any message in the group after the bot connects — the logs will show the chat ID:
>    ```bash
>    tail -f logs/nanoclaw.log | grep "Feishu message"
>    ```
>    Look for the `chatJid` field (format: `fs:oc_xxxxxxxx`)
>
> **Option B — Direct/P2P chat:**
> 1. Start a direct message with the bot in Feishu/Lark
> 2. Send a message — the logs will show the chat ID

Wait for the user to provide the chat JID (format: `fs:oc_xxxxxxxx`).

### Register the channel

Use the IPC register flow or register directly. The chat JID, name, and folder name are needed.

For a main channel (responds to all messages):

```typescript
registerGroup("fs:<chat-id>", {
  name: "<chat-name>",
  folder: "feishu_main",
  trigger: `@${ASSISTANT_NAME}`,
  added_at: new Date().toISOString(),
  requiresTrigger: false,
  isMain: true,
});
```

For additional chats (trigger-only):

```typescript
registerGroup("fs:<chat-id>", {
  name: "<chat-name>",
  folder: "feishu_<chat-name>",
  trigger: `@${ASSISTANT_NAME}`,
  added_at: new Date().toISOString(),
  requiresTrigger: true,
});
```

## Phase 5: Verify

### Test the connection

Tell the user:

> Send a message in your registered Feishu/Lark chat:
> - For main channel: Any message works
> - For non-main: Use the trigger word (e.g., `@Andy hello`)
>
> The bot should respond within a few seconds.

### Check logs if needed

```bash
tail -f logs/nanoclaw.log
```

## Troubleshooting

### Bot not receiving messages

1. Check `FEISHU_APP_ID` and `FEISHU_APP_SECRET` are set in `.env` AND synced to `data/env/env`
2. Verify `im.message.receive_v1` event is subscribed in the Feishu app dashboard
3. Ensure the app is published (not in draft)
4. Service is running: `launchctl list | grep nanoclaw`
5. Check logs for WebSocket connection errors

### Permission errors when fetching user/chat info

Ensure these scopes are added in **Permissions & Scopes**:
- `contact:user.base:readonly`
- `im:chat:readonly`

If scopes were added after publishing, re-publish the app.

### Chat ID not appearing in logs

The bot only logs chat IDs from unregistered chats at debug level. Check debug logs:
```bash
tail -f logs/nanoclaw.log | grep -i feishu
```

### Bot only responds to trigger word

This is the default behavior for non-main channels (`requiresTrigger: true`). To change:
- Update the registered group's `requiresTrigger` to `false`
- Or register the chat as the main channel

## After Setup

The Feishu bot supports:
- Text messages in registered chats (groups and direct messages)
- Media message placeholders (images, files, audio, video shown as `[图片]`, `[文件]`, etc.)
- Sender name resolution (via Feishu Contacts API)
- Chat name resolution (via Feishu Chat API)
- WebSocket long connection (no webhook/public URL required)
- Typing indicators are not supported by the Feishu API

Related Skills

linux-shell-scripting

31392
from sickn33/antigravity-awesome-skills

Provide production-ready shell script templates for common Linux system administration tasks including backups, monitoring, user management, log analysis, and automation. These scripts serve as building blocks for security operations and penetration testing environments.

DevOps & InfrastructureClaude

iterate-pr

31392
from sickn33/antigravity-awesome-skills

Iterate on a PR until CI passes. Use when you need to fix CI failures, address review feedback, or continuously push fixes until all checks are green. Automates the feedback-fix-push-wait cycle.

DevOps & InfrastructureClaude

istio-traffic-management

31392
from sickn33/antigravity-awesome-skills

Comprehensive guide to Istio traffic management for production service mesh deployments.

DevOps & InfrastructureClaude

incident-runbook-templates

31392
from sickn33/antigravity-awesome-skills

Production-ready templates for incident response runbooks covering detection, triage, mitigation, resolution, and communication.

DevOps & InfrastructureClaude

incident-response-smart-fix

31392
from sickn33/antigravity-awesome-skills

[Extended thinking: This workflow implements a sophisticated debugging and resolution pipeline that leverages AI-assisted debugging tools and observability platforms to systematically diagnose and res

DevOps & InfrastructureClaudeGitHub Copilot

incident-responder

31392
from sickn33/antigravity-awesome-skills

Expert SRE incident responder specializing in rapid problem resolution, modern observability, and comprehensive incident management.

DevOps & InfrastructureClaude

expo-cicd-workflows

31392
from sickn33/antigravity-awesome-skills

Helps understand and write EAS workflow YAML files for Expo projects. Use this skill when the user asks about CI/CD or workflows in an Expo or EAS context, mentions .eas/workflows/, or wants help with EAS build pipelines or deployment automation.

DevOps & InfrastructureClaude

error-diagnostics-error-trace

31392
from sickn33/antigravity-awesome-skills

You are an error tracking and observability expert specializing in implementing comprehensive error monitoring solutions. Set up error tracking systems, configure alerts, implement structured logging,

DevOps & InfrastructureClaude

error-debugging-error-trace

31392
from sickn33/antigravity-awesome-skills

You are an error tracking and observability expert specializing in implementing comprehensive error monitoring solutions. Set up error tracking systems, configure alerts, implement structured logging, and ensure teams can quickly identify and resolve production issues.

DevOps & InfrastructureClaude

error-debugging-error-analysis

31392
from sickn33/antigravity-awesome-skills

You are an expert error analysis specialist with deep expertise in debugging distributed systems, analyzing production incidents, and implementing comprehensive observability solutions.

DevOps & InfrastructureClaude

docker-expert

31392
from sickn33/antigravity-awesome-skills

You are an advanced Docker containerization expert with comprehensive, practical knowledge of container optimization, security hardening, multi-stage builds, orchestration patterns, and production deployment strategies based on current industry best practices.

DevOps & InfrastructureClaude

devops-troubleshooter

31392
from sickn33/antigravity-awesome-skills

Expert DevOps troubleshooter specializing in rapid incident response, advanced debugging, and modern observability.

DevOps & InfrastructureClaude