Skip to main content

Lark Channel SDK for Python

Project description

Lark Channel SDK for Python

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.

Install

pip install lark-channel-sdk

Minimal Example

import 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())

Documentation

Migration from lark_oapi.channel

Install the standalone package and update the import path:

pip install lark-channel-sdk
from lark_channel import FeishuChannel

lark-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.

Security Mode

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.

Local Development

pip install -e ".[test]"
python -m pytest

License

This 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lark_channel_sdk-1.0.0.tar.gz (363.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lark_channel_sdk-1.0.0-py3-none-any.whl (540.1 kB view details)

Uploaded Python 3

File details

Details for the file lark_channel_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: lark_channel_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 363.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for lark_channel_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b6e991938cee540e24c13bd5f45ba04e02caa6c13a570ed6deb7e6d0bd2a5fa3
MD5 d8a7ced2d08a15f209fc1a84ab1a0748
BLAKE2b-256 71b769c82b1d1f7353fafc655ec7b758850dc257c7c06175961734ecab489c9f

See more details on using hashes here.

File details

Details for the file lark_channel_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lark_channel_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4674d2d873aa23da24fb2705f7e174dc7c827ee5657936dafbac9cbeea017132
MD5 006918989d203ddd07455bf0db6c0318
BLAKE2b-256 7014707c2386f7162bf7f653901d8663d21376af8cf99f7134e86e6d87856b2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page