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

# ダイレクトメッセージのルックアップ

> ダイレクトメッセージイベントおよび会話を取得します

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

Direct Messages のルックアップエンドポイントでは、認証済みユーザーの DM イベントを取得できます。これには、一対一およびグループの会話におけるメッセージが含まれます。

<div id="overview">
  ## 概要
</div>

<CardGroup cols={2}>
  <Card title="すべてのDMイベント" icon="messages">
    ユーザーのすべてのDMイベントを取得
  </Card>

  <Card title="1対1会話" icon="message">
    特定の会話からイベントを取得
  </Card>

  <Card title="会話ID別" icon="comments">
    会話IDでイベントを取得
  </Card>

  <Card title="イベントタイプ" icon="bell">
    メッセージ、参加、退出イベント
  </Card>
</CardGroup>

***

<div id="endpoints">
  ## エンドポイント
</div>

| Method | Endpoint                                                                                                               | Description           |
| :----- | :--------------------------------------------------------------------------------------------------------------------- | :-------------------- |
| GET    | [`/2/dm_events`](/ja/x-api/direct-messages/get-dm-events)                                                              | ユーザーのすべてのDMイベントを取得します |
| GET    | [`/2/dm_conversations/with/:participant_id/dm_events`](/ja/x-api/direct-messages/get-dm-events-for-a-dm-conversation)  | 1対1の会話のイベントを取得します     |
| GET    | [`/2/dm_conversations/:dm_conversation_id/dm_events`](/ja/x-api/direct-messages/get-dm-events-for-a-dm-conversation-1) | 会話IDを指定してイベントを取得します   |

***

<div id="event-types">
  ## イベントタイプ
</div>

| Event               | 説明                |
| :------------------ | :---------------- |
| `MessageCreate`     | 会話内でメッセージが送信されたとき |
| `ParticipantsJoin`  | ユーザーが会話に参加したとき    |
| `ParticipantsLeave` | ユーザーが会話から退出したとき   |

***

<div id="data-retention">
  ## データ保持
</div>

<Note>
  これらのエンドポイントからは、**過去30日分**のイベントを取得できます。
</Note>

***

<div id="getting-started">
  ## はじめに
</div>

<Note>
  **前提条件**

  * 承認済みの[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * 開発者コンソール内の[プロジェクトとApp](/ja/resources/fundamentals/developer-apps)
  * [3-legged OAuth](/ja/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow) を使用して取得したユーザーアクセストークン
</Note>

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="rocket" href="/ja/x-api/direct-messages/lookup/quickstart">
    最初のDMルックアップリクエストを実行しましょう
  </Card>

  <Card title="インテグレーションガイド" icon="book" href="/ja/x-api/direct-messages/lookup/integrate">
    主要な概念とベストプラクティス
  </Card>

  <Card title="APIリファレンス" icon="code" href="/ja/x-api/direct-messages/get-dm-events">
    エンドポイントの詳細ドキュメント
  </Card>

  <Card title="サンプルコード" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    実行可能なコード例
  </Card>
</CardGroup>
