飞书文件发送器 — 补齐飞书渠道缺失的文件投递能力,通过飞书 OpenAPI 上传并发送 agent 生成的本地文件。| Feishu File Sender — Upload & send files via Feishu OpenAPI, filling the channel's missing file...
Feishu File Sender | 飞书文件发送器是一项面向实际任务的技能,主要用于OpenClaw agent 在本地生成文件,但飞书渠道插件只支持文本消息,没有文件投递能力;本 skill 通过直接调用飞书 OpenAPI(上传+发送)补齐这一底层能力,使生成的文件能回传到聊天中;
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;
涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
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.
python3 scripts/feishu_file_sender.py --file /absolute/path/to/report.xlsx --receive-id oc_xxx
python3 scripts/feishu_file_sender.py --file /absolute/path/to/file --receive-id--receive-id-type
--file(必填):本地文件绝对路径。
--receive-id(可选):目标 chat_id 或 open_id。若省略,脚本会读取
OPENCLAW_CHAT_ID(或 OPENCLAW_RECEIVE_ID / FEISHU_CHAT_ID)。
--receive-id-type(可选):若省略,将根据前缀自动识别:
oc_ → chat_idou_ → open_idon_ → 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_idou_ → open_idon_ → user_id--file-type (optional): Feishu file upload type, default stream.
通过 cwd 匹配 OpenClaw 工作区,解析当前 agent id。
根据 agent id 从 ~/.openclaw/openclaw.json 读取 appId/appSecret。
调用飞书 上传文件 API 获取 file_key。
调用飞书 发送消息 API 发送文件。
Resolve the current agent id by matching cwd to OpenClaw workspace path.
Read appId/appSecret from ~/.openclaw/openclaw.json based on the agent id.
Call Feishu Upload File API to get file_key.
Call Feishu Send Message API to deliver the file.
缺少凭证 → 确保 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.
本技能会从本机 OpenClaw 配置中读取飞书凭证(~/.openclaw/openclaw.json):
channels.feishu.accounts.*.appIdchannels.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.*.appIdchannels.feishu.accounts.*.appSecretThese values are used only to obtain a tenant access token and send the file. The skill does not store or transmit credentials anywhere else.
本技能面向 所有 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.
scripts/feishu_file_sender.py相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.5万人学习
最新文章