feishu-binding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese📱 Feishu/Lark Binding
📱 Feishu/Lark绑定
Connect / disconnect the user's Feishu (飞书) or Lark account so the agent can chat via the Feishu/Lark app.
The tool stays built-in. This SKILL.md is the reference doc.
feishu连接/断开用户的飞书(Feishu)或Lark账户,以便Agent可以通过Feishu/Lark应用进行聊天。
feishuSee also
另请参阅
- — how messages are routed across channels
config/context/references/messaging-channels.md - — analogous WeChat flow
skills/wechat-binding/SKILL.md - — analogous Telegram flow
skills/tg-bot-binding/SKILL.md
- — 消息跨渠道路由方式说明
config/context/references/messaging-channels.md - — 类似的微信绑定流程
skills/wechat-binding/SKILL.md - — 类似的Telegram绑定流程
skills/tg-bot-binding/SKILL.md
Brand selection
品牌选择
| Brand | Region | Domain |
|---|---|---|
| China mainland (中国大陆) | feishu.cn / accounts.feishu.cn |
| International | larksuite.com / accounts.larksuite.com |
Ask the user which brand they use. Default to if unclear. Chinese-speaking users almost always use .
feishufeishu| 品牌 | 地区 | 域名 |
|---|---|---|
| 中国大陆 | feishu.cn / accounts.feishu.cn |
| 国际地区 | larksuite.com / accounts.larksuite.com |
询问用户使用的品牌。若不明确,默认使用。中文用户几乎都会使用。
feishufeishuTypical binding flow
典型绑定流程
connect(brand) → user scans QR / opens link → poll(device_code) → done- Start device flow: — returns
feishu(action="connect", brand="feishu"),verification_uri, and a QR code image saved to workspace.device_code - Show BOTH options to the user:
- QR code scan: Display the QR code image inline using the from the result (e.g.
markdown_image). The user scans it with their Feishu/Lark app. - Direct link: Show the as a clickable link. The user opens it in their browser, logs in to Feishu/Lark, and confirms.
verification_url
- QR code scan: Display the QR code image inline using the
- Wait for the user to confirm. Don't auto-poll — let them say "done" / "confirmed" / "已确认" / "scanned" first.
- Poll for completion: .
feishu(action="poll", device_code=<from step 1>, brand=<same brand>)- → binding complete, congratulate the user.
status: "done" - → ask the user if they've scanned the QR code or opened the link and confirmed.
status: "pending" - → the device flow expired (typically 5 minutes). Start over with
status: "expired".connect
- Confirm to user: "Feishu/Lark connected! You can now chat with your agent on Feishu/Lark."
connect(brand) → 用户扫描二维码/打开链接 → poll(device_code) → 完成- 启动设备流: — 返回
feishu(action="connect", brand="feishu")、verification_uri,并将二维码图片保存至工作区。device_code - 向用户展示两种选项:
- 扫码: 使用返回结果中的(例如
markdown_image)在页面内显示二维码图片。用户使用Feishu/Lark应用扫码。 - 直接链接: 将显示为可点击链接。用户在浏览器中打开链接,登录Feishu/Lark并确认授权。
verification_url
- 扫码: 使用返回结果中的
- 等待用户确认。 不要自动轮询 — 等待用户发送“完成”/“已确认”/“scanned”等指令后再进行下一步。
- 轮询完成状态: 。
feishu(action="poll", device_code=<步骤1获取的代码>, brand=<同一品牌>)- → 绑定完成,向用户表示祝贺。
status: "done" - → 询问用户是否已扫码或打开链接并确认授权。
status: "pending" - → 设备流已过期(通常为5分钟)。重新执行
status: "expired"步骤。connect
- 向用户确认: "Feishu/Lark已连接!您现在可以在Feishu/Lark上与您的Agent聊天了。"
Actions
操作指令
| action | required params | purpose |
|---|---|---|
| — | Current Feishu/Lark app state. Use to check if already connected. |
| | Start device flow. Returns verification URL + device_code. |
| | Check if user has confirmed authorization. Returns status. |
| — | Unbind Feishu/Lark app (destructive — confirm with user first). |
| 操作 | 必填参数 | 用途 |
|---|---|---|
| — | 查询当前Feishu/Lark应用状态。用于检查是否已连接。 |
| | 启动设备流。返回验证URL和device_code。 |
| | 检查用户是否已确认授权。返回状态。 |
| — | 解绑Feishu/Lark应用(此操作不可逆 — 执行前需与用户确认)。 |
Channel-aware QR / link display
适配不同渠道的二维码/链接展示方式
| User channel | How to show |
|---|---|
| Web | Include |
| Telegram | |
| Show the link only (user can't scan a QR inside WeChat for Feishu) | |
| Feishu | (User is already on Feishu — they don't need to bind. Tell them it's already connected or check |
| 用户渠道 | 展示方式 |
|---|---|
| Web | 在回复中包含 |
| Telegram | |
| 微信 | 仅展示链接(用户无法在微信内扫描Feishu二维码) |
| Feishu | (用户已在Feishu上 — 无需绑定。告知用户已连接或调用 |
Key differences from WeChat / Telegram
与微信/Telegram的主要差异
| Aspect | Feishu/Lark | Telegram | |
|---|---|---|---|
| Auth method | Device flow (URL) | QR code scan | Bot token |
| User action | Open URL + confirm in app | Scan QR + confirm | Create bot via @BotFather |
| Credential | None (device flow handles it) | bot_token (from QR) | bot_token (from BotFather) |
| Brand choice | feishu / lark | N/A | N/A |
| 维度 | Feishu/Lark | 微信 | Telegram |
|---|---|---|---|
| 授权方式 | 设备流(URL) | 扫码 | Bot令牌 |
| 用户操作 | 打开URL + 在应用内确认 | 扫码 + 确认 | 通过@BotFather创建Bot |
| 凭证 | 无(设备流自动处理) | bot_token(来自扫码) | bot_token(来自@BotFather) |
| 品牌选择 | feishu / lark | 无 | 无 |
Critical rules
重要规则
- Don't auto-poll after . Wait for user confirmation that they've opened the link and confirmed in Feishu/Lark. Auto-polling wastes API calls.
connect - Device flow expires in ~5 minutes. If returns
poll, tell the user and start a newexpired.connect - is destructive — confirm with the user before calling it. It will stop the Feishu/Lark gateway instance.
disconnect - Brand matters — and
feishuuse different API domains. Using the wrong brand will fail silently or redirect to the wrong login page.lark - One app per user — a user can only have one Feishu/Lark app at a time. If they want to switch brands, they must first, then
disconnectwith the new brand.connect
- 不要自动轮询:执行后不要自动轮询。等待用户确认已打开链接并在Feishu/Lark内完成授权。自动轮询会浪费API调用次数。
connect - 设备流过期:设备流约5分钟后过期。若返回
poll,告知用户并重新执行expired。connect - 操作不可逆:执行前需与用户确认。此操作会停止Feishu/Lark网关实例。
disconnect - 品牌至关重要:和
feishu使用不同的API域名。使用错误品牌会导致静默失败或跳转到错误的登录页面。lark - 单用户单应用:一个用户同一时间只能绑定一个Feishu/Lark应用。若用户想要切换品牌,必须先执行,再使用新品牌执行
disconnect。connect
Troubleshooting
故障排查
| Symptom | Likely cause | Fix |
|---|---|---|
| User already has an active app | Call |
| User took too long to confirm | Start a new |
| User hasn't opened the URL yet | Remind them to open the verification URL |
| User says "I can't find the link" | URL was in a previous message | Re-run |
| 症状 | 可能原因 | 解决方法 |
|---|---|---|
| 用户已有活跃的应用 | 先调用 |
| 用户确认授权耗时过长 | 重新执行 |
| 用户尚未打开URL | 提醒用户打开验证URL |
| 用户反馈“找不到链接” | 链接在之前的消息中 | 重新执行 |