Dingtalk File Send
自动将文件上传并发送至钉钉用户,基于当前会话账号绑定。
下载 702
提供飞书/ Lark 全功能 API 操作指南,支持消息、文档、日历等多场景自动化。
openclaw skills install @pengxiao-wang/lark-toolkit命令、参数、文件名以原文为准
本技能为仅文档参考性质,不包含任何可执行代码,不会自动访问凭证。
必需的凭证(由用户自行提供,不会内置):
app_id) — 来自 [飞书开发者控制台](https://open.larksuite.com/app)app_secret) — 同一控制台获取凭证使用方式:
<APP_ID>、<APP_SECRET>、CHAT_ID 等)—— 不包含真实密钥scripts/get_token.sh 辅助脚本从飞书认证 API 获取临时 tenant_access_token。该脚本按以下顺序读取凭证:1. 命令行参数
2. LARK_APP_ID / LARK_APP_SECRET 环境变量
3. **~/.openclaw/openclaw.json**(标准 OpenClaw 配置文件,路径为 channels.lark.accounts.default.appId/appSecret)
LARK_TOKEN 环境变量形式导出,供同一 Shell 会话中后续命令使用| 需求 | 访问方式 | 适用场景 |
|---|---|---|
| 发送/接收消息 | claw-lark 插件(消息工具) | 基础文本、媒体、表情回复 —— 最简单 |
| 结构化增删改查操作 | MCP 工具通过 mcporter 调用 | Bitable、日历、文档、任务、OKR —— 共 38 个工具 |
| 其他所有操作 | 直接 API(curl) | 联系人、成员管理、MCP 未覆盖的功能 |
使用规则: 先尝试 claw-lark → 再试 MCP → 最后使用直接 API 作为备选。
TOKEN=$(curl -s -X POST 'https://open.larksuite.com/open-apis/auth/v3/tenant_access_token/internal' \
-H 'Content-Type: application/json' \
-d '{"app_id":"<APP_ID>","app_secret":"<APP_SECRET>"}' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tenant_access_token'])")或使用辅助脚本:bash scripts/get_token.sh
令牌有效期:约 2 小时。建议缓存使用。
| 平台 | API 基础地址 | 开发者控制台 |
|---|---|---|
| 飞书国际版 | https://open.larksuite.com/open-apis/ | https://open.larksuite.com/app |
| 飞书中国版(Feishu) | https://open.feishu.cn/open-apis/ | https://open.feishu.cn/app |
⚠️ 飞书 ≠ 飞书中国版。请确认租户所用平台。
curl -X POST "https://open.larksuite.com/open-apis/im/v1/messages?receive_id_type=chat_id" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"receive_id":"CHAT_ID","msg_type":"text","content":"{\"text\":\"hello\"}"}'curl -X POST "https://open.larksuite.com/open-apis/im/v1/messages/MSG_ID/reply" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"msg_type":"text","content":"{\"text\":\"reply\"}","reply_in_thread":true}'curl -X POST "https://open.larksuite.com/open-apis/im/v1/messages/MSG_ID/reactions" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"reaction_type":{"emoji_type":"THUMBSUP"}}'支持的表情类型:THUMBSUP HEART LAUGH OK COOL FINGERHEART SMILE JIAYOU
# 列出根部门
curl -s -H "Authorization: Bearer $TOKEN" \
'https://open.larksuite.com/open-apis/contact/v3/departments?parent_department_id=0&page_size=50&fetch_child=true'
# 列出某部门下的用户
curl -s -H "Authorization: Bearer $TOKEN" \
'https://open.larksuite.com/open-apis/contact/v3/users?department_id=<DEPT_ID>&page_size=50'关键字段:name、open_id、employee_type(1=正式员工,2=实习生)、department_ids
curl -s -H "Authorization: Bearer $TOKEN" \
'https://open.larksuite.com/open-apis/im/v1/messages?container_id_type=chat&container_id=<CHAT_ID>&page_size=20&sort_type=ByCreateTimeDesc'curl -X POST "https://open.larksuite.com/open-apis/im/v1/chats/<CHAT_ID>/members?member_id_type=app_id" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"id_list":["<BOT_APP_ID>"]}'mcporter call lark-mcp.<tool_name> key=value完整工具列表及参数说明:[references/mcp-tools.md](references/mcp-tools.md)
| 模块 | 核心工具 |
|---|---|
| Bitable | 创建应用/表格,增删改查记录,列出字段 |
| 日历 | 创建/获取/更新事件,查询空闲/忙碌状态,获取主日历 |
| 文档 | 读取内容,搜索,导入,设置权限 |
| IM(即时消息) | 创建/列出群组,获取成员,发送消息,列出历史 |
| OKR | 批量获取,列出周期,增删改进度,查询评审 |
| 报表 | 查询规则/任务,管理视图 |
| 任务 | 创建/修改任务,添加成员/提醒 |
| 维基 | 搜索节点,获取节点详情 |
| 联系人 | 根据邮箱/手机号批量获取用户 ID |
GET /contact/v3/users?department_id=GET /contact/v3/departmentsPOST /im/v1/chats/{chat_id}/membersPOST /im/v1/messages/{msg_id}/reactionsPOST /im/v1/images / POST /im/v1/files大多数列表型 API 使用基于游标的分页:
?page_size=50&page_token=<上一次响应返回的 token>请检查响应中的 has_more 字段判断是否还有更多数据。
| 错误码 | 含义 |
|---|---|
| 0 | 成功 |
| 99991663 | 令牌已过期 —— 请刷新 |
| 99991664 | 令牌无效 |
| 99991400 | 请求错误 |
| 99991403 | 权限不足 —— 请检查应用权限配置 |
open.larksuite.com,中国版使用 open.feishu.cnevent_id 进行去重(Lark 可能重试最多 3 次)127.0.0.1:PORT 而非 localhost:PORT已收录 3 个 Skill