Loading...
Loading...
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.)
npx skill4agent add aaaaqwq/claude-code-skills feishu-channel| 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 |
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ Feishu User │ ←→ │ Feishu Open Platform │ ←→ │ OpenClaw │
│ (Private/Group Chat) │ │ (Webhook) │ │ Gateway │
└─────────────┘ └──────────────────┘ └─────────────┘
↓
┌──────────────────┐
│ Webhook Service │
│ - Event Verification │
│ - Message Parsing │
│ - Format Conversion │
└──────────────────┘https://your-domain.com/webhook/feishuim.message.receive_v1im.message.message_read_v1cd /home/aa/clawd/skills/feishu-channel
npm install
cp .env.example .env
# Edit .env to fill in the configuration
npm start# 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=info| 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 |
{
"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
}
}
}
}
}{
"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"
}
]
}
}
}{
"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
}// 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"
}
]
}
]
})
});# 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!\"}"
}'// 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')
);
}| Policy | Description |
|---|---|
| Allow all users to send private chats (dangerous) |
| Only allow users in the allowFrom list |
| Configuration | Description |
|---|---|
| Must @the bot to respond |
| List of users allowed to trigger in the group |
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)// 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" }
}
]
})
});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]scripts/feishu-webhook.js.env.examplereferences/feishu-api.mdreferences/message-types.md