> 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/api-integration/endpoint-behaviors/conversation-visibility-events.md).

# 対話の閲覧権限とリアルタイムイベント

連携側で会話の閲覧権限、リアルタイムイベント、未読数の整合性をどのように扱うかを説明します。

バックエンドの会話機能を連携する際は、「ユーザーがどの会話を閲覧できるか」を、一覧、未読数、リアルタイムイベントを同時に制約する一つの権限として扱ってください。一般メンバーには、自分が閲覧できる会話のイベントのみが配信されます。すべての会話を閲覧する権限を持つメンバーに限り、その会話プラットフォームの全イベントが配信されます。

## RESTとリアルタイムイベントの違い <a href="#rest-and-realtime" id="rest-and-realtime"></a>

* 受信トレイのRESTレスポンスに含まれる未読数は、現在ログインしているメンバーが閲覧できる会話に基づいて計算されます。
* 会話のRESTレスポンスには、既存のAPIレスポンス形式を維持するため、引き続き受信トレイの未読数フィールドが含まれます。
* リアルタイムイベントには、組織全体で共通の未読数は含まれません。イベントを受信した後、連携側で受信トレイのデータを再取得してから、画面上の未読バッジを更新してください。

{% hint style="warning" %}
リアルタイムイベント内の受信トレイデータで個別の未読数を上書きしないでください。また、同じ組織のすべてのメンバーが同じ会話を閲覧できるとは限りません。
{% endhint %}

## 権限変更後の処理 <a href="#permission-change" id="permission-change"></a>

リアルタイム接続を確立する際に、メンバーが受信できる会話の範囲が決まります。管理者がメンバーの会話閲覧権限を変更した後は、連携側でリアルタイム接続を再確立し、新しいイベント範囲を反映してください。RESTクエリは、リクエスト時点の権限に基づいてデータを返します。

## 連携チェックリスト <a href="#integration-checklist" id="integration-checklist"></a>

1. 一般メンバーとオーナーの両方でテストし、オーナーアカウントだけで検証しないでください。
2. 一般メンバーが、閲覧できない会話の作成、更新、イベント、既読通知を受信しないことを確認してください。
3. リアルタイムイベントの受信後に受信トレイのデータを再取得し、未読数と会話一覧が一致していることを確認してください。
4. 権限変更後に再接続し、イベント範囲をもう一度検証してください。

{% hint style="info" %}
ロールと連絡先の権限の違いについては、[ロール（Role）と連絡先（Contact）の違い](/tech/ja/serve/contacts/role-vs-contact.md)を参照してください。
{% endhint %}


---

# 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/api-integration/endpoint-behaviors/conversation-visibility-events.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.
