feishu
Use this skill to respond to messages from feishu channel.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-11
- Stars
- ★ 19
- Forks
- 23
01 前言 Front Matter
- name
- feishu
- description
- Use this skill to respond to messages from feishu channel.
02 资源文件 39
- 脚本__init__.py36 B
- 参考文档agents/openai.yaml325 B
- 资产文件assets/icons/ai-models/chatgpt.svg6.4 KB
- 资产文件assets/icons/ai-models/claude.svg2.5 KB
- 资产文件assets/icons/ai-models/deepseek.svg2.1 KB
- 资产文件assets/icons/ai-models/flash-lightning.svg759 B
- 资产文件assets/icons/ai-models/index.json1.3 KB
- 资产文件assets/icons/ai-models/qwen.svg2.0 KB
- 资产文件assets/icons/ai-models/README.md633 B
- 资产文件assets/icons/ai-models/stepfun.svg676 B
- 资产文件assets/icons/common/brain.svg677 B
- 资产文件assets/icons/common/bug.svg689 B
- 资产文件assets/icons/common/chart-line.svg362 B
- 资产文件assets/icons/common/clipboard-list.svg537 B
- 资产文件assets/icons/common/code-2.svg371 B
- 资产文件assets/icons/common/copy.svg414 B
- 资产文件assets/icons/common/database.svg408 B
- 资产文件assets/icons/common/gauge.svg354 B
- 资产文件assets/icons/common/globe.svg407 B
- 资产文件assets/icons/common/image.svg434 B
- 资产文件assets/icons/common/table.svg408 B
- 资产文件assets/icons/common/trending-down.svg357 B
- 资产文件assets/icons/common/zap.svg453 B
- 资产文件assets/icons/index.json3.9 KB
- 资产文件assets/icons/README.md614 B
- 资产文件assets/templates/xiaohei-comic-motion/index.html15.0 KB
- 资产文件assets/templates/xiaohei-comic-motion/preview-mid.png188.0 KB
- 资产文件assets/templates/xiaohei-comic-motion/preview.png226.2 KB
- 资产文件assets/templates/xiaohei-comic-motion/README.md2.4 KB
- 资产文件assets/templates/xiaohei-series-reference/index.html25.1 KB
- 资产文件assets/templates/xiaohei-series-reference/preview-mid.png453.8 KB
- 资产文件assets/templates/xiaohei-series-reference/preview.png477.9 KB
- 资产文件assets/templates/xiaohei-series-reference/README.md1.4 KB
- 参考文档references/motion-rules.md3.0 KB
- 参考文档references/style-rules.md1.5 KB
- 参考文档references/svg-layering.md2.3 KB
- 脚本scripts/feishu_edit.py1.6 KB
- 脚本scripts/feishu_send.py3.7 KB
- 脚本scripts/feishu_utils.py1.7 KB
03 SKILL.md 正文
Feishu Skill
Agent-facing execution guide for outbound communication in Feishu/Lark.
Assumption: BUB_FEISHU_APP_ID and BUB_FEISHU_APP_SECRET are already available.
Required Inputs
Collect these fields before execution whenever possible:
chat_id: required for sending a new message or card; obtain it from the current channel/session context, not from the inbound JSON payloadmessage/text/content: required for sending or editing contentmessage_id: required for reply, edit, and reaction actionsreply_to_message.message_id: optional source reference from inbound metadata; use it only for context, not as a replacement for the current message id
Execution Policy
- If handling an active Feishu conversation and
message_idis known, prefer reply semantics instead of sending an unrelated new message. - If source metadata says sender is a bot (
sender_is_bot=true), do not assume reply mode is appropriate; prefer a normal message unless there is a clear user-authored message to reply to. - Prefer plain text for short, direct, conversational responses.
- Prefer cards for Markdown content, status summaries, step lists, and structured updates.
- For long-running tasks, send one acknowledgment first, then prefer edits or one follow-up update to close the loop.
- For multi-line text passed through shell commands, prefer heredoc command substitution instead of embedding raw line breaks in quoted strings.
- Only call scripts when a Feishu-specific platform action is required; otherwise return the final content directly.
- When only lightweight acknowledgment is needed, prefer the Feishu message reaction API; if explanation or context is needed, use a normal reply instead.
- Do not assume the Feishu channel will send replies automatically; all platform actions must go through the Feishu scripts or direct OpenAPI calls.
Message Format Policy
- Short replies, confirmations, and direct answers: use
feishu_send.py --format text - Markdown content, progress summaries, checklists, and report-like output: use
feishu_send.py --format card - Image messages: use
lark-cli im +messages-sendorlark-cli im +messages-replywith--image - Updates to an existing bot message: use
feishu_edit.py - Lightweight acknowledgment: use the Feishu OpenAPI message reaction endpoint
Special Message Policy
- Respect the current runtime context prepared by the channel: only act when the current message has already reached the agent.
- If
sender_is_bot=true, prefer a normal message unless a reply target is explicitly required and known to be correct. - When only lightweight acknowledgment is needed, prefer reactions; once explanation, risk notes, result summaries, or next steps are needed, switch to a normal reply.
- For reply chains and sequential status updates, prefer staying in the original context; when possible, close the loop by editing, otherwise send a follow-up message.
- Long-running tasks should follow an acknowledgment → progress → completion / blocked lifecycle so the user is not left without feedback.
- When blocked, failing, or waiting on an external dependency, send a problem report immediately, including failure point, completed work, impact, and next action.
- If
message_idis missing, do not perform reply, edit, or reaction actions; ifchat_idis missing, do not perform send actions. feishu_send.pyonly supports text and card messages; when an outbound message must include an image, switch tolark-cli.- Do not put local image paths inside Markdown and expect automatic upload. For local files like
./image.png, uselark-cli ... --image ./image.png. - If card delivery is unsuitable or fails, fall back to
feishu_send.py --format textso the message still reaches the user.
Runtime Context Mapping
The current Feishu channel message JSON includes:
message: normalized text contentmessage_id: current user message IDtype: normalized message typesender_idsender_namesender_is_botdatemediareply_to_message
Typical mappings:
- Send a new message to the current conversation: use
chat_idfrom the current channel/session context - Reply to the current user message: use
message_idas the reply target - Edit a previously sent bot message: use the target bot message
message_id - Add a reaction to the current message: use the current message
message_id
Command Templates
Paths are relative to this skill directory.
# Send text message
uv run ${SKILL_DIR}/scripts/feishu_send.py \
--chat-id <CHAT_ID> \
--content "<TEXT>" \
--format text
# Send multi-line text message (heredoc)
uv run ${SKILL_DIR}/scripts/feishu_send.py \
--chat-id <CHAT_ID> \
--content "$(cat <<'EOF'
Build finished successfully.
Summary:
- 12 tests passed
- 0 failures
EOF
)" \
--format text
# Reply to a specific message
uv run ${SKILL_DIR}/scripts/feishu_send.py \
--chat-id <CHAT_ID> \
--content "<TEXT>" \
--format text \
--reply-to <MESSAGE_ID>
# Send card update
uv run ${SKILL_DIR}/scripts/feishu_send.py \
--chat-id <CHAT_ID> \
--content "<MARKDOWN_CONTENT>" \
--format card \
--title "<TITLE>"
# Edit an existing bot message
uv run ${SKILL_DIR}/scripts/feishu_edit.py \
--message-id <MESSAGE_ID> \
--text "<TEXT>"
Sending Images via lark-cli
Use lark-cli only when the message must contain an image. The packaged feishu_send.py script does not upload media.
Prerequisites:
lark-cliis installed, typically vianpm install -g @larksuite/cli- App config is initialized with
lark-cli config init - For bot identity, the app has the required IM scopes and has already been added to the target chat
- For user identity,
lark-cli auth loginhas already granted the required user scopes
Rules:
- New image message to a chat: use
lark-cli im +messages-send --chat-id <CHAT_ID> --image <PATH_OR_IMAGE_KEY> - Reply with an image: use
lark-cli im +messages-reply --message-id <MESSAGE_ID> --image <PATH_OR_IMAGE_KEY> --imageaccepts either a local file path like./photo.pngor an existingimage_keylikeimg_v3_...- When
--imageis a local file path,lark-cliuploads it automatically before sending - If you need a dry run first, add
--dry-run
Examples:
# Send a new image message to the current chat as bot
lark-cli im +messages-send \
--chat-id <CHAT_ID> \
--image ./photo.png \
--as bot
# Reply to the current message with a local image
lark-cli im +messages-reply \
--message-id <MESSAGE_ID> \
--image ./photo.png \
--as bot
# Send an already uploaded image by image_key
lark-cli im +messages-send \
--chat-id <CHAT_ID> \
--image img_v3_abc123 \
--as bot
# Preview the request without executing it
lark-cli im +messages-send \
--chat-id <CHAT_ID> \
--image ./photo.png \
--as bot \
--dry-run
Identity notes:
- Prefer
--as botfor image sends in this skill because the rest of this skill already assumes app credentials and bot-style outbound actions --as useris supported bylark-cli, but local media upload is still performed with bot identity first, and the final send uses user identity- If
--as useris required, make sure the user identity already hasim:message.send_as_userandim:message
For actions not covered by the packaged scripts, such as reactions, call the Feishu OpenAPI directly.
Script Interface Reference
feishu_send.py
--chat-id,-c: required--content,-m: required--format: optional,textorcard, defaults totext--title,-t: used only with--format card--reply-to,-r: valid only with--format text--app-id: optional--app-secret: optional
feishu_edit.py
--message-id,-m: required--text,-t: required--app-id: optional--app-secret: optional
API Docs
- Feishu OpenAPI docs:
https://open.feishu.cn/document/ - Lark OpenAPI docs:
https://open.larksuite.com/document/ - For IM APIs, see the official
IM/Messagedocumentation - Common endpoints:
POST /open-apis/im/v1/messagesPOST /open-apis/im/v1/messages/{message_id}/replyPATCH /open-apis/im/v1/messages/{message_id}POST /open-apis/im/v1/messages/{message_id}/reactions
Failure Handling
- If text or card sending fails, first check
chat_id, message format, application permissions, and credentials. - If card sending fails, fall back to
feishu_send.py --format text. - If reply sending fails, fall back to sending a normal message to the same
chat_id. - If editing fails, fall back to sending a new message and state that it is the updated result.
- If a reaction fails, fall back to a short text acknowledgment.
- If
message_idis missing, do not perform reply, edit, or reaction actions. - If
chat_idis missing, do not perform send actions. - If the task itself fails, do not report only the API error; also tell the user what failed, what was completed, the impact, and the next action.
04 同仓库更多 Skills
tape-dataset-share-review
Export, filter, scan, and review shareable tape datasets produced by `tape-dataset-opendal`. Use when Codex needs to prepare Bub-generated tape data for public sharing, Hugging Face upload, external research handoff, or any review-sensitive export that must run CEL filtering, TruffleHog secret scanning on the staged artifact, and a final conservative LLM audit.
wecom
WeCom channel skill. Return normal replies directly. For proactive sends such as scheduled jobs, use the packaged wecom_send.py script.
slack
Slack skill for proactive outbound Slack communication: posting a message to a channel or thread, editing an existing bot message, or adding an emoji reaction. Use when the bot needs to: (1) post a message somewhere OTHER than the current reply (e.g. a different channel, or a side note in the same thread), (2) edit a previously-sent bot message (e.g. a progress placeholder), or (3) acknowledge a message with a non-verbal emoji reaction. NOTE: normal replies to the current message are posted AUTOMATICALLY by the runtime — just answer as text. Reach for this skill only for proactive / out-of-band sends and message edits.
QQ C2C and group channel skill. Use when Bub is handling a QQ conversation. In the default tool reply mode, reply by calling qq.send (text or media) and stay silent by not calling it. In direct reply mode, return the reply text; output exactly <no_reply/> to stay silent.
discord
Discord Bot integration for sending messages, managing channels, and responding to events. Use when Bub needs to: (1) Send messages to Discord channels, (2) Create Discord bot with discord.py, (3) Handle Discord events (on_message, on_member_join, etc.), (4) Work with Discord webhooks, or (5) Any Discord-related functionality.
dingtalk
DingTalk channel skill. When $dingtalk appears in message context, return your response as text and the framework will deliver it. For programmatic sends (e.g. progress updates), use dingtalk_send.