> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langbot.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Feishu

> LangBot で Feishu/Lark AI ボットを構築。GPT・Claude・Dify 等を Feishu のグループやメッセージに接続。

## プラットフォームドメインの選択

ボットを作成する際、**アダプター設定**で**プラットフォームドメイン**を選択する必要があります：

* **飞书 (open.feishu.cn)**：国内の飛書ユーザー向け（デフォルト）
* **Lark (open.larksuite.com)**：海外のLarkユーザー向け
* **カスタム (custom)**：プライベートデプロイユーザー向け

<img src="https://mintcdn.com/langbot/ZMMZR9sarF_erPAi/images/zh/deploy/bots/lark/lark_platform_domain.png?fit=max&auto=format&n=ZMMZR9sarF_erPAi&q=85&s=2e1ff909dcde29f76cee2bddb16164d7" alt="プラットフォームドメインの選択" width="1646" height="765" data-path="images/zh/deploy/bots/lark/lark_platform_domain.png" />

<Warning>
  海外版のLarkを選択する場合、`open.larksuite.com`ドメインを使用してください。そうしないと、接続に失敗する可能性があります。プライベートデプロイユーザーは、実際のデプロイアドレスに応じてカスタムを選択し、対応するドメインを入力してください。
</Warning>

## 一键設定（おすすめ）

LangBot は Feishu アプリのワンクリック作成とクレデンシャルの自動入力に対応しています。手動でのコピペは不要です。

1. LangBot WebUI を開き、**ボット > ボットを作成** に移動
2. ボット名を入力し、プラットフォーム/アダプターで `飞书` を選択
3. 表示される **一键创建应用** エリアで **開始** ボタンをクリック

<img src="https://mintcdn.com/langbot/2gQAELt1nN3_kQMs/images/zh/deploy/bots/lark/lark_oneclick_qrcode.png?fit=max&auto=format&n=2gQAELt1nN3_kQMs&q=85&s=5af9f37cd15c93853c13c23ab09196af" alt="一键创建飞书应用" width="1868" height="891" data-path="images/zh/deploy/bots/lark/lark_oneclick_qrcode.png" />

4. 飛書で QR コードをスキャンし、手机端で飞書開放平台のボット作成ページが表示されます
5. **既存のアプリを使用** または **新規作成** を選択できます：

<img src="https://mintcdn.com/langbot/2gQAELt1nN3_kQMs/images/zh/deploy/bots/lark/lark_select_or_create_bot.png?fit=max&auto=format&n=2gQAELt1nN3_kQMs&q=85&s=3c23aab467c3849f42b3d092501f08d9" alt="手机端で選択" width="1473" height="889" data-path="images/zh/deploy/bots/lark/lark_select_or_create_bot.png" />

既存のアプリを選択すると、アプリ一覧が表示されます：

<img src="https://mintcdn.com/langbot/2gQAELt1nN3_kQMs/images/zh/deploy/bots/lark/lark_select_existing.png?fit=max&auto=format&n=2gQAELt1nN3_kQMs&q=85&s=992a3b8307ab26b140c1a3f5dba16466" alt="既存アプリを選択" width="380" height="844" data-path="images/zh/deploy/bots/lark/lark_select_existing.png" />

6. 認証成功後、手机端に「設定成功」と表示され、app\_id と app\_secret が LangBot WebUI に**自動入力**されます

<img src="https://mintcdn.com/langbot/2gQAELt1nN3_kQMs/images/zh/deploy/bots/lark/lark_config_success.png?fit=max&auto=format&n=2gQAELt1nN3_kQMs&q=85&s=4d4fee86bf7b13bdbdf4fad035c9b380" alt="設定成功" width="1576" height="920" data-path="images/zh/deploy/bots/lark/lark_config_success.png" />

7. **ボット名を手動で入力** — 飛書のボット名と一致させる必要があります。一致しない場合、グループ内でメッセージを受信できません

<img src="https://mintcdn.com/langbot/2gQAELt1nN3_kQMs/images/zh/deploy/bots/lark/lark_fill_bot_name.png?fit=max&auto=format&n=2gQAELt1nN3_kQMs&q=85&s=556bde429c568f672409c3c1294b8e69" alt="ボット名の入力" width="1676" height="893" data-path="images/zh/deploy/bots/lark/lark_fill_bot_name.png" />

8. **送信** をクリックして完了

***

## ボットの作成

[Feishu Open Platform](https://open.feishu.cn/app)にアクセスし、ログインして、企業の自己構築アプリケーションまたはストアアプリケーションを作成します。[(違いの紹介)](https://open.feishu.cn/document/platform-overveiw/overview)

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/lark/lark_01.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=698d381ebc66e58f683c9d2321a96c65" alt="alt text" width="2488" height="1390" data-path="images/zh/deploy/bots/lark/lark_01.png" />

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_02.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=5d0c70300e7df42c1e9cd85f56c52bff" alt="alt text" width="1448" height="1228" data-path="images/zh/deploy/bots/lark/lark_02.png" />

アプリケーションにボット機能を追加します：

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_03.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=79797d777aa43776136010f2705de685" alt="alt text" width="2264" height="1440" data-path="images/zh/deploy/bots/lark/lark_03.png" />

権限管理で画像に示されている権限を追加します：

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_04.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=a4dffa4bc7be475e2aea37df65e05b31" alt="alt text" width="3170" height="1440" data-path="images/zh/deploy/bots/lark/lark_04.png" />

カードストリーミング権限が必要な場合は、画像に示されている次のカード作成と更新権限を追加します：

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_14.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=a389c94716cede521e74577c43cbf37e" alt="img_1.png" width="3178" height="1628" data-path="images/zh/deploy/bots/lark/lark_14.png" />

<Warning>
  デフォルトのカードテンプレートを変更する必要がある場合は、プラットフォームアダプターのコードでカードテンプレートを自分で修正する必要があります。
</Warning>

### LangBot に接続

「認証情報と基本情報」ページで `app_id` と `app_secret` を見つけます。

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_05.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=7cf0313f74c9e2386cf4d7e8adcd18d4" alt="alt text" width="2150" height="886" data-path="images/zh/deploy/bots/lark/lark_05.png" />

LangBot の Webui 設定ページを開き、新しいボットを作成します

フォームに関連情報を入力します

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/lark/connect_to_langbot.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=447c067002f8dfd754494a2530e54b98" alt="alt text" width="1014" height="1892" data-path="images/zh/deploy/bots/lark/connect_to_langbot.png" />

ストリーミング関連：

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/lark/connect_to_langbot01.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=69e042a2e38bc395f18c777261a17f43" alt="Streaming related" width="1920" height="893" data-path="images/zh/deploy/bots/lark/connect_to_langbot01.png" />

入力後、LangBot を起動します。設定が成功した場合、ログに `[01-29 23:42:56.796] manager.py (68) - [INFO] : Initializing platform adapter 1: lark` と表示されます。LangBot を実行し続けてください。

<Warning title="">
  デフォルトでは、WebSocket 長時間接続モードが使用されます。これは以下の長時間接続サブスクリプションに対応しています。ただし、場合によっては（国際版の Feishu など）、長時間接続モードが利用できない場合があります。その場合は、Webhook モードを使用する必要があります。これは、「開発者サーバーにイベントを送信」モードに対応しています。次の設定を参照してください：

  * `enable-webhook`：`true` に設定
  * `encrypt-key`：「イベントとコールバック」ページの「暗号化戦略」の「Encrypt Key」に設定

  Webhook モードでは、LangBot をパブリック IP を持つサーバーにデプロイし、ファイアウォールが上記で設定したポートを開いていることを確認する必要があることに注意してください。
</Warning>

<Tip>
  **パブリックサーバーがありませんか？** [LangBot Cloud](https://space.langbot.app/cloud) にはドメインと HTTPS が含まれており、Lark ボットをすぐに使用できます。
</Tip>

### イベントサブスクリプションの設定

「イベントとコールバック」ページに移動し、サブスクリプション方式を「長時間接続」として設定します：

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_07.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=0cd12a2b1a03c95292fa57dc8dfde5f0" alt="alt text" width="2476" height="962" data-path="images/zh/deploy/bots/lark/lark_07.png" />

そして、イベント：「メッセージを受信」を追加します

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_08.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=42a23159655e5ddf72aa9856c2aab4db" alt="alt text" width="2064" height="570" data-path="images/zh/deploy/bots/lark/lark_08.png" />

`コールバック設定`を設定し、長時間接続のコールバックを選択します（webhook の場合は webhook を使用）

<img src="https://mintcdn.com/langbot/wl0V3l3GoV7sRjdf/images/zh/deploy/bots/lark/lark_16.png?fit=max&auto=format&n=wl0V3l3GoV7sRjdf&q=85&s=6d1d2e746c06211970baaa53eb2259f6" alt="コールバック設定" width="1848" height="722" data-path="images/zh/deploy/bots/lark/lark_16.png" />

コールバック`カードコールバックインタラクション`を追加します

<img src="https://mintcdn.com/langbot/wl0V3l3GoV7sRjdf/images/zh/deploy/bots/lark/lark_17.png?fit=max&auto=format&n=wl0V3l3GoV7sRjdf&q=85&s=134ccb323842343c08eb451775d35bca" alt="コールバックを追加" width="1920" height="935" data-path="images/zh/deploy/bots/lark/lark_17.png" />

<Warning title="">
  Webhook モード設定方法：

  <img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_13.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=52358ef5436b7575f2c52f2873897cf1" alt="alt text" width="1528" height="546" data-path="images/zh/deploy/bots/lark/lark_13.png" />

  まず LangBot を起動してください。ここに LangBot から取得した Webhook アドレスを入力します。
</Warning>

### ボットの公開

上部の「バージョンを作成」をクリックし、バージョン番号とその他の情報を入力し、下部の「保存」をクリックします。

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_09.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=39b25c0bd52713f63339e6a4ee07207b" alt="alt text" width="1808" height="1702" data-path="images/zh/deploy/bots/lark/lark_09.png" />

ボットを Feishu グループに追加して使用します：

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_10.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=59814214fe07dbc0fc6eead741058ad6" alt="alt text" width="2328" height="1598" data-path="images/zh/deploy/bots/lark/lark_10.png" />

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_11.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=2d58666b978511253f2524442cda30a0" alt="alt text" width="754" height="520" data-path="images/zh/deploy/bots/lark/lark_11.png" />

プライベートチャットでも直接使用できます

<img src="https://mintcdn.com/langbot/7LP8IdEMby3DrX2X/images/zh/deploy/bots/lark/lark_12.png?fit=max&auto=format&n=7LP8IdEMby3DrX2X&q=85&s=75484117825bbdb098cc07745bdf807c" alt="alt text" width="1104" height="704" data-path="images/zh/deploy/bots/lark/lark_12.png" />

## よくある問題

* ストアアプリのボットは、作成/保存直後にチャットメッセージに応答できません。[app\_ticket イベント](https://open.feishu.cn/document/server-docs/application-v6/event/app_ticket-events)の遅延メカニズムにより、正常に動作するまで約 2 分待つ必要があります。
