wikis / Hermes / wiki / entities / platform-feishu.md view as markdown
Overview
Feishu / Lark (飞书 in China, Lark internationally) is one of the most fully featured Hermes platforms: interactive approval cards, rich markdown posts, media in both directions, emoji-reaction state feedback, and per-group access policies. Platform support landed in v0.6.0; v0.9.0 added the standout scan-to-create onboarding — hermes gateway setup shows a QR code and auto-creates the bot app with correct permissions. Two connection modes: websocket (recommended, outbound connection, no public URL) and webhook (HTTP push with signature verification).
Characteristics
- Credentials:
FEISHU_APP_ID=cli_xxx,FEISHU_APP_SECRET=secret_xxx;FEISHU_DOMAIN=feishu(China) orlark(international). Manual route: open.feishu.cn / open.larksuite.com → create app → enable Bot capability. - Connection modes:
FEISHU_CONNECTION_MODE=websocket(Lark SDK maintains a persistent outbound connection; needswebsocketspackage; tunews_reconnect_interval(default 120 s) /ws_ping_intervalunderplatforms.feishu.extra) orwebhook(aiohttpserver at/feishu/webhook, tunable viaFEISHU_WEBHOOK_HOST=127.0.0.1,FEISHU_WEBHOOK_PORT=8765,FEISHU_WEBHOOK_PATH). URL-verification challenges are answered automatically. - Access control:
FEISHU_ALLOWED_USERS=ou_xxx,ou_yyy(open_ids);FEISHU_GROUP_POLICY=open|allowlist|disabled(defaultallowlist); fine-grained per-groupgroup_rulesinconfig.yaml(open | allowlist | blacklist | admin_only | disabled+ globaladminslist, plusdefault_group_policyfallback). Groups require an@mentionby default — disable globally withFEISHU_REQUIRE_MENTION=falseor per-chat withrequire_mention: falseon agroup_rulesentry; DMs bypass the gate. - Bot-to-bot: other bots' messages are ignored by default;
FEISHU_ALLOW_BOTS=none|mentions|all(defaultnone) opts into A2A orchestration — peer bots bypass the human allowlist; grantapplication:bot.basic_info:readto show peer bot names. - Meeting invitations: invite the bot to a Feishu/Lark video meeting like a human participant — the
vc.bot.meeting_invited_v1event hands the agent the meeting number and it attempts to auto-join, provided the inviter passes normal allowlist/pairing checks. - Webhook security:
FEISHU_ENCRYPT_KEYenablesSHA256(timestamp + nonce + encrypt_key + body)signature checks againstx-lark-signature(timing-safe);FEISHU_VERIFICATION_TOKENchecks the payload token — and gates URL-verification challenges too; both can be combined. Per-IP rate limiting (120 req/60 s window, HTTP 429), 1 MB body cap, 30 s read timeout, JSON-only, anomaly warning after 25 consecutive errors from one IP in 6 h.require_webhook_auth_secret(added in v0.15.0). - Interactive cards / approvals: approval prompts arrive as cards with Allow Once / Session / Always / Deny buttons; clicks route back as synthetic
/cardcommands. Three console steps are mandatory — subscribe tocard.action.trigger, enable the Interactive Card capability, and (webhook mode) set the Message Card Request URL — or button clicks fail with error 200340. - Media: inbound images/audio/video/files downloaded and cached (small
.txt/.mdcontent auto-injected into the message); outboundsend_image_file,send_document,send_voice,send_video; markdown auto-sent as rich post messages with plain-text fallback. - Feedback & batching: processing-status reactions —
Typingwhile working, cleared on reply orCrossMarkon failure; disable withFEISHU_REACTIONS=false(added in v0.11.0). Text batching (0.6 s quiet period, 8 msgs / 4000 chars max,HERMES_FEISHU_TEXT_BATCH_*env vars) and media batching (0.8 s) with per-chat serialization; 24 h message dedup (cache sizeHERMES_FEISHU_DEDUP_CACHE_SIZE=2048) persisted to~/.hermes/feishu_seen_message_ids.json; card actions deduped over a 15-minute window. - Bot identity for mention gating:
FEISHU_BOT_OPEN_ID/FEISHU_BOT_USER_ID/FEISHU_BOT_NAME, or auto-discovery with theadmin:app.info:readonlyscope. - Home chat:
/set-homein a chat, orFEISHU_HOME_CHANNEL=oc_xxxfor cron output and notifications. - Later additions: intelligent reply on document comments with 3-tier access control (added in v0.11.0); operator-configurable bot admission + mention policy (added in v0.13.0); native update prompt cards (added in v0.14.0); SDK lazy-installs (added in v0.14.0).
- Toolset:
hermes-feishu— same core tools as Telegram and other gateway platforms.
How to Use
- Run the wizard and scan the QR with the Feishu/Lark mobile app (scan-to-create builds the app with correct permissions automatically):
hermes gateway setup - Or configure manually in
~/.hermes/.env:FEISHU_APP_ID=cli_xxx FEISHU_APP_SECRET=secret_xxx FEISHU_DOMAIN=feishu FEISHU_CONNECTION_MODE=websocket FEISHU_ALLOWED_USERS=ou_xxx,ou_yyy FEISHU_HOME_CHANNEL=oc_xxx - In the Feishu Developer Console: subscribe to
card.action.trigger, enable Interactive Card, and grantim:message+im:resourcescopes for media. - Start the gateway and message the bot:
hermes gateway
Common gotchas: error 200340 on card buttons (missing console config above); only one local gateway can use the same app_id; missing SDK → pip install lark-oapi.
Related Entities
- platform dingtalk, platform wecom — sibling Chinese-ecosystem enterprise platforms
- platform slack — Western counterpart with similar approval-button UX
- messaging gateway — gateway core; Feishu card approvals are one of its three native approval-button platforms
- approval system — Allow Once / Session / Always / Deny card flow
- version v0.6.0 — Feishu/Lark platform support added
- version v0.9.0 — QR scan-to-create onboarding added
