OpenClaw 集成飞书命令行配置指南
介绍如何通过命令行将 OpenClaw 智能 Agent 接入飞书。步骤包括创建飞书企业应用获取凭证,安装 OpenClaw 飞书插件,通过交互式命令添加渠道并配置 App ID 和 Secret,设置事件订阅,最后发布应用并进行授权测试。支持服务器环境部署及自动化脚本集成。

介绍如何通过命令行将 OpenClaw 智能 Agent 接入飞书。步骤包括创建飞书企业应用获取凭证,安装 OpenClaw 飞书插件,通过交互式命令添加渠道并配置 App ID 和 Secret,设置事件订阅,最后发布应用并进行授权测试。支持服务器环境部署及自动化脚本集成。

相比图形化向导,命令行配置更适合服务器环境、自动化脚本及批量操作。
在开始之前,确保你已经:
访问 飞书开放平台(国际版用户请使用 Lark Open Platform)。
点击「创建企业自建应用」,填写应用名称和描述,上传应用图标。


进入「凭证与基础信息」页面,复制以下关键信息:
cli_xxx)
在「权限管理」页面,点击「批量导入」,粘贴以下 JSON 配置(注:为了方便测试,本次开放权限比较多,请按需适当减少):
{"scopes":{"tenant":["aily:file:read","aily:file:write","application:application.app_message_stats.overview:readonly","application:application:self_manage","application:bot.menu:write","cardkit:card:write","contact:contact.base:readonly","contact:user.employee_id:readonly","corehr:file:download","docs:document.content:read","event:ip_list","im:app_feed_card:write","im:biz_entity_tag_relation:read","im:biz_entity_tag_relation:write","im:chat","im:chat.access_event.bot_p2p_chat:read","im:chat.announcement:read","im:chat.announcement:write_only","im:chat.chat_pins:read","im:chat.chat_pins:write_only","im:chat.collab_plugins:read","im:chat.collab_plugins:write_only","im:chat.managers:write_only","im:chat.members:bot_access","im:chat.members:read","im:chat.members:write_only","im:chat.menu_tree:read","im:chat.menu_tree:write_only","im:chat.moderation:read","im:chat.tabs:read","im:chat.tabs:write_only","im:chat.top_notice:write_only","im:chat.widgets:read","im:chat.widgets:write_only","im:chat:create","im:chat:delete","im:chat:moderation:write_only","im:chat:operate_as_owner","im:chat:read","im:chat:readonly","im:chat:update","im:datasync.feed_card.time_sensitive:write","im:message","im:message.group_at_msg:readonly","im:message.group_msg","im:message.p2p_msg:readonly","im:message.pins:read","im:message.pins:write_only","im:message.reactions:read","im:message.reactions:write_only","im:message.urgent","im:message.urgent.status:write","im:message.urgent:phone","im:message.urgent:sms","im:message:readonly","im:message:recall","im:message:send_as_bot","im:message:send_multi_depts","im:message:send_multi_users","im:message:send_sys_msg","im:message:update","im:resource","im:tag:read","im:tag:write","im:url_preview.update","im:user_agent:read","sheets:spreadsheet","wiki:wiki:readonly"]},"user":["aily:file:read","aily:file:write","contact:contact.base:readonly","im:chat.access_event.bot_p2p_chat:read"]}}

进入「应用能力」→「机器人」页面,开启机器人能力并配置名称。

openclaw plugins install @openclaw/feishu
输出示例:
🦞 OpenClaw 2026.2.26 (bc50708) — Your config is valid, your assumptions are not.
Downloading @openclaw/feishu…
Extracting /tmp/openclaw-npm-pack-J3n6oT/openclaw-feishu-2026.2.25.tgz…
Installing to /home/ubuntu/.openclaw/extensions/feishu…
Installed plugin: feishu
Restart the gateway to load plugins.
运行以下命令,根据交互式提示完成配置:
openclaw channels add
操作步骤:
cli_xxx)交互示例:
◇ Select a channel │ Feishu/Lark (飞书)
◇ Feishu credentials ──────────────────────────────────────────────────────────────╮
│ 1) Go to Feishu Open Platform (open.feishu.cn)
│ 2) Create a self-built app
│ 3) Get App ID and App Secret from Credentials page
│ 4) Enable required permissions: im:message, im:chat, contact:user.base:readonly
│ 5) Publish the app or add it to a test group
├───────────────────────────────────────────────────────────────────────────────────╯
◇ Enter Feishu App ID │ cli_xxxxx
◇ Enter Feishu App Secret │ xxxxxxx
◇ Feishu connection test ────────────────────────────╮
│ Connection failed: API error: app do not have bot
├─────────────────────────────────────────────────────╯
◇ Which Feishu domain? │ Feishu (feishu.cn) - China
◇ Group chat policy │ Open - respond in all groups(requires mention)
◇ Selected channels ──────────────────────────────────╮
│ Feishu — 飞书/Lark enterprise messaging. Docs: feishu
├──────────────────────────────────────────────────────╯
◇ Configure DM access policies now? (default: pairing) │ Yes
◇ Feishu DM policy │ Open (public inbound DMs)
◇ Bind configured channel accounts to agents now? │ Yes
◇ Route feishu account "default" to agent │ main (default)
Channels updated.
openclaw gateway restart
⚠️ 注意:在配置事件订阅前,请确保已完成 OpenClaw 渠道添加并启动网关。
在「事件订阅」页面:
im.message.receive_v1
进入「版本管理与发布」页面,创建版本并提交审核。企业自建应用通常会自动通过审批。


在飞书中找到你的机器人(可在「应用」列表中搜索),发送一条消息。

默认情况下,机器人会回复一个 配对码。在终端执行:
# 查看待审批列表
openclaw pairing list feishu
# 批准配对(将 <CODE> 替换为实际配对码)
openclaw pairing approve feishu <CODE>
批准后,用户即可正常对话。

💡 获取 ID 技巧:通过
openclaw logs --follow查看日志,可以获取用户的open_id(格式ou_xxx)和群组chat_id(格式oc_xxx),用于后续高级配置。
如需更精细的控制,可直接编辑配置文件 ~/.openclaw/openclaw.json:
{"channels":{"feishu":{"enabled":true,"dmPolicy":"pairing","accounts":{"main":{"appId":"cli_xxx","appSecret":"your-secret-here","botName":"企业 AI 助手"}}}}}
国际版 Lark 用户需额外配置域名:
{"channels":{"feishu":{"domain":"lark","accounts":{"main":{"appId":"cli_xxx","appSecret":"xxx"}}}}}
通过命令行方式,你可以在任何环境中快速部署 OpenClaw 飞书机器人。这种方式特别适合自动化脚本和服务器部署,让 AI 助手无缝融入你的工作流。

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online
将 HTML 片段转为 GitHub Flavored Markdown,支持标题、列表、链接、代码块与表格等;浏览器内处理,可链接预填。 在线工具,HTML转Markdown在线工具,online