npx skills add https://github.com/larksuite/cli --skill lark-im关键提示 — 开始前 MUST 先用 Read 工具读取../lark-shared/SKILL.md,其中包含认证、权限处理
message_id (om_xxx) 标识。支持类型:文本、富文本、图片、文件、音频、视频、表情、交互式(卡片)、分享群聊、分享用户、合并转发等。chat_id (oc_xxx) 标识。thread_id (om_xxx 或 omt_xxx) 标识。Chat (oc_xxx)
├── Message (om_xxx)
│ ├── Thread (回复话题)
│ ├── Reaction (表情)
│ └── Resource (图片 / 文件 / 视频 / 音频)
└── Member (用户 / 机器人)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
--as user 表示用户身份并使用 user_access_token。调用以授权终端用户的身份运行,因此权限取决于应用的 scope 以及该用户自身对目标聊天/消息/资源的访问权限。--as bot 表示机器人身份并使用 tenant_access_token。调用以应用机器人的身份运行,因此行为取决于机器人的成员身份、应用可见性、可用范围以及机器人特定的 scope。user 和 bot,令牌类型决定了操作者是谁。同一个 API 可能使用一种身份成功,而使用另一种身份失败,因为会针对当前调用者检查所有者/管理员状态、聊天成员身份、租户边界或应用可用性。当使用机器人身份 (--as bot) 获取消息时(例如 +chat-messages-list、+threads-messages-list、+messages-mget),发送者名称可能无法解析(显示为 open_id 而非显示名称)。这发生在机器人无法访问用户联系信息时。
根本原因 : 机器人的应用可见性设置未包含消息发送者,因此联系人 API 未返回名称。
解决方案 : 在 Lark 开发者后台检查应用的可见性设置 —— 确保应用的可见范围覆盖了需要解析其名称的用户。或者,使用 --as user 以用户身份获取消息,这通常具有更广泛的联系人访问权限。
卡片消息(interactive 类型)在事件订阅中尚不支持紧凑转换。将返回原始事件数据,并在 stderr 中打印提示。
Shortcut 是对常用操作的高级封装(lark-cli im +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+chat-create | 使用机器人身份创建群聊;仅限机器人;创建私密/公开聊天,邀请用户/机器人,可选设置机器人管理员 |
+chat-messages-list | 列出聊天或私聊会话中的消息;用户/机器人;接受 --chat-id 或 --user-id,解析私聊 chat_id,支持时间范围/排序/分页 |
+chat-search | 通过关键词和/或成员 open_ids 搜索可见的群聊(例如,通过群名查找 chat_id);用户/机器人;支持成员/类型过滤器、排序和分页 |
+chat-update | 更新群聊名称或描述;用户/机器人;更新聊天的名称或描述 |
+messages-mget | 通过 ID 批量获取消息;用户/机器人;获取最多 50 个 om_ 消息 ID,格式化发送者名称,展开话题回复 |
+messages-reply | 使用机器人身份回复消息(支持话题回复);仅限机器人;支持文本/富文本/媒体回复、话题内回复、幂等键 |
+messages-resources-download | 从消息下载图片/文件;用户/机器人;通过 message-id 和 file-key 将图片/文件资源下载到安全的相对输出路径 |
+messages-search | 使用用户身份跨聊天搜索消息(支持关键词、发送者、时间范围过滤器);仅限用户;按聊天/发送者/附件/时间过滤,通过 mget 和 chats batch_query 丰富结果 |
+messages-send | 使用机器人身份向聊天或私聊发送消息;仅限机器人;发送到 chat-id 或 user-id,支持文本/富文本/媒体,支持幂等键 |
+threads-messages-list | 列出话题中的消息;用户/机器人;接受 om_/omt_ 输入,将消息 ID 解析为 thread_id,支持排序/分页 |
lark-cli schema im.<resource>.<method> # 调用 API 前必须先查看参数结构
lark-cli im <resource> <method> [flags] # 调用 API
重要 :使用原生 API 时,必须先运行
schema查看--data/--params参数结构,不要猜测字段格式。
create — 创建群。身份:仅限 bot (tenant_access_token)。get — 获取群信息。身份:支持 user 和 bot;调用者必须在目标聊天中才能获取完整详情,对于内部聊天,调用者必须属于同一租户。link — 获取群分享链接。身份:支持 user 和 bot;调用者必须在目标聊天中;当聊天分享仅限于所有者/管理员时,调用者必须是所有者或管理员;对于内部聊天,调用者必须属于同一租户。list — 获取用户或机器人所在的群列表。身份:支持 user 和 bot。update — 更新群信息。身份:支持 user 和 bot。create — 将用户或机器人拉入群聊。身份:支持 user 和 bot;调用者必须在目标聊天中;对于 bot 调用,添加的用户必须在应用的可用范围内;对于内部聊天,操作者必须属于同一租户;如果只有所有者/管理员可以添加成员,则调用者必须是所有者/管理员,或者是具有 im:chat:operate_as_owner 权限的聊天创建机器人。get — 获取群成员列表。身份:支持 user 和 bot;调用者必须在目标聊天中,并且对于内部聊天,必须属于同一租户。delete — 撤回消息。身份:支持 user 和 bot;对于 bot 调用,机器人必须在聊天中才能撤回群消息;要撤回其他用户的群消息,机器人必须是所有者、管理员或创建者;对于用户私聊撤回,目标用户必须在机器人的可用范围内。forward — 转发消息。身份:仅限 bot (tenant_access_token)。merge_forward — 合并转发消息。身份:仅限 bot (tenant_access_token)。read_users — 查询消息已读信息。身份:仅限 bot (tenant_access_token);机器人必须在聊天中,并且只能查询其最近 7 天内发送的消息的已读状态。create — 上传图片。身份:仅限 bot (tenant_access_token)。create — Pin 消息。身份:支持 user 和 bot。delete — 移除 Pin 消息。身份:支持 user 和 bot。list — 获取群内 Pin 消息。身份:支持 user 和 bot。| 方法 | 所需 scope |
|---|---|
chats.create | im:chat:create |
chats.get | im:chat:read |
chats.link | im:chat:read |
chats.list | im:chat:read |
chats.update | im:chat:update |
chat.members.create | im:chat.members:write_only |
chat.members.get | im:chat.members:read |
messages.delete | im:message:recall |
messages.forward | im:message |
messages.merge_forward | im:message |
messages.read_users | im:message:readonly |
reactions.batch_query | im:message.reactions:read |
reactions.create | im:message.reactions:write_only |
reactions.delete | im:message.reactions:write_only |
reactions.list | im:message.reactions:read |
images.create | im:resource |
pins.create | im:message.pins:write_only |
pins.delete | im:message.pins:write_only |
pins.list | im:message.pins:read |
每周安装量
2.1K
仓库
GitHub 星标
1
首次出现
今天
安全审计
安装于
codex2.1K
opencode2.1K
github-copilot2.1K
cursor2.1K
gemini-cli2.1K
cline2.1K
CRITICAL — 开始前 MUST 先用 Read 工具读取../lark-shared/SKILL.md,其中包含认证、权限处理
message_id (om_xxx). Supports types: text, post, image, file, audio, video, sticker, interactive (card), share_chat, share_user, merge_forward, etc.chat_id (oc_xxx).thread_id (om_xxx or omt_xxx).Chat (oc_xxx)
├── Message (om_xxx)
│ ├── Thread (reply thread)
│ ├── Reaction (emoji)
│ └── Resource (image / file / video / audio)
└── Member (user / bot)
--as user means user identity and uses user_access_token. Calls run as the authorized end user, so permissions depend on both the app scopes and that user's own access to the target chat/message/resource.--as bot means bot identity and uses tenant_access_token. Calls run as the app bot, so behavior depends on the bot's membership, app visibility, availability range, and bot-specific scopes.user and bot, the token type changes who the operator is. The same API can succeed with one identity and fail with the other because owner/admin status, chat membership, tenant boundary, or app availability are checked against the current caller.When using bot identity (--as bot) to fetch messages (e.g. +chat-messages-list, +threads-messages-list, +messages-mget), sender names may not be resolved (shown as open_id instead of display name). This happens when the bot cannot access the user's contact info.
Root cause : The bot's app visibility settings do not include the message sender, so the contact API returns no name.
Solution : Check the app's visibility settings in the Lark Developer Console — ensure the app's visible range covers the users whose names need to be resolved. Alternatively, use --as user to fetch messages with user identity, which typically has broader contact access.
Card messages (interactive type) are not yet supported for compact conversion in event subscriptions. The raw event data will be returned instead, with a hint printed to stderr.
Shortcut 是对常用操作的高级封装(lark-cli im +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+chat-create | Create a group chat with bot identity; bot-only; creates private/public chats, invites users/bots, optionally sets bot manager |
+chat-messages-list | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range/sort/pagination |
+chat-search | Search visible group chats by keyword and/or member open_ids (e.g. look up chat_id by group name); user/bot; supports member/type filters, sorting, and pagination |
+chat-update |
lark-cli schema im.<resource>.<method> # 调用 API 前必须先查看参数结构
lark-cli im <resource> <method> [flags] # 调用 API
重要 :使用原生 API 时,必须先运行
schema查看--data/--params参数结构,不要猜测字段格式。
create — 创建群。Identity: bot only (tenant_access_token).get — 获取群信息。Identity: supports user and bot; the caller must be in the target chat to get full details, and must belong to the same tenant for internal chats.link — 获取群分享链接。Identity: supports user and bot; the caller must be in the target chat, must be an owner or admin when chat sharing is restricted to owners/admins, and must belong to the same tenant for internal chats.list — 获取用户或机器人所在的群列表。Identity: supports and .create — 将用户或机器人拉入群聊。Identity: supports user and bot; the caller must be in the target chat; for bot calls, added users must be within the app's availability; for internal chats the operator must belong to the same tenant; if only owners/admins can add members, the caller must be an owner/admin, or a chat-creator bot with im:chat:operate_as_owner.get — 获取群成员列表。Identity: supports user and bot; the caller must be in the target chat and must belong to the same tenant for internal chats.delete — 撤回消息。Identity: supports user and bot; for bot calls, the bot must be in the chat to revoke group messages; to revoke another user's group message, the bot must be the owner, an admin, or the creator; for user P2P recalls, the target user must be within the bot's availability.forward — 转发消息。Identity: bot only (tenant_access_token).merge_forward — 合并转发消息。Identity: bot only (tenant_access_token).batch_query — 批量获取消息表情。Identity: supports user and bot.Must-readcreate — 添加消息表情回复。Identity: supports user and bot; the caller must be in the conversation that contains the message.Must-readdelete — 删除消息表情回复。Identity: supports user and bot; the caller must be in the conversation that contains the message, and can only delete reactions added by itself.create — 上传图片。Identity: bot only (tenant_access_token).create — Pin 消息。Identity: supports user and bot.delete — 移除 Pin 消息。Identity: supports user and bot.list — 获取群内 Pin 消息。Identity: supports user and bot.| 方法 | 所需 scope |
|---|---|
chats.create | im:chat:create |
chats.get | im:chat:read |
chats.link | im:chat:read |
chats.list | im:chat:read |
Weekly Installs
2.1K
Repository
GitHub Stars
1
First Seen
Today
Security Audits
Gen Agent Trust HubPassSocketWarnSnykWarn
Installed on
codex2.1K
opencode2.1K
github-copilot2.1K
cursor2.1K
gemini-cli2.1K
cline2.1K
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
| Update group chat name or description; user/bot; updates a chat's name or description |
+messages-mget | Batch get messages by IDs; user/bot; fetches up to 50 om_ message IDs, formats sender names, expands thread replies |
+messages-reply | Reply to a message (supports thread replies) with bot identity; bot-only; supports text/markdown/post/media replies, reply-in-thread, idempotency key |
+messages-resources-download | Download images/files from a message; user/bot; downloads image/file resources by message-id and file-key to a safe relative output path |
+messages-search | Search messages across chats (supports keyword, sender, time range filters) with user identity; user-only; filters by chat/sender/attachment/time, enriches results via mget and chats batch_query |
+messages-send | Send a message to a chat or direct message with bot identity; bot-only; sends to chat-id or user-id with text/markdown/post/media, supports idempotency key |
+threads-messages-list | List messages in a thread; user/bot; accepts om_/omt_ input, resolves message IDs to thread_id, supports sort/pagination |
userbotupdate — 更新群信息。Identity: supports user and bot.read_usersbottenant_access_tokenlist — 获取消息表情回复。Identity: supports user and bot; the caller must be in the conversation that contains the message.Must-readchats.update | im:chat:update |
chat.members.create | im:chat.members:write_only |
chat.members.get | im:chat.members:read |
messages.delete | im:message:recall |
messages.forward | im:message |
messages.merge_forward | im:message |
messages.read_users | im:message:readonly |
reactions.batch_query | im:message.reactions:read |
reactions.create | im:message.reactions:write_only |
reactions.delete | im:message.reactions:write_only |
reactions.list | im:message.reactions:read |
images.create | im:resource |
pins.create | im:message.pins:write_only |
pins.delete | im:message.pins:write_only |
pins.list | im:message.pins:read |