Lark Trigger binds a Lark integration to a Digital Expert workflow, enabling the flow of “send a message in Lark, route it to the selected Digital Expert in Xpert AI”.
The Lark integration stores App ID, App Secret, Webhook, or long-connection settings. The Lark trigger decides which Digital Expert should process incoming messages.
Applicable scenarios
- Trigger a Digital Expert from Lark direct chats or group chats.
- Use enterprise IM as a unified Digital Expert entry point.
- Restrict which users or groups can trigger the Digital Expert.
- Aggregate several short messages before sending them to the Digital Expert.
- Read Lark message context or image resources during a conversation.
Key configuration
Core Lark Trigger configuration:enabled: whether the trigger is enabledintegrationId: Lark integration instance ID (required)sessionTimeoutSeconds: session timeout, default3600secondssummaryWindowSeconds: message aggregation window, default0secondssingleChatScope: direct-chat scope,all_usersorselected_userssingleChatUserOpenIds: allowed user Open IDs when direct-chat scope is selected usersallowedGroupScope: group-chat scope,all_chatsorselected_chatsallowedGroupChatIds: allowed group chat IDs when group scope is selected chatsgroupReplyStrategy: group reply strategy,mention_onlyorall_messages
- Whether a valid Lark integration is selected.
- Whether the current integration is already bound to another Digital Expert (to avoid conflicts).
- When the trigger is enabled, one Lark integration can only be bound to one Digital Expert at a time.
Setup flow
- Create and test a Lark integration.
- Open the target Digital Expert workflow.
- Add Lark Trigger.
- Select the Lark integration you created.
- Configure direct-chat scope, group-chat scope, group reply strategy, session timeout, and message aggregation window.
- Connect the trigger to downstream Agent, toolset, or knowledge-base nodes.
- Publish the Digital Expert workflow.
integrationId -> xpertId binding. When a Lark message arrives, the platform first finds the target Digital Expert by this binding, then enters workflow execution.
Runtime mechanism
- Publish phase
- Validate that the selected Lark integration exists.
- Check whether the same integration is already occupied by another Digital Expert.
- Write or update the Lark trigger binding.
- Register the current runtime callback.
- Message arrival phase
- Webhook mode receives Lark events from
POST /api/lark/webhook/<integrationId>. - Long-connection mode receives
im.message.receive_v1andcard.action.triggerevents from the Lark long-connection service. - The plugin parses chat ID, sender Open ID, message content, and image/file resources.
- Webhook mode receives Lark events from
- Routing phase
- Find the trigger binding by
integrationId. - Apply direct-chat scope, group-chat scope, and group reply strategy.
- If the message is not allowed, it will not enter the Digital Expert.
- Find the trigger binding by
- Execution phase
- If the runtime callback is available, advance the current workflow directly.
- If the callback is unavailable, such as after restart, enter the persistent handoff queue.
- After the Digital Expert finishes, reply through the Lark context.
Session and message aggregation
sessionTimeoutSeconds controls how long the Lark conversation continues the same Digital Expert session. If the user is idle longer than this value, the next message starts a new Digital Expert session.
summaryWindowSeconds merges several short messages:
0: every message triggers the Digital Expert immediately.- Greater than
0: messages in the same conversation are buffered during this window and merged into one input.
Group chat trigger strategy
Lark groups default tomention_only, meaning only messages that mention the bot trigger processing. all_messages sends all group messages through trigger filtering and is only suitable for dedicated bot groups.
If only some groups should trigger the Digital Expert, set allowedGroupScope to selected_chats and choose the allowed groups in allowedGroupChatIds.
FAQ
The bot does not reply after saving the Lark integration
Check:- The target Digital Expert has added and published Lark Trigger.
- The trigger is enabled and selects the Lark integration used by the current bot.
- In group chats, the message mentions the bot, or
groupReplyStrategyis set toall_messages. - The Lark app subscribes to
im.message.receive_v1. - In Webhook mode, the callback URL is publicly reachable.
- In long-connection mode, the status page shows connected.
User or group selectors are empty
Selectors depend on the Lark integration to read contacts and group chats. Check whether the Lark app has contact/group read permissions and whether the app version has been published again.Image messages do not reach the model
Lark images are read through message resources and converted into files visible to the Digital Expert. Make sure the app has message-resource read permission and the target model supports vision input.Startup recovery strategy
Lark Trigger usesbootstrap.mode = skip:
- It does not replay
publishat startup. - It relies on persistent bindings and external message events to resume processing.
Related features
- Trigger node overview: Workflow Trigger
- Multi-channel access for Digital Expert: Digital Expert
- Lark integration configuration: Lark Integration
- Source code: xpert-plugins / lark integration