养虾实战:接入飞书机器人

0 阅读1分钟

大家好,我是小民,见字欢喜!

上一篇咱们把「小龙虾」接进了QQ,让它住进了手机里。有朋友问:“小民,我不用QQ,能用飞书吗?”

答案是:肯定能!而且飞书接入比QQ还要顺畅的多!

今天咱们继续“养虾”系列第二篇——把这只“小龙虾”接进飞书,让它成为你办公场景里的24小时数字同事。

话不多说,开整👇

1 在飞书开放平台创建应用

①打开飞书开放平台

访问:open.feishu.cn/

用飞书账号扫码登录,如果是第一次使用,系统会自动注册开发者账号。

②创建企业自建应用

访问:open.feishu.cn/app?lang=zh…

点击「创建企业自建应用」

填写应用名称、应用描述,选择应用图标,点击「创建」按钮👇

③获取应用凭证

④添加机器人

在左侧导航栏找到 「添加应用能力」

在列表中找到 「机器人」➔点击「添加」

这一步给应用赋予了收发消息的能力

⑤配置事件

在左侧导航栏进入「事件与回调」➔编辑订阅方式

选择长连接方式接收事件,点击「保存」

然后开始「添加事件」

添加以下事件

接收消息➔im.message.receive_v1机器人进群➔im.chat.member.bot.added_v1机器人被移除群➔im.chat.member.bot.deleted_v1消息已读➔im.message.message_read_v1

⚠️只有发布后的应用才能配置事件回调

⑥配置权限

在左侧导航栏进入「权限管理」,需要开启机器人必需的权限

下面这些权限可以开通,仅供参考哈~

  • 手动选择权限

搜索对应权限,选中后点击「确认开通权限」

  • 批量导入权限

点击「批量导入/导出权限」,直接粘贴以下JSON配置,一键申请所有必需权限👇

{  "scopes": {    "tenant": [      "contact:user.base:readonly",      "im:message",      "im:message.group_at_msg:readonly",      "im:message.p2p_msg:readonly",      "im:message:send_as_bot",      "im:resource"    ],    "user": []  }}

2 在OpenClaw里安装飞书插件

OpenClaw有多个飞书插件可用,推荐使用功能最全的@overlink/openclaw-feishu

openclaw plugins install @overlink/openclaw-feishu@latest

Installed plugin: @overlink/openclaw-feishu,说明安装成功🎉🎉

配置App ID和App Secret

安装完成后,用命令行配置飞书应用凭证

下边的命令挨个执行一遍👇

# 启用飞书通道openclaw config set channels.feishu.enabled true --json# 配置App ID(换成你自己的)openclaw config set channels.feishu.appId "cli_你的AppID"# 配置App Secret(换成你自己的)openclaw config set channels.feishu.appSecret "你的AppSecret"# 配置域名版本(国内用feishu,海外用lark)openclaw config set channels.feishu.domain "feishu"# 重启网关openclaw gateway restart

也可以使用交互式命令一键配置(推荐)👇

openclaw channels add

验证配置状态

openclaw status

输入结果如下👇

fenglm@fenglm:~$ openclaw status🦞 OpenClaw 2026.3.7 (42a1394) — You had me at 'openclaw gateway start.'21:47:34 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-feishu (/home/fenglm/.openclaw/extensions/openclaw-feishu/index.ts), qqbot (/home/fenglm/.openclaw/extensions/qqbot/index.ts). Set plugins.allow to explicit trusted ids.│◒  Checking for updates…..[qqbot] resolveAllowFrom: accountId=default, allowFrom=["*"]◇│◇OpenClaw statusOverview┌─────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────┐│ Item            │ Value                                                                                             │├─────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤│ Dashboard       │ http://127.0.0.1:18789/                                                                           ││ OS              │ linux 5.15.133.1-microsoft-standard-WSL2 (x64) · node 22.22.1                                     ││ Tailscale       │ off                                                                                               ││ Channel         │ stable (default)                                                                                  ││ Update          │ available · pnpm · npm update 2026.3.8                                                            ││ Gateway         │ local · ws://127.0.0.1:18789 (local loopback) · reachable 17ms · auth token · fenglm (172.19.122. ││                 │ 229) app 2026.3.7 linux 5.15.133.1-microsoft-standard-WSL2                                        ││ Gateway service │ systemd installed · enabled · running (pid 3036, state active)                                    ││ Node service    │ systemd not installed                                                                             ││ Agents          │ 1 · 1 bootstrap file present · sessions 2 · default main active 7h ago                            ││ Memory          │ 0 files · 0 chunks · dirty · sources memory · plugin memory-core · vector unknown · fts ready ·   ││                 │ cache on (0)                                                                                      ││ Probes          │ skipped (use --deep)                                                                              ││ Events          │ none                                                                                              ││ Heartbeat       │ 30m (main)                                                                                        ││ Sessions        │ 2 active · default qwen3-max-2026-01-23 (262k ctx) · ~/.openclaw/agents/main/sessions/sessions.   ││                 │ json                                                                                              │└─────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────┘Security auditSummary: 0 critical · 5 warn · 1 info  WARN Reverse proxy headers are not trusted    gateway.bind is loopback and gateway.trustedProxies is empty. If you expose the Control UI through a reverse proxy, configure trusted proxies so local-client c…    Fix: Set gateway.trustedProxies to your proxy IPs or keep the Control UI local-only.  WARN Some gateway.nodes.denyCommands entries are ineffective    gateway.nodes.denyCommands uses exact node command-name matching only (for example `system.run`), not shell-text filtering inside a command payload. - Unknown …    Fix: Use exact command names (for example: canvas.present, canvas.hide, canvas.navigate, canvas.eval, canvas.snapshot, canvas.a2ui.push, canvas.a2ui.pushJSONL, canvas.a2ui.reset). If you need broader restrictions, remove risky command IDs from allowCommands/default workflows and tighten tools.exec policy.  WARN Potential multi-user setup detected (personal-assistant model warning)    Heuristic signals indicate this gateway may be reachable by multiple users: - channels.qqbot.allowFrom includes "*" Runtime/process tools are exposed without f…    Fix: If users may be mutually untrusted, split trust boundaries (separate gateways + credentials, ideally separate OS users/hosts). If you intentionally run shared-user access, set agents.defaults.sandbox.mode="all", keep tools.fs.workspaceOnly=true, deny runtime/fs/web tools unless required, and keep personal/private identities + credentials off that runtime.  WARN Extensions exist but plugins.allow is not set    Found 2 extension(s) under /home/fenglm/.openclaw/extensions. Without plugins.allow, any discovered plugin id may load (depending on config and plugin behavior…    Fix: Set plugins.allow to an explicit list of plugin ids you trust.  WARN Plugin installs include unpinned npm specs    Unpinned plugin install records: - qqbot (@sliverp/qqbot@latest) - openclaw-feishu (@overlink/openclaw-feishu@latest)    Fix: Pin install specs to exact versions (for example, `@scope/pkg@1.2.3`) for higher supply-chain stability.Full report: openclaw security auditDeep probe: openclaw security audit --deepChannels┌──────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────────────┐│ Channel  │ Enabled │ State  │ Detail                                                                                │├──────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────────────┤│ QQ Bot   │ ON      │ OK     │ configured                                                                            ││ Feishu   │ ON      │ OK     │ configured                                                                            │└──────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────────────┘Sessions┌───────────────────────────────────────────────────────┬────────┬─────────┬──────────────────────┬───────────────────┐│ Key                                                   │ Kind   │ Age     │ Model                │ Tokens            │├───────────────────────────────────────────────────────┼────────┼─────────┼──────────────────────┼───────────────────┤│ agent:main:qqbot:direct:6e9f02d…                      │ direct │ 7h ago  │ qwen3-max-2026-01-23 │ unknown/262k (?%) ││ agent:main:main                                       │ direct │ 8h ago  │ qwen3-max-2026-01-23 │ unknown/262k (?%) │└───────────────────────────────────────────────────────┴────────┴─────────┴──────────────────────┴───────────────────┘FAQ: https://docs.openclaw.ai/faqTroubleshooting: https://docs.openclaw.ai/troubleshootingUpdate available (npm 2026.3.8). Run: openclaw updateNext steps:  Need to share?      openclaw status --all  Need to debug live? openclaw logs --follow  Need to test channels? openclaw status --deepfenglm@fenglm:~$

查看插件列表

openclaw plugins list

输入结果如下,可见Feishu状态是loaded,说明飞书插件已成功安装并加载了👇

fenglm@fenglm:~$ openclaw plugins list┌──────────────┬──────────┬──────────┬─────────────────────────────────────────────────────────────────────┬──────────┐│ Name         │ ID       │ Status   │ Source                                                              │ Version  │├──────────────┼──────────┼──────────┼─────────────────────────────────────────────────────────────────────┼──────────┤│ ACPX Runtime │ acpx     │ disabled │ stock:acpx/index.ts                                                 │ 2026.3.7 ││              │          │          │ ACP runtime backend powered by acpx with configurable command path  │          ││              │          │          │ and version policy.                                                 │          ││ @openclaw/   │ bluebubb │ disabled │ stock:bluebubbles/index.ts                                          │ 2026.3.7 ││ bluebubbles  │ les      │          │ OpenClaw BlueBubbles channel plugin                                 │          ││ @openclaw/   │ copilot- │ disabled │ stock:copilot-proxy/index.ts                                        │ 2026.3.7 ││ copilot-     │ proxy    │          │ OpenClaw Copilot Proxy provider plugin                              │          ││ proxy        │          │          │                                                                     │          ││ Device       │ device-  │ loaded   │ stock:device-pair/index.ts                                          │          ││ Pairing      │ pair     │          │ Generate setup codes and approve device pairing requests.           │          ││ @openclaw/   │ diagnost │ disabled │ stock:diagnostics-otel/index.ts                                     │ 2026.3.7 ││ diagnostics- │ ics-otel │          │ OpenClaw diagnostics OpenTelemetry exporter                         │          ││ otel         │          │          │                                                                     │          ││ Diffs        │ diffs    │ disabled │ stock:diffs/index.ts                                                │ 2026.3.7 ││              │          │          │ Read-only diff viewer and file renderer for agents.                 │          ││ @openclaw/   │ discord  │ disabled │ stock:discord/index.ts                                              │ 2026.3.7 ││ discord      │          │          │ OpenClaw Discord channel plugin                                     │          ││ @openclaw/   │ google-  │ disabled │ stock:google-gemini-cli-auth/index.ts                               │ 2026.3.7 ││ google-      │ gemini-  │          │ OpenClaw Gemini CLI OAuth provider plugin                           │          ││ gemini-cli-  │ cli-auth │          │                                                                     │          ││ auth         │          │          │                                                                     │          ││ @openclaw/   │ googlech │ disabled │ stock:googlechat/index.ts                                           │ 2026.3.7 ││ googlechat   │ at       │          │ OpenClaw Google Chat channel plugin                                 │          ││ @openclaw/   │ imessage │ disabled │ stock:imessage/index.ts                                             │ 2026.3.7 ││ imessage     │          │          │ OpenClaw iMessage channel plugin                                    │          ││ @openclaw/   │ irc      │ disabled │ stock:irc/index.ts                                                  │ 2026.3.7 ││ irc          │          │          │ OpenClaw IRC channel plugin                                         │          ││ @openclaw/   │ line     │ disabled │ stock:line/index.ts                                                 │ 2026.3.7 ││ line         │          │          │ OpenClaw LINE channel plugin                                        │          ││ LLM Task     │ llm-task │ disabled │ stock:llm-task/index.ts                                             │ 2026.3.7 ││              │          │          │ Generic JSON-only LLM tool for structured tasks callable from       │          ││              │          │          │ workflows.                                                          │          ││ Lobster      │ lobster  │ disabled │ stock:lobster/index.ts                                              │ 2026.3.7 ││              │          │          │ Typed workflow tool with resumable approvals.                       │          ││ @openclaw/   │ matrix   │ disabled │ stock:matrix/index.ts                                               │ 2026.3.7 ││ matrix       │          │          │ OpenClaw Matrix channel plugin                                      │          ││ @openclaw/   │ mattermo │ disabled │ stock:mattermost/index.ts                                           │ 2026.3.7 ││ mattermost   │ st       │          │ OpenClaw Mattermost channel plugin                                  │          ││ Memory       │ memory-  │ loaded   │ stock:memory-core/index.ts                                          │ 2026.3.7 ││ (Core)       │ core     │          │ File-backed memory search tools and CLI                             │          ││ @openclaw/   │ memory-  │ disabled │ stock:memory-lancedb/index.ts                                       │ 2026.3.7 ││ memory-      │ lancedb  │          │ OpenClaw LanceDB-backed long-term memory plugin with auto-recall/   │          ││ lancedb      │          │          │ capture                                                             │          ││ @openclaw/   │ minimax- │ disabled │ stock:minimax-portal-auth/index.ts                                  │ 2026.3.7 ││ minimax-     │ portal-  │          │ OpenClaw MiniMax Portal OAuth provider plugin                       │          ││ portal-auth  │ auth     │          │                                                                     │          ││ @openclaw/   │ msteams  │ disabled │ stock:msteams/index.ts                                              │ 2026.3.7 ││ msteams      │          │          │ OpenClaw Microsoft Teams channel plugin                             │          ││ @openclaw/   │ nextclou │ disabled │ stock:nextcloud-talk/index.ts                                       │ 2026.3.7 ││ nextcloud-   │ d-talk   │          │ OpenClaw Nextcloud Talk channel plugin                              │          ││ talk         │          │          │                                                                     │          ││ @openclaw/   │ nostr    │ disabled │ stock:nostr/index.ts                                                │ 2026.3.7 ││ nostr        │          │          │ OpenClaw Nostr channel plugin for NIP-04 encrypted DMs              │          ││ OpenProse    │ open-    │ disabled │ stock:open-prose/index.ts                                           │ 2026.3.7 ││              │ prose    │          │ OpenProse VM skill pack with a /prose slash command.                │          ││ Phone        │ phone-   │ loaded   │ stock:phone-control/index.ts                                        │          ││ Control      │ control  │          │ Arm/disarm high-risk phone node commands (camera/screen/writes)     │          ││              │          │          │ with an optional auto-expiry.                                       │          ││ qwen-portal- │          │ disabled │ stock:qwen-portal-auth/index.ts                                     │          ││ auth         │          │          │                                                                     │          ││ @openclaw/   │ signal   │ disabled │ stock:signal/index.ts                                               │ 2026.3.7 ││ signal       │          │          │ OpenClaw Signal channel plugin                                      │          ││ @openclaw/   │ slack    │ disabled │ stock:slack/index.ts                                                │ 2026.3.7 ││ slack        │          │          │ OpenClaw Slack channel plugin                                       │          ││ @openclaw/   │ synology │ disabled │ stock:synology-chat/index.ts                                        │ 2026.3.7 ││ synology-    │ -chat    │          │ Synology Chat channel plugin for OpenClaw                           │          ││ chat         │          │          │                                                                     │          ││ Talk Voice   │ talk-    │ loaded   │ stock:talk-voice/index.ts                                           │          ││              │ voice    │          │ Manage Talk voice selection (list/set).                             │          ││ @openclaw/   │ telegram │ disabled │ stock:telegram/index.ts                                             │ 2026.3.7 ││ telegram     │          │          │ OpenClaw Telegram channel plugin                                    │          ││ Thread       │ thread-  │ disabled │ stock:thread-ownership/index.ts                                     │          ││ Ownership    │ ownershi │          │ Prevents multiple agents from responding in the same Slack thread.  │          ││              │ p        │          │ Uses HTTP calls to the slack-forwarder ownership API.               │          ││ @openclaw/   │ tlon     │ disabled │ stock:tlon/index.ts                                                 │ 2026.3.7 ││ tlon         │          │          │ OpenClaw Tlon/Urbit channel plugin                                  │          ││ @openclaw/   │ twitch   │ disabled │ stock:twitch/index.ts                                               │ 2026.3.7 ││ twitch       │          │          │ OpenClaw Twitch channel plugin                                      │          ││ @openclaw/   │ voice-   │ disabled │ stock:voice-call/index.ts                                           │ 2026.3.7 ││ voice-call   │ call     │          │ OpenClaw voice-call plugin                                          │          ││ @openclaw/   │ whatsapp │ disabled │ stock:whatsapp/index.ts                                             │ 2026.3.7 ││ whatsapp     │          │          │ OpenClaw WhatsApp channel plugin                                    │          ││ @openclaw/   │ zalo     │ disabled │ stock:zalo/index.ts                                                 │ 2026.3.7 ││ zalo         │          │          │ OpenClaw Zalo channel plugin                                        │          ││ @openclaw/   │ zalouser │ disabled │ stock:zalouser/index.ts                                             │ 2026.3.7 ││ zalouser     │          │          │ OpenClaw Zalo Personal Account plugin via native zca-js integration │          ││ Feishu       │ openclaw │ loaded   │ global:openclaw-feishu/index.ts                                     │ 0.1.10   ││              │ -feishu  │          │ Feishu/Lark channel plugin                                          │          ││ QQ Bot       │ qqbot    │ loaded   │ global:qqbot/index.ts                                               │ 1.5.3    ││              │          │          │ QQ Bot channel plugin                                               │          │└──────────────┴──────────┴──────────┴─────────────────────────────────────────────────────────────────────┴──────────┘fenglm@fenglm:~$

3 发布应用

点击「创建版本」

填写完版本号和更新说明➔点击「保存」

如下图所示,应用发布成功👇

4 我的飞书机器人活了

私聊玩法

打开飞书客户端(电脑端或手机APP),在搜索框输入我的应用名称:小民飞书机器人

  • 手机飞书客户端

  • 电脑飞书客户端

群聊玩法

在飞书电脑端,创建群聊 → 把机器人拉进群

@小民飞书机器人,没搭理我🤔

如下图所示,飞书群组默认是“白名单模式”,而我的群没在名单里,所以消息被悄悄丢弃了😭

把当前群加到白名单,下面的命令可以参考使用,这块就需要小伙伴们有一定的排查问题能力了哈👇

# 将指定群聊 ID 添加到飞书通道的群聊白名单# 这样该群内的 @机器人消息就会被允许处理# 群 ID 格式示例:oc_8348863a902a2bcb006fa22750fde7e6openclaw config set --json channels.openclaw-feishu.groupAllowFrom '["oc_8348863a902a2bcb006fa22750fde7e6"]'# 将群聊策略设置为“开放模式”# open    = 所有群都可使用(适合测试)# allowlist = 仅白名单内的群可用(适合正式环境)openclaw config set channels.openclaw-feishu.groupPolicy open# 重启 OpenClaw 网关,使配置生效openclaw gateway restart

踩坑记录

  • 坑①:配置命令用了错误的通道ID导致执行报错

    现象:执行命令时报错unknown channel id: feishu原因:飞书插件的通道ID是openclaw-feishu,不是feishu解决:所有配置命令中的feishu都要改成openclaw-feishu

  • 坑②:群聊不回复(白名单问题)

    现象:群里@机器人,它完全没反应原因:飞书通道默认开启了群组白名单(groupPolicy: "allowlist"),但白名单是空的解决:改成groupPolicy:open或把群ID加入白名单

  • 坑③:飞书权限不足问题

    现象:日志里报Access denied,缺少联系人权限原因:应用缺少contact:user.base:readonly等权限解决:去飞书开放平台添加权限并重新发布

  • 坑④:插件装了两个,互相冲突

    现象:配置没问题,但机器人就是不工作原因:同时安装了多个飞书插件,导致冲突解决:rm -rf ~/.openclaw/extensions/feishu删掉多余的

官方资源

写在最后

现在,我可以在飞书上随时@它:

  • 查资料、写文案

  • 整理会议纪要

  • 设置提醒、管理日程

如果你也想养一只自己的“小龙虾”,希望这篇文章能帮你避开我踩过的坑。

遇到问题欢迎留言交流~