feishu-channel
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Two-way integration channel between Feishu (Lark/Feishu) and OpenClaw. It implements message receiving and sending through Feishu bot, supporting private chat, group chat, @mention detection, card messages, and file transfer. This skill is used when you need to interact with AI assistants via Feishu, receive Feishu messages to trigger AI responses, or send messages from OpenClaw to Feishu. Difference from feishu-automation: this skill focuses on message channel integration, while feishu-automation focuses on automated operations of Feishu platform (such as multidimensional tables, documents, etc.)
2installs
Added on
NPX Install
npx skill4agent add aaaaqwq/claude-code-skills feishu-channelTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Feishu Channel Integration
Integrate Feishu into OpenClaw to implement a two-way message channel.
Difference from feishu-automation
| Feature | feishu-channel | feishu-automation |
|---|---|---|
| Main Purpose | Message channel integration | Platform automation operations |
| Message Receiving | ✅ Webhook event subscription | ❌ Not supported |
| Message Sending | ✅ Real-time conversation | ✅ Notification push |
| Multidimensional Table | ❌ Not involved | ✅ Full support |
| Document Management | ❌ Not involved | ✅ Full support |
| Applicable Scenarios | AI chatbot | Data synchronization, automated workflow |
Architecture Overview
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ Feishu User │ ←→ │ Feishu Open Platform │ ←→ │ OpenClaw │
│ (Private/Group Chat) │ │ (Webhook) │ │ Gateway │
└─────────────┘ └──────────────────┘ └─────────────┘
↓
┌──────────────────┐
│ Webhook Service │
│ - Event Verification │
│ - Message Parsing │
│ - Format Conversion │
└──────────────────┘Core Components
1. Feishu Bot Application
A self-built enterprise application created on Feishu Open Platform, responsible for:
- Receiving user messages (via event subscription)
- Sending messages (via message API)
- Managing permissions and security
2. Webhook Service
Receives Feishu event pushes and forwards them to OpenClaw Gateway.
3. Message Sending API
Send messages via lark-mcp tool or directly calling Feishu API.
Quick Start
Prerequisites
- Feishu Open Platform account
- Enterprise self-built application (with bot capability)
- OpenClaw Gateway is running
- Publicly accessible Webhook URL (or use intranet penetration)
1. Create Feishu Application
- Visit Feishu Open Platform
- Create an enterprise self-built application
- Add the "Bot" capability
- Configure permissions (see the permission list below)
- Obtain App ID and App Secret
2. Configure Event Subscription
- On the application management page, enter "Event Subscription"
- Configure request URL:
https://your-domain.com/webhook/feishu - Subscribe to events:
- - Receive messages
im.message.receive_v1 - - Message read (optional)
im.message.message_read_v1
3. Deploy Webhook Service
bash
cd /home/aa/clawd/skills/feishu-channel
npm install
cp .env.example .env
# Edit .env to fill in the configuration
npm start4. Publish Application
- Submit for review on Feishu Open Platform
- Publish after passing the review
- Search for and add the bot in Feishu
Configuration Instructions
Environment Variables (.env)
env
# Feishu application configuration (required)
FEISHU_APP_ID=cli_xxxxxxxxxx
FEISHU_APP_SECRET=xxxxxxxxxxxxxxxxxxxxxxxx
# Event subscription verification Token
FEISHU_VERIFICATION_TOKEN=xxxxxxxxxxxxxxxx
# Event encryption Key (optional, recommended to enable)
FEISHU_ENCRYPT_KEY=xxxxxxxxxxxxxxxx
# OpenClaw Gateway configuration
OPENCLAW_GATEWAY_URL=http://127.0.0.1:18789
OPENCLAW_WEBHOOK_SECRET=your_webhook_secret
# Security configuration
# Allowed user open_id (comma separated, leave blank to allow all)
ALLOWED_USERS=ou_xxx,ou_yyy
# Allowed group chat chat_id (comma separated, leave blank to allow all)
ALLOWED_GROUPS=oc_xxx,oc_yyy
# Group chat behavior
REQUIRE_MENTION_IN_GROUP=true
# Service port
PORT=3002
# Log level
LOG_LEVEL=infoFeishu Application Permissions
| Permission | Description | Required |
|---|---|---|
| Get and send private and group messages | ✅ |
| Receive messages @bot in group chat | ✅ |
| Receive private messages sent by users to the bot | ✅ |
| Get group information | Recommended |
| Get basic user information | Recommended |
| Get and upload image or file resources | Optional |
OpenClaw Configuration (openclaw.json)
json
{
"channels": {
"feishu": {
"enabled": true,
"appId": "cli_xxxxxxxxxx",
"appSecret": "env:FEISHU_APP_SECRET",
"webhookUrl": "https://your-domain.com/webhook/feishu",
"dmPolicy": "allowlist",
"allowFrom": ["ou_xxx", "ou_yyy"],
"groups": {
"oc_xxx": {
"name": "Work Group",
"requireMention": true
}
}
}
}
}Message Format
Received Message (Webhook Event)
Original Feishu event format:
json
{
"schema": "2.0",
"header": {
"event_id": "xxx",
"event_type": "im.message.receive_v1",
"create_time": "1706745600000",
"token": "verification_token",
"app_id": "cli_xxx"
},
"event": {
"sender": {
"sender_id": {
"open_id": "ou_xxx",
"user_id": "xxx",
"union_id": "on_xxx"
},
"sender_type": "user"
},
"message": {
"message_id": "om_xxx",
"root_id": "",
"parent_id": "",
"create_time": "1706745600000",
"chat_id": "oc_xxx",
"chat_type": "group",
"message_type": "text",
"content": "{\"text\":\"@_user_1 你好\"}",
"mentions": [
{
"key": "@_user_1",
"id": {
"open_id": "ou_bot"
},
"name": "OpenClaw Assistant"
}
]
}
}
}Converted OpenClaw format:
json
{
"type": "message",
"channel": "feishu",
"messageId": "om_xxx",
"from": {
"id": "ou_xxx",
"name": "Zhang San"
},
"chat": {
"id": "oc_xxx",
"type": "group",
"name": "Work Group"
},
"text": "Hello",
"mentions": ["ou_bot"],
"isMentioned": true,
"timestamp": 1706745600000
}Sending Message
Using lark-mcp Tool
javascript
// Send text message
await mcp__lark-mcp_sendMessage({
receive_id: "ou_xxx", // or oc_xxx (group chat)
receive_id_type: "open_id", // or chat_id
msg_type: "text",
content: JSON.stringify({
text: "Received, processing..."
})
});
// Send rich text message
await mcp__lark-mcp_sendMessage({
receive_id: "oc_xxx",
receive_id_type: "chat_id",
msg_type: "post",
content: JSON.stringify({
zh_cn: {
title: "Task Completed",
content: [
[
{ tag: "text", text: "Completed " },
{ tag: "a", text: "View Details", href: "https://example.com" }
]
]
}
})
});
// Send card message
await mcp__lark-mcp_sendMessage({
receive_id: "oc_xxx",
receive_id_type: "chat_id",
msg_type: "interactive",
content: JSON.stringify({
config: { wide_screen_mode: true },
header: {
template: "turquoise",
title: { content: "Notification", tag: "plain_text" }
},
elements: [
{
tag: "div",
text: { content: "**Important Notice**", tag: "lark_md" }
},
{
tag: "action",
actions: [
{
tag: "button",
text: { content: "Confirm", tag: "plain_text" },
type: "primary"
}
]
}
]
})
});Using HTTP API
bash
# Send text message
curl -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"receive_id": "ou_xxx",
"msg_type": "text",
"content": "{\"text\":\"Hello!\"}"
}'Security Policy
Event Verification
Feishu event subscription supports two verification methods:
- Verification Token: Simple Token verification
- Encrypt Key: AES encryption (recommended)
javascript
// Verification example
function verifyEvent(body, token) {
if (body.token !== token) {
throw new Error('Invalid verification token');
}
}
// Decryption example
function decryptEvent(encrypt, key) {
const crypto = require('crypto');
const decipher = crypto.createDecipheriv(
'aes-256-cbc',
crypto.createHash('sha256').update(key).digest(),
Buffer.alloc(16, 0)
);
return JSON.parse(
decipher.update(encrypt, 'base64', 'utf8') + decipher.final('utf8')
);
}Private Chat Policy
| Policy | Description |
|---|---|
| Allow all users to send private chats (dangerous) |
| Only allow users in the allowFrom list |
Group Chat Policy
| Configuration | Description |
|---|---|
| Must @the bot to respond |
| List of users allowed to trigger in the group |
Usage Scenarios
1. Intelligent Q&A Bot
User: @OpenClaw Assistant Help me check today's meeting schedule
Bot: Today's meeting schedule:
- 10:00 Product Review Meeting (Conference Room A)
- 14:00 Technology Sharing Meeting (Online)
- 16:00 Weekly Meeting (Conference Room B)2. Workflow Notification
javascript
// Send notification when task is completed
await mcp__lark-mcp_sendMessage({
receive_id: "oc_work_group",
receive_id_type: "chat_id",
msg_type: "interactive",
content: JSON.stringify({
header: {
template: "green",
title: { content: "✅ Task Completed", tag: "plain_text" }
},
elements: [
{
tag: "div",
text: { content: "Data synchronization task completed\nProcessed records: 1,234 entries", tag: "lark_md" }
}
]
})
});3. Approval Process
User: @OpenClaw Assistant Submit leave application, take one day off tomorrow
Bot: Leave application received, submitting for approval...
[Card message: Leave application details + Approval button]Troubleshooting
Webhook Cannot Receive Messages
- Check if the Webhook URL is publicly accessible
- Check if the Verification Token is correct
- View the event push log of Feishu Open Platform
- Confirm that the application has been published and the user has added the robot
Message Sending Failed
- Check App ID and App Secret
- Confirm that the application permissions are enabled
- Check if access_token is expired
- View the error code returned by the API
Insufficient Permissions
- Check application permissions on Feishu Open Platform
- Confirm that the permissions have been approved
- Re-obtain access_token
Limit Description
Feishu Platform Limits
- API call frequency limit (refer to official documentation)
- Message length limit
- File size limit
Functional Limits
- Voice messages are not supported
- Card message interaction requires additional callback configuration
- Some advanced functions require enterprise authentication
Related Files
- - Webhook service code
scripts/feishu-webhook.js - - Environment variable template
.env.example - - Feishu API reference
references/feishu-api.md - - Message type description
references/message-types.md
TODO
- Create Feishu application and obtain credentials
- Configure event subscription
- Deploy Webhook service
- Test private chat message sending and receiving
- Test group chat @mention
- Configure security policy
- Implement card message interaction