ai_member_xiaoban/skills/lark-send-message-as-bot/SKILL.md
2026-06-17 08:00:01 +08:00

2.3 KiB
Raw Permalink Blame History

name description
lark-send-message-as-bot 以小斑 Bot 身份执行所有飞书操作:发送消息、读取群消息、下载群文件。 所有 lark-cli 命令必须通过本技能规定的凭据执行。 触发场景发消息、通知某人、推送到群、读群消息、下载群文件、Bot 发消息。

小斑 Bot 飞书操作规范

⚠️ 强制规则

所有 lark-cli 命令前必须加上:

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban

不加此前缀会使用错误的默认凭据xiaoxi导致 230002 / 234040 错误。


读取群消息

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +chat-messages-list \
  --chat-id <chat_id> --page-size 20

获取指定消息详情(含文件 key

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +messages-mget \
  --message-ids <message_id>

下载群消息中的文件

cd /tmp && LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +messages-resources-download \
  --message-id <message_id> \
  --file-key <file_key> \
  --type file \
  --output <文件名>

注意:--output 不支持绝对路径,必须先 cd 到目标目录再执行。

发送文本消息

给个人user_id

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +messages-send \
  --user-id <user_id> \
  --text "消息内容"

给群组chat_id

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +messages-send \
  --chat-id <chat_id> \
  --text "消息内容"

回复消息

LARKSUITE_CLI_CONFIG_DIR=/root/.openclaw/credentials/xiaoban \
  lark-cli --as bot im +messages-reply \
  --message-id <reply_to_message_id> \
  --text "回复内容"

常见错误

错误码 含义 原因
230002 Bot/User can NOT be out of the chat 使用了错误的凭据(默认 xiaoxi必须加 LARKSUITE_CLI_CONFIG_DIR
234040 Message invisible to operator 同上,凭据错误或消息在 bot 加入前发送
230013 Bot has NO availability to this user 用户不在 bot 可用范围内