Feishu File Sender

👤 ziwenwang28 📦 v1.0.9 ⭐ 4.4 ⬇️ 8.5K 下載
📄 辦公效率 免費 🔑 需 API Key

📖 技能介紹


name: feishu-file-sender description: 飛書檔案傳送器 — 補齊飛書渠道缺失的檔案投遞能力,通過飛書 OpenAPI 上傳併發送 agent 生成的本地檔案。| Feishu File Sender — Upload & send files via Feishu OpenAPI, filling the channel's missing file delivery. license: MIT compatibility: openclaw metadata: version: "1.0.9" tags: [feishu, file, upload, im, messaging, openapi] author: wen-ai openclaw: emoji: "📎" requires: bins: [python3] config: - ~/.openclaw/openclaw.json


Feishu File Sender | 飛書檔案傳送器

OpenClaw agent 在本地生成檔案,但飛書渠道外掛只支援文本訊息,沒有檔案投遞能力。本 skill 通過直接呼叫飛書 OpenAPI(上傳+傳送)補齊這一底層能力,使生成的檔案能回傳到聊天中。

OpenClaw agents generate files locally, but the Feishu channel integration only supports text messages and does not provide native file delivery. This skill fills that architectural gap by calling Feishu OpenAPI directly (upload + send), enabling files to be delivered back to chat.

將本地檔案上傳到飛書並作為檔案訊息傳送。

Upload a local file to Feishu and send it as a file message.

快速開始 | Quick Start

python3 scripts/feishu_file_sender.py \
  --file /absolute/path/to/report.xlsx \
  --receive-id oc_xxx

使用方法 | Usage

python3 scripts/feishu_file_sender.py \
  --file /absolute/path/to/file \
  --receive-id <chat_id|open_id> \
  --receive-id-type <chat_id|open_id|user_id>

引數說明 | Arguments

  • --file(必填):本地檔案絕對路徑。
  • --receive-id(可選):目標 chat_id 或 open_id。若省略,指令碼會讀取 OPENCLAW_CHAT_ID(或 OPENCLAW_RECEIVE_ID / FEISHU_CHAT_ID)。
  • --receive-id-type(可選):若省略,將根據字首自動識別:
  • oc_ → chat_id
  • ou_ → open_id
  • on_ → user_id
  • --file-type(可選):飛書上傳的檔案型別,預設 stream

  • --file (required): Absolute path to the local file.

  • --receive-id (optional): Target chat_id or open_id. If omitted, the script reads OPENCLAW_CHAT_ID (or OPENCLAW_RECEIVE_ID / FEISHU_CHAT_ID).
  • --receive-id-type (optional): If omitted, auto-detect by prefix:
  • oc_ → chat_id

    發現更多技能外掛,請訪問7w4.net。

  • ou_ → open_id
  • on_ → user_id
  • --file-type (optional): Feishu file upload type, default stream.

工作原理 | How It Works

  1. 通過 cwd 匹配 OpenClaw 工作區,解析當前 agent id。
  2. 根據 agent id 從 ~/.openclaw/openclaw.json 讀取 appId/appSecret。
  3. 呼叫飛書 上傳檔案 API 獲取 file_key
  4. 呼叫飛書 傳送訊息 API 傳送檔案。

  5. Resolve the current agent id by matching cwd to OpenClaw workspace path.

  6. Read appId/appSecret from ~/.openclaw/openclaw.json based on the agent id.
  7. Call Feishu Upload File API to get file_key.
  8. Call Feishu Send Message API to deliver the file.

錯誤處理 | Error Handling

  • 缺少憑證 → 確保 channels.feishu.accounts 存在於 ~/.openclaw/openclaw.json,且 bindings 對映 agentId → accountId。
  • 機器人不在群內(230002) → 將機器人加入目標群或換一個群。
  • 缺少 receive_id → 傳入 --receive-id 或設定 OPENCLAW_CHAT_ID
  • HTTP 錯誤 → 檢視飛書錯誤返回中的 log_id 進行排查。

  • Missing credentials → Ensure channels.feishu.accounts exists in ~/.openclaw/openclaw.json and bindings map agentId → accountId.

  • Bot not in chat (code 230002) → Add the bot to the target chat or use a chat where the bot is present.
  • Missing receive_id → Pass --receive-id or set OPENCLAW_CHAT_ID.
  • HTTP errors → Check the returned log_id in Feishu error payload.

安全說明 | Security

本技能會從本機 OpenClaw 配置中讀取飛書憑證(~/.openclaw/openclaw.json):

  • channels.feishu.accounts.*.appId
  • channels.feishu.accounts.*.appSecret

這些憑證僅用於獲取 tenant access token 併發送檔案。技能不會儲存或向其他地方傳輸憑證。

This skill reads Feishu credentials from the local OpenClaw config (~/.openclaw/openclaw.json) on the machine where it runs:

  • channels.feishu.accounts.*.appId
  • channels.feishu.accounts.*.appSecret

These values are used only to obtain a tenant access token and send the file. The skill does not store or transmit credentials anywhere else.

備註 | Notes

  • 本技能面向 所有 agent 設計,會自動讀取當前工作區來選擇正確的 飛書應用憑證。
  • 建議通過入站 chat_id 傳送到 當前聊天

  • This skill is designed for all agents; it reads the active workspace to choose the correct Feishu app credentials automatically.

  • Prefer sending to the current chat by passing the inbound chat_id.

隨附指令碼 | Bundled Script

  • scripts/feishu_file_sender.py

🤖 AI 評測

質量良好,文件詳盡、使用簡單,能有效解決飛書渠道無法傳送檔案的問題。自動讀取配置、智慧識別引數的設計讓使用很省心,錯誤提示也足夠清晰。不足之處是缺少使用示例和測試用例,新手初次上手可能需要一些摸索時間。總體推薦,適合需要生成檔案併發送至飛書的使用者使用。

📊 多維度評分

適應性4
規範性4.3
有效性4.6
可靠性4.4
可信度4.9

📁 包含檔案 (5 個)

📄 README.md 5.1 KB
📄 SKILL.md 4.9 KB
📄 _meta.json 137 B
📄 clawdis.yaml 901 B
📄 scripts/feishu_file_sender.py 6 KB