lark-channel-sdk is a Python package for building Feishu and Lark
conversational bots. It provides FeishuChannel as the main entry point for
event listening, message normalization, policy control, outbound messaging,
media handling, card callbacks, and streaming replies.
pip install lark-channel-sdkimport asyncio
import os
from lark_channel import FeishuChannel
channel = FeishuChannel(
app_id=os.environ["LARK_APP_ID"],
app_secret=os.environ["LARK_APP_SECRET"],
)
async def on_message(msg):
await channel.send(
msg.chat_id,
{"markdown": f"received: {msg.content_text}"},
{"reply_to": msg.message_id},
)
channel.on("message", on_message)
asyncio.run(channel.connect())- Quickstart
- Migration from
lark_oapi.channel - API reference
- Security configuration
- Markdown messages
- Webhook server adapter
- CardKit streaming
- Deduplication architecture
- Release notes
- Echo bot sample
Install the standalone package and update the import path:
pip install lark-channel-sdkfrom lark_channel import FeishuChannellark-channel-sdk can be installed alongside lark-oapi. Use
lark-channel-sdk for Channel bot workflows and keep using lark-oapi when
your application needs the full OpenAPI SDK surface.
See the migration guide for import mapping, runtime compatibility notes, and a migration checklist.
SecurityConfig defaults to compatibility mode so existing bots continue to
run during migration. For production rollout, start with audit mode and then
move to strict mode after reviewing audit events:
from lark_channel import FeishuChannel, SecurityConfig
channel = FeishuChannel(
app_id="cli_xxx",
app_secret="***",
security=SecurityConfig(mode="audit"),
)See Security configuration for strict-mode behavior and webhook compatibility switches.
pip install -e ".[test]"
python -m pytestThis distribution is licensed as MIT AND BSD-3-Clause: project code is
licensed under the MIT License as described in LICENSE, and vendored
third-party code is documented in
THIRD_PARTY_NOTICES.md.