Skip to content

Feishu Integration

Feishu / Lark is currently the primary platform for the system, and it is integrated via WebSocket Stream mode.

Understand the integration first

ItemCurrent implementation
Event intakeWebSocket Stream
Main entry pointsrc/feishu/feishu-ws-app.ts
Bot interactionsmessages, cards, bot menu
Platform outputsrc/feishu/channel/*

Feishu Open Platform entry:

Create the app

Recommended sequence:

StepAction
1Create an internal enterprise app in the Feishu Open Platform
2Enable bot capability
3Get the App ID and App Secret
4Grant the required permissions
5Configure event subscriptions
6Configure app visibility and publish
7Add the app to a group chat or enable 1:1 chat usage

Environment variables

VariableDescription
FEISHU_APP_IDApp ID
FEISHU_APP_SECRETApp secret
FEISHU_SIGNING_SECRETEvent signing secret; usually optional in Stream mode
FEISHU_ENCRYPT_KEYEncryption support for encrypted events
FEISHU_API_BASE_URLDefaults to https://open.feishu.cn/open-apis
dotenv
FEISHU_APP_ID=cli_xxx
FEISHU_APP_SECRET=xxx
FEISHU_SIGNING_SECRET=
FEISHU_ENCRYPT_KEY=
FEISHU_API_BASE_URL=https://open.feishu.cn/open-apis

Permissions

The following permissions are based on the permission list you provided and are shown here as tenant-level scopes.

PermissionPurpose
cardkit:card:writeCreate and update cards
contact:contact.base:readonlyRead basic contact directory data
contact:user.base:readonlyRead basic user info
im:chatAccess chat-level capabilities
im:chat.members:readRead group member lists
im:chat.menu_tree:readRead chat menu trees
im:chat.menu_tree:write_onlyWrite chat menu trees
im:chat.top_notice:write_onlyWrite top notices in chats
im:chat.widgets:readRead chat widgets
im:chat.widgets:write_onlyWrite chat widgets
im:chat:readonlyRead chat info
im:messageRead and send messages
im:message.group_at_msg:readonlyRead group mentions to the bot
im:message.group_msgHandle group messages
im:message.p2p_msg:readonlyRead direct messages
im:message:send_as_botSend messages as the app/bot

If you want to configure the app directly, use:

Event subscriptions

Based on the event configuration screenshot you provided, the current event subscriptions should include:

EventPurpose
im.message.receive_v1Receive user messages
card.action.triggerReceive card callbacks
im.chat.member.bot.added_v1Bot added to group chat
im.chat.member.bot.deleted_v1Bot removed from group chat
im.chat.member.user.added_v1New member joined the group chat
application.bot.menu_v6Bot menu event

For callbacks, the required entry is:

CallbackPurpose
card.action.triggerReceive interactive card callbacks

Your callback screenshot also shows url.preview.get and profile.view.get, but they are not required for the current main path.

Visibility and release

SettingRecommendation
App visibilityInclude the users and groups that need the bot
Version publishingPublish the app version after permissions and events are ready
Group capabilityAdd the bot to the target group chats
Direct-message capabilityConfirm the app allows 1:1 chat with the bot

Minimal validation checklist

CheckExpected result
Bot can join a group chatThe bot is visible in the group
User messages trigger eventsim.message.receive_v1 works
Card buttons call back successfullycard.action.trigger works
Bot menu triggers workapplication.bot.menu_v6 works
Bot can send messages / update cardsOutput path is functioning
bash
npm run start:dev
tail -f data/logs/app.log