feat(feishu): add configurable domain for Lark international support (#1535)

The lark-oapi SDK defaults to open.feishu.cn (China), but apps on the
international Lark platform (open.larksuite.com) fail to connect with
error 1000040351 'Incorrect domain name'.

Changes:
- Add 'domain' config option to feishu channel (default: open.feishu.cn)
- Pass domain to both API client and WebSocket client
- Update config.example.yaml and all README files
This commit is contained in:
张凯强 2026-03-30 11:42:07 +08:00 committed by GitHub
parent 9bcdba6038
commit 7db95926b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 3 deletions

View File

@ -323,6 +323,8 @@ channels:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
# domain: https://open.feishu.cn # China (default)
# domain: https://open.larksuite.com # International
slack:
enabled: true

View File

@ -314,6 +314,8 @@ channels:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
# domain: https://open.feishu.cn # China (default)
# domain: https://open.larksuite.com # International
slack:
enabled: true

View File

@ -267,6 +267,8 @@ channels:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
# domain: https://open.feishu.cn # China (default)
# domain: https://open.larksuite.com # International
slack:
enabled: true

View File

@ -265,6 +265,8 @@ channels:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
# domain: https://open.feishu.cn # China (default)
# domain: https://open.larksuite.com # International
slack:
enabled: true

View File

@ -255,6 +255,8 @@ channels:
enabled: true
app_id: $FEISHU_APP_ID
app_secret: $FEISHU_APP_SECRET
# domain: https://open.feishu.cn # 国内版(默认)
# domain: https://open.larksuite.com # 国际版
slack:
enabled: true

View File

@ -92,12 +92,14 @@ class FeishuChannel(Channel):
app_id = self.config.get("app_id", "")
app_secret = self.config.get("app_secret", "")
domain = self.config.get("domain", "https://open.feishu.cn")
if not app_id or not app_secret:
logger.error("Feishu channel requires app_id and app_secret")
return
self._api_client = lark.Client.builder().app_id(app_id).app_secret(app_secret).build()
self._api_client = lark.Client.builder().app_id(app_id).app_secret(app_secret).domain(domain).build()
logger.info("[Feishu] using domain: %s", domain)
self._main_loop = asyncio.get_event_loop()
self._running = True
@ -109,13 +111,13 @@ class FeishuChannel(Channel):
# which conflicts with an already-running uvloop.
self._thread = threading.Thread(
target=self._run_ws,
args=(app_id, app_secret),
args=(app_id, app_secret, domain),
daemon=True,
)
self._thread.start()
logger.info("Feishu channel started")
def _run_ws(self, app_id: str, app_secret: str) -> None:
def _run_ws(self, app_id: str, app_secret: str, domain: str) -> None:
"""Construct and run the lark WS client in a thread with a fresh event loop.
The lark-oapi SDK captures a module-level event loop at import time
@ -145,6 +147,7 @@ class FeishuChannel(Channel):
app_secret=app_secret,
event_handler=event_handler,
log_level=lark.LogLevel.INFO,
domain=domain,
)
ws_client.start()
except Exception:

View File

@ -617,6 +617,8 @@ checkpointer:
# enabled: false
# app_id: $FEISHU_APP_ID
# app_secret: $FEISHU_APP_SECRET
# # domain: https://open.feishu.cn # China (default)
# # domain: https://open.larksuite.com # International
#
# slack:
# enabled: false