- Interactive card approval: when an agent calls a tool that needs approval, it asks for confirmation as a card in Feishu; click a button to allow or deny;
- Streaming replies: the agent’s answer updates within a single message as it is generated;
- Multimodal input: receive images, files, and voice messages from users and pass them to the agent;
- Markdown: replies render as Markdown, and overly long content is split automatically.
Prerequisites
The Feishu channel depends onlark-oapi, installed with the channel extra:
Install the dependency
Create the app
Create and configure the bot on the Feishu Open Platform; it takes a few minutes.1
Create a custom app
In the developer console, create a “custom app” and fill in its name and icon.
2
Record the App ID and App Secret
On the “Credentials & Basic Info” page, copy the App ID and App Secret to fill into the channel config later. The App Secret is a secret; keep it safe.
3
Enable the bot capability
Under “Add features”, enable “Bot” so the app can send and receive messages.
4
Subscribe to events (long connection)
On the “Events & callbacks” page, set the delivery method to long connection, with no callback URL. Subscribe to the “receive message” event
im.message.receive_v1; card approval also needs the card callback event card.action.trigger.5
Request permissions
Under “Permissions & Scopes”, request the message permissions: receive messages, and send messages as the app (both DMs and groups). If you want to list the bot’s groups while configuring routing, also request the group-list permission. Refer to the Feishu docs for the exact scopes.
6
Publish a version
Create and publish an app version so it becomes available in your organization. You can then add the bot to a group or DM it directly.
Start the agent service
A channel runs on top of an agent service. Start the service withcreate_app and declare the accepted channel types via channels. Channels depend on a message bus (message_bus); use InMemoryMessageBus for single-machine development, and switch to RedisMessageBus for multi-process or multi-node deployment.
Start an agent service that hosts the channel
Add the channel
In the management UI (see the sample frontendexamples/web_ui), add a channel through a visual form, with no config to write by hand.
1
Create a channel and pick Feishu
On the channel management page, create a channel and choose “Feishu” as the platform type.
2
Fill in the credentials
Enter the App ID and App Secret from the previous step into the credential form.
3
Configure routing rules
Choose which agent handles messages and how sessions are scoped. See Message routing for what the rules mean.
4
Save and enable
Save and enable the channel; the service opens the Feishu long connection immediately and the bot comes online. Add it to a group or start a DM to begin.
The management UI maps onto the
/channels endpoints; call them directly when you need to create channels programmatically. See the API part of this chapter for the fields.Platform config
The Feishu channel has a few platform-specific switches:Verify and troubleshoot
- Check the channel status in the management UI, or call
GET /channels/{id}/statusto confirm the long connection is established. - If the bot doesn’t respond in a group, first check
only_at_replyand the @-mention behavior, then check that the message-receive permission was requested and published with the version. - If the bot never comes online, check the App ID / App Secret and that event subscription is set to the long-connection method.
Further reading
Message routing
Route different groups to different agents.
Discord
Connect Discord with the same flow.