> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/ja/serve/whatislineliff/setting.md).

# LINE LIFF：連携方法

LINE LIFF の連携手順：LINE Developers で LIFF app を作成し、対話プラットフォームの公開 URL を Endpoint URL に設定して、LINE のチャット画面内で Web Chat を開きます。

### <mark style="color:blue;">前提条件：</mark>

* [MaiAgent プラットフォーム](https://admin.maiagent.ai/)で「Website」の対話プラットフォームを作成済みであること。
* [LINE Developers](https://developers.line.biz/zh-hant/) のコンソールで「Provider」と「LINE Login」チャネルを作成済みであること。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-dd3350c5121d7228cf1e7f5b7de7a63f86c2ff5b%2Fimage%20(4)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-3a561089a06f504505da12ec371b943e79e2a24d%2Fimage%20(2)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

### <mark style="color:blue;">設定手順：</mark>

1\. [LINE Developers](https://developers.line.biz/zh-hant/) のコンソールで、LIFF detail ページの「**LIFF app name**」欄に **LIFF app** の名前を入力します。

**2. Size** 欄で **Full** を選択します。

**3. Endpoint URL** 欄

対話プラットフォームの「**公開アクセス URL**」を「**Endpoint URL**」欄にコピーし、末尾に「**/line-liff/**」を追加します。

4\. **Scopes** 欄で **openid** と **profile** の両方にチェックを入れます。

{% hint style="warning" %}
**openid** には必ずチェックを入れてください。MaiAgent は LINE が発行した ID token を使って LINE にユーザーの本人確認を行い、検証に成功した場合にのみ、その LINE ユーザーに紐づけて対話を記録します。openid にチェックが入っていなくても LIFF ページで対話はできますが、対話は匿名の連絡先として記録され、管理画面には LINE ユーザーの名前とプロフィール画像が表示されません。すでに公開済みの LIFF app は、LIFF detail ページに戻って openid にチェックを入れ、「Update」をクリックしてください。
{% endhint %}

5\. **Add friend option** 欄で \*\*\*\*On (normal) を選択します。

6\. ページ下部の「Save」ボタンをクリックし、LIFF detail ページに戻ります。システムが生成した **LIFF ID が表示されるので、この ID を**「Endpoint URL」欄の URL の「.../line-liff/」の後ろに追加し、「**Update**」をクリックします。

7\. 最後にページ上部で、この **LIFF** を <mark style="color:blue;">**Published**</mark> にすると、設定と公開が完了します。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-f3f2b36fbf9047e6fe13237a1e5ae7b01fc53eda%2Fimage%20(7).png?alt=media" alt=""><figcaption></figcaption></figure>

### <mark style="color:blue;">利用を開始しましょう！</mark>

1. 「**LIFF URL**」が、この **LIFF** のリンク URL です。
2. LINE のチャットルームで「**LIFF URL**」のリンクを開いたユーザー（リッチメニュー経由）は、Web Chat ページに移動して Agent と対話できます。MaiAgent の管理画面でユーザー情報と対話情報を受け取れるようになります。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-6abe39cd45ce7f907a720c43bac23b24365d18a8%2Fimage%20(9).png?alt=media" alt="" width="188"><figcaption></figcaption></figure>

### <mark style="color:blue;">連絡先の同期動作と制限</mark> <a href="#contact-sync-behavior" id="contact-sync-behavior"></a>

1. **連絡先の作成方法**：ユーザーが LIFF 経由で Web Chat を開いてメッセージを送信すると、MaiAgent はそのユーザーの **LINE User ID** を使って、この対話プラットフォームに連絡先を作成します。その後、同じユーザーが再び対話すると、連絡先の**名前**と**プロフィール画像**を更新します。
2. **取得するのは openid と profile のスコープ内のデータのみです**：LIFF が取得するのは、本人確認用の ID token と LINE の profile（LINE User ID、表示名、プロフィール画像）のみです。**電話番号や Email** など、その他の個人情報は取得できません。
3. **連絡先は各対話プラットフォーム内で照合します**：連絡先は同じ対話プラットフォーム内でのみ LINE User ID を使って照合し、対話プラットフォームをまたいで統合することはありません。同じユーザーが **LINE 公式アカウント**（LINE 対話プラットフォーム）と **LIFF の Web ページ**（Website 対話プラットフォーム）からアクセスすると、管理画面では**別々の 2 件の連絡先**になります。
4. **LINE Login チャネルと Messaging API チャネルは同じ Provider に配置してください**：LINE User ID は Provider ごとに異なり、同じユーザーでも異なる Provider では異なる LINE User ID が割り当てられます。LIFF を配置する LINE Login チャネルと、LINE 公式アカウントの Messaging API チャネルを同じ Provider の下に作成してください。両方の連絡先が同じ LINE User ID を持つため、同一ユーザーを照合しやすくなります。

{% hint style="info" %}
会員情報（会員番号や会員ランクなど）を連絡先に同期する場合は、[連絡先（Contact）の概要と連携](/tech/ja/serve/contacts.md)と[連絡先の本人情報の同期と Token の更新](/tech/ja/serve/contacts/contact-credentials-sync.md)を参照してください。
{% endhint %}

### <mark style="color:blue;">活用シーン</mark>

公式アカウントのリッチメニュー内のリンク、オンラインストアとの連携、会員システムとの連携、イベント申し込みシステム、カスタマーサービスシステム


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/tech/ja/serve/whatislineliff/setting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
