feishu-connection
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFeishu Bridge
Feishu桥接
Bridge Feishu bot messages to Clawdbot Gateway over local WebSocket.
通过本地WebSocket将Feishu机器人消息桥接到Clawdbot网关。
Architecture
架构
Feishu user → Feishu cloud ←WS→ bridge.py (local) ←WS→ Clawdbot Gateway → AI agent- Feishu SDK connects outbound (no inbound port / public IP needed)
- Bridge authenticates to Gateway using the existing gateway token
- Each Feishu chat maps to a Clawdbot session ()
feishu:<chatId>
Feishu用户 → Feishu云 ←WS→ bridge.py(本地) ←WS→ Clawdbot网关 → AI Agent- Feishu SDK采用outbound连接(无需入站端口/公网IP)
- 桥接服务使用现有网关令牌向网关进行身份验证
- 每个Feishu聊天对应一个Clawdbot会话()
feishu:<chatId>
Setup
配置步骤
1. Create Feishu bot
1. 创建Feishu机器人
- Go to open.feishu.cn/app → Create self-built app → Add Bot capability
- Enable permissions: ,
im:message,im:message.group_at_msgim:message.p2p_msg - Events: add , set delivery to WebSocket long-connection
im.message.receive_v1 - Publish the app (create version → request approval)
- Note the App ID and App Secret
- 访问open.feishu.cn/app → 创建自建应用 → 添加机器人能力
- 启用权限:,
im:message,im:message.group_at_msgim:message.p2p_msg - 事件:添加,设置投递方式为WebSocket长连接
im.message.receive_v1 - 发布应用(创建版本 → 申请审批)
- 记录App ID和App Secret
2. Store secret
2. 存储密钥
bash
mkdir -p ~/.clawdbot/secrets
echo "YOUR_APP_SECRET" > ~/.clawdbot/secrets/feishu_app_secret
chmod 600 ~/.clawdbot/secrets/feishu_app_secretbash
mkdir -p ~/.clawdbot/secrets
echo "YOUR_APP_SECRET" > ~/.clawdbot/secrets/feishu_app_secret
chmod 600 ~/.clawdbot/secrets/feishu_app_secret3. Install & run
3. 安装并运行
bash
cd <skill-dir>/feishu-connection
uv sync
FEISHU_APP_ID=cli_xxx uv run python bridge.pybash
cd <skill-dir>/feishu-connection
uv sync
FEISHU_APP_ID=cli_xxx uv run python bridge.py4. Auto-start (macOS)
4. 自动启动(macOS)
bash
FEISHU_APP_ID=cli_xxx uv run python setup_service.py
launchctl load ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plistbash
FEISHU_APP_ID=cli_xxx uv run python setup_service.py
launchctl load ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plistDiagnostics
诊断
bash
undefinedbash
undefinedCheck service
检查服务状态
launchctl list | grep feishu
launchctl list | grep feishu
Logs
查看日志
tail -f ~/.clawdbot/logs/feishu-bridge.err.log
tail -f ~/.clawdbot/logs/feishu-bridge.err.log
Stop
停止服务
launchctl unload ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plist
undefinedlaunchctl unload ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plist
undefinedGroup chat behavior
群聊行为
Bridge replies only when: user @-mentions the bot, message ends with /, contains request verbs (帮/请/分析/总结…), or calls the bot by name. Customize the name list in → .
??bridge.pyshould_respond_in_group()桥接服务仅在以下情况回复:用户@提及机器人、消息以/结尾、包含请求类动词(帮/请/分析/总结…)或呼叫机器人名称。可在的函数中自定义名称列表。
??bridge.pyshould_respond_in_group()Environment variables
环境变量
| Variable | Required | Default |
|---|---|---|
| ✅ | — |
| — | |
| — | |
| — | |
| — | |
| 变量名 | 是否必填 | 默认值 |
|---|---|---|
| ✅ | — |
| — | |
| — | |
| — | |
| — | |