飞书接入codex
前言
codex不能直接原生接入飞书,需要一个中间插件实现,也就是需要lark-channel-bridge监听作为桥梁实现
| 组件 | 用途 | 是否必需 |
|---|---|---|
| 飞书企业自建应用/机器人 | 接收和回复消息 | 必需 |
| Node.js 20+ | 运行 Bridge 和 Codex CLI | 必需 |
lark-channel-bridge 0.7.0 |
飞书与 Codex 之间的消息桥接 | 必需 |
lark-cli |
调用飞书消息接口,由 Bridge 自动安装和绑定 | 必需 |
@openai/codex |
本地 Codex CLI | 必需 |
| Bridge 加密密钥库 | 保存飞书 App Secret,由 Bridge 自动创建 | 必需 |
飞书设置(可选)
如果重头创建一个新的机器人,后面lark-channel-bridge会有一个引导创建的链接,可以跳过这步
- 开启机器人能力。
- 开通接收消息、发送消息和回复消息权限。
- 在事件订阅中选择长连接,并订阅消息接收事件。
- 发布应用,将机器人加入需要使用的群。
- 记录
App ID和App Secret。
部署
如果有图形化的codex,也需要安装cli版本,不过不用设置登录了
1 | 检查 Node.js,要求 20+ |
创建 Bridge Profile
创建 Bridge Profile,将
App ID和workspace替换为实际值:
下面是两种格式的命令,任选其一即可
1 | lark-channel-bridge profile create codex-feishu ` |
1 | lark-channel-bridge profile create codex-feishu --agent codex --workspace D:\Your-Workspace --app-id cli_xxxxxxxxxxxxx --tenant feishu |
创建错了可以使用命令删除
1 lark-channel-bridge profile delete codex-feishu
打开并启动 Bridge
前台启动
1
lark-channel-bridge run --profile codex-feishu
打开 Bridge Web UI 并启动
1
lark-channel-bridge run --web-ui
后台启动
1
2lark-channel-bridge start --profile codex-feishu
lark-channel-bridge status --profile codex-feishu
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 HAHA!


