feishu-messaging
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese飞书消息与文档 Skill
Feishu Message and Document Skill
概述
Overview
此 Skill 通过飞书开放平台 API 帮助用户发送消息、创建文档和管理飞书资源。
This Skill helps users send messages, create documents, and manage Feishu resources through the Feishu Open Platform API.
核心能力
Core Capabilities
| 功能 | 状态 | 所需权限 |
|---|---|---|
| 发送文本消息 | ✅ 可用 | |
| 发送富文本消息 | ✅ 可用 | |
| 发送卡片消息 | ✅ 可用 | |
| 获取群聊列表 | ✅ 可用 | |
| 获取群成员 | ⏳ 待授权 | |
| 创建飞书文档 | ⏳ 待授权 | |
| 创建多维表格 | ⏳ 待授权 | |
| 创建知识库页面 | ⏳ 待授权 | |
| Function | Status | Required Permissions |
|---|---|---|
| Send Text Message | ✅ Available | |
| Send Rich Text Message | ✅ Available | |
| Send Card Message | ✅ Available | |
| Get Group Chat List | ✅ Available | |
| Get Group Members | ⏳ Pending Authorization | |
| Create Feishu Document | ⏳ Pending Authorization | |
| Create Feishu Base | ⏳ Pending Authorization | |
| Create Knowledge Base Page | ⏳ Pending Authorization | |
使用方法
Usage Methods
发送消息给指定用户
Send Message to Specified User
给 [姓名] 发一条飞书消息,告诉他 [内容]前置条件:需要获取用户的 open_id
Send a Feishu message to [Name], telling him [content]Prerequisite: Need to obtain the user's open_id
获取用户 open_id 的方法
Methods to Obtain User open_id
-
方法一:通过邮箱/手机号查询(需要权限)
contact:user.id:readonly用户邮箱:xxx@company.com -
方法二:让用户主动发消息
- 用户在飞书中搜索机器人名称
- 发送任意消息
- 机器人获取到用户的 open_id
-
方法三:用户自行查看
- 用户在机器人对话中发送
/myid - 或从飞书开放平台后台查看
- 用户在机器人对话中发送
-
Method 1: Query via Email/Phone Number (Requirespermission)
contact:user.id:readonlyUser Email: xxx@company.com -
Method 2: Ask User to Send Message Actively
- User searches for the bot name in Feishu
- Sends any message
- The bot obtains the user's open_id
-
Method 3: User Checks Themselves
- User sends in the bot chat
/myid - Or check from the Feishu Open Platform backend
- User sends
已知用户 ID 记录
Known User ID Records
| 姓名 | open_id | 备注 |
|---|---|---|
| 王植萌 | | zhimeng.wang@qunar.com |
| Name | open_id | Remarks |
|---|---|---|
| Wang Zhimeng | | zhimeng.wang@qunar.com |
消息类型
Message Types
1. 文本消息
1. Text Message
python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "text",
"content": '{"text": "Hello World"}'
}
)python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "text",
"content": '{"text": "Hello World"}'
}
)2. 富文本消息(Post)
2. Rich Text Message (Post)
支持标题、粗体、链接、@用户等格式。
python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "post",
"content": json.dumps({
"zh_cn": {
"title": "消息标题",
"content": [
[{"tag": "text", "text": "正文内容"}],
[{"tag": "text", "text": "粗体", "style": ["bold"]}],
[{"tag": "a", "text": "链接", "href": "https://example.com"}]
]
}
})
}
)Supports titles, bold text, links, @mentions, etc.
python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "post",
"content": json.dumps({
"zh_cn": {
"title": "Message Title",
"content": [
[{"tag": "text", "text": "Body Content"}],
[{"tag": "text", "text": "Bold Text", "style": ["bold"]}],
[{"tag": "a", "text": "Link", "href": "https://example.com"}]
]
}
})
}
)3. 卡片消息(Interactive)
3. Interactive Card Message
最丰富的消息格式,支持分栏、按钮、图片等。
python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "interactive",
"content": json.dumps({
"config": {"wide_screen_mode": True},
"header": {
"title": {"tag": "plain_text", "content": "卡片标题"},
"template": "blue" # blue/green/orange/red/purple
},
"elements": [
{"tag": "markdown", "content": "**支持 Markdown**\n- 列表项1\n- 列表项2"},
{"tag": "hr"},
{"tag": "div", "text": {"tag": "lark_md", "content": "分栏内容"}}
]
})
}
)The most rich message format, supports columns, buttons, images, etc.
python
mcp__feishu__im_v1_message_create(
params={"receive_id_type": "open_id"},
data={
"receive_id": "ou_xxx",
"msg_type": "interactive",
"content": json.dumps({
"config": {"wide_screen_mode": True},
"header": {
"title": {"tag": "plain_text", "content": "Card Title"},
"template": "blue" # blue/green/orange/red/purple
},
"elements": [
{"tag": "markdown", "content": "**Supports Markdown**\n- List Item 1\n- List Item 2"},
{"tag": "hr"},
{"tag": "div", "text": {"tag": "lark_md", "content": "Column Content"}}
]
})
}
)标准操作流程
Standard Operating Procedures
发送消息 SOP
Send Message SOP
1. 确认收件人
↓ 有 open_id → 直接发送
↓ 无 open_id → 获取 open_id(见上述方法)
2. 确认消息类型
↓ 简单文本 → text
↓ 需要格式 → post
↓ 丰富卡片 → interactive
3. 构造消息内容
↓ 根据类型构造 JSON
4. 发送消息
↓ 调用 im_v1_message_create
5. 确认送达
↓ 检查返回的 message_id1. Confirm Recipient
↓ Has open_id → Send directly
↓ No open_id → Obtain open_id (see methods above)
2. Confirm Message Type
↓ Simple text → text
↓ Needs formatting → post
↓ Rich card → interactive
3. Construct Message Content
↓ Construct JSON according to type
4. Send Message
↓ Call im_v1_message_create
5. Confirm Delivery
↓ Check the returned message_id创建文档 SOP(待权限开通)
Create Document SOP (Pending Permission Activation)
1. 确认文档类型
↓ 普通文档 → docx_builtin_import
↓ 多维表格 → bitable_v1_app_create
↓ 知识库页面 → wiki 相关 API
2. 准备内容
↓ Markdown 格式(会自动转换)
3. 创建文档
4. 分享权限(可选)
↓ 添加协作者1. Confirm Document Type
↓ Regular Document → docx_builtin_import
↓ Feishu Base → bitable_v1_app_create
↓ Knowledge Base Page → wiki-related APIs
2. Prepare Content
↓ Markdown format (will be converted automatically)
3. Create Document
4. Share Permissions (Optional)
↓ Add collaborators权限申请指南
Permission Application Guide
飞书应用信息
Feishu Application Information
- App ID:
cli_a8831f109ffc500e - 应用名称: zhimeng's Agent
- 管理后台: https://open.feishu.cn/app/cli_a8831f109ffc500e
- App ID:
cli_a8831f109ffc500e - App Name: zhimeng's Agent
- Admin Backend: https://open.feishu.cn/app/cli_a8831f109ffc500e
权限申请链接
Permission Application Links
一键申请全部
Apply for All at Once
常见问题
Frequently Asked Questions
Q: 消息发送成功但用户没收到?
Q: Message sent successfully but user didn't receive it?
可能原因:
- 用户未与机器人建立联系 → 让用户先给机器人发消息
- open_id 不正确 → 确认 open_id 来源
- 跨租户 → 机器人无法给其他企业用户发消息
Possible Reasons:
- User hasn't established contact with the bot → Ask user to send a message to the bot first
- Incorrect open_id → Confirm the source of open_id
- Cross-tenant → Bot can't send messages to users from other enterprises
Q: 权限申请不了?
Q: Can't apply for permissions?
可能原因:
- 机器人版本正在审核中 → 等待审核通过
- 企业管理员限制 → 联系管理员开通
- 权限需要特殊审批 → 走企业内部流程
Possible Reasons:
- Bot version is under review → Wait for approval
- Enterprise admin restrictions → Contact admin to enable
- Permissions require special approval → Follow internal enterprise processes
Q: 如何发送群消息?
Q: How to send group messages?
使用 代替 :
chat_idopen_idpython
params={"receive_id_type": "chat_id"},
data={"receive_id": "oc_xxx", ...}Use instead of :
chat_idopen_idpython
params={"receive_id_type": "chat_id"},
data={"receive_id": "oc_xxx", ...}消息模板
Message Templates
能力介绍卡片
Capability Introduction Card
json
{
"config": {"wide_screen_mode": true},
"header": {
"title": {"tag": "plain_text", "content": "🤖 Claude Code 能力介绍"},
"template": "blue"
},
"elements": [
{"tag": "markdown", "content": "Hi,我是 **Claude Code**,一个 AI 编程助手。"},
{"tag": "div", "text": {"tag": "lark_md", "content": "**💻 开发支持**\n• 代码编写、调试和重构\n• Bug 排查与修复"}},
{"tag": "div", "text": {"tag": "lark_md", "content": "**📊 项目管理**\n• 飞书文档/多维表格操作\n• Git 提交、PR 创建"}},
{"tag": "hr"},
{"tag": "markdown", "content": "有任何需要,随时召唤我!"}
]
}json
{
"config": {"wide_screen_mode": true},
"header": {
"title": {"tag": "plain_text", "content": "🤖 Claude Code Capability Introduction"},
"template": "blue"
},
"elements": [
{"tag": "markdown", "content": "Hi, I'm **Claude Code**, an AI programming assistant."},
{"tag": "div", "text": {"tag": "lark_md", "content": "**💻 Development Support**\n• Code writing, debugging and refactoring\n• Bug troubleshooting and fixing"}},
{"tag": "div", "text": {"tag": "lark_md", "content": "**📊 Project Management**\n• Feishu document/Base operations\n• Git commits, PR creation"}},
{"tag": "hr"},
{"tag": "markdown", "content": "Feel free to call me whenever you need help!"}
]
}任务通知卡片
Task Notification Card
json
{
"config": {"wide_screen_mode": true},
"header": {
"title": {"tag": "plain_text", "content": "📋 任务通知"},
"template": "green"
},
"elements": [
{"tag": "div", "fields": [
{"is_short": true, "text": {"tag": "lark_md", "content": "**任务**\n部署上线"}},
{"is_short": true, "text": {"tag": "lark_md", "content": "**状态**\n✅ 已完成"}}
]},
{"tag": "hr"},
{"tag": "markdown", "content": "详情请查看 [链接](https://example.com)"}
]
}json
{
"config": {"wide_screen_mode": true},
"header": {
"title": {"tag": "plain_text", "content": "📋 Task Notification"},
"template": "green"
},
"elements": [
{"tag": "div", "fields": [
{"is_short": true, "text": {"tag": "lark_md", "content": "**Task**\nDeployment and Launch"}},
{"is_short": true, "text": {"tag": "lark_md", "content": "**Status**\n✅ Completed"}}
]},
{"tag": "hr"},
{"tag": "markdown", "content": "For details, please check [Link](https://example.com)"}
]
}注意事项
Notes
- 消息频率限制 - 单用户每分钟最多 5 条消息
- 内容长度限制 - 卡片消息 body 不超过 30KB
- 图片需先上传 - 使用 上传后获取 image_key
im/v1/images - 敏感信息 - 不要在消息中包含密码、token 等敏感信息
- Message Frequency Limit - Maximum 5 messages per user per minute
- Content Length Limit - Card message body cannot exceed 30KB
- Images Need to Be Uploaded First - Use to upload and get image_key
im/v1/images - Sensitive Information - Do not include passwords, tokens or other sensitive information in messages