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

# 特定のチャットからメッセージを取得する

> フィルタリングオプションを使用した特定のチャット会話からメッセージを取得します



## OpenAPI

````yaml /ja/openapi.yml get /chat/{chat_jid}/messages
openapi: 3.0.0
info:
  title: WhatsApp API マルチデバイス
  version: 9.7.0
  description: |
    この API は API 経由で whatsapp を送信するために使用されます。

    Web ダッシュボードは別のプロジェクトです (gowa-ui); サーバーは
    最新のリリースアセットをダウンロードし、`/`で動作します（または、
    APP_UI_ENABLED=falseの場合はJSONバナーを返します）。

    デバイススコープ:
    - すべてのデバイススコープの REST コールで `X-Device-Id` を送信します。
    - WebSocket: `/wsに接続しますか？device_id=<id> ` 。
    - WebSocket 認証（Basic Auth が有効な場合）: ブラウザーは WebSocket 接続で
      Authorization ヘッダーを設定できないため、クエリ文字列にも
      `&authorization=<base64(user:pass)>` を渡してください。 認証情報が URL に表示されるため、本番環境では
      TLS を使用してください。
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: Whatsappサーバーへの初期接続
  - name: device
    description: マルチデバイスサポートのためのデバイス管理
  - name: user
    description: 情報の取得
  - name: send
    description: メッセージ (テキスト/イメージ/ファイル/ビデオ) を送信します。
  - name: message
    description: メッセージ操作 (revoke/react/update)
  - name: call
    description: 通話管理 (着信拒否)
  - name: chat
    description: チャットとメッセージ
  - name: group
    description: グループ設定
  - name: newsletter
    description: ニュースレターの設定
  - name: chatwoot
    description: カスタマーサポートのためのChatwoot統合
paths:
  /chat/{chat_jid}/messages:
    get:
      tags:
        - chat
      summary: 特定のチャットからメッセージを取得する
      description: フィルタリングオプションを使用した特定のチャット会話からメッセージを取得します
      operationId: getChatMessages
      parameters:
        - $ref: '#/components/parameters/DeviceIdHeader'
        - in: path
          name: chat_jid
          schema:
            type: string
          required: true
          description: >-
            JIDチャット(例えば、グループ用の個別またはgroupid@g.us用の電話@s.whatsapp.net)。
            Percent-encoded values (例 groupid%40g.us) は受け入れられます。
          example: 6289685028129@s.whatsapp.net
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            maximum: 100
          description: Maximum number of messages to return
        - name: offset
          in: query
          schema:
            type: integer
            default: 0
          description: スキップするメッセージの数（ページネーション用）
        - name: start_time
          in: query
          schema:
            type: string
            format: date-time
          description: このタイムスタンプからのメッセージをフィルタリングします（ISO 8601形式）
        - name: end_time
          in: query
          schema:
            type: string
            format: date-time
          description: このタイムスタンプまでメッセージをフィルタリングします (ISO 8601形式)
        - name: media_only
          in: query
          schema:
            type: boolean
            default: false
          description: メディアコンテンツのメッセージのみを返します
        - name: is_from_me
          in: query
          schema:
            type: boolean
          description: >-
            送信者でメッセージを絞り込みます（あなたが送信したメッセージには true 、受信したメッセージには false ）。
            media_only=trueとisFromMe=falseの両方が指定された場合、media_onlyは優先され、送信者に関係なくすべてのメディアメッセージを返します。
        - name: search
          in: query
          schema:
            type: string
          description: コンテンツテキストでメッセージを検索
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatMessagesResponse'
        '400':
          description: 不正なリクエスト
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '401':
          description: 権限がありません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorUnauthorized'
        '404':
          description: チャットが見つかりません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorNotFound'
        '500':
          description: 内部サーバーエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInternalServer'
components:
  parameters:
    DeviceIdHeader:
      name: X-Device-Id
      in: header
      required: false
      description: |
        マルチデバイスサポート用のデバイス識別子 複数のデバイスが登録されている場合に必要です。
        1つのデバイスのみ登録されている場合は、デフォルトとして使用されます。
        `device_id`クエリパラメータとして提供することもできます。
      schema:
        type: string
        example: my-device-id
  schemas:
    ChatMessagesResponse:
      type: object
      properties:
        code:
          type: string
          example: SUCCESS
        message:
          type: string
          example: Success get chat messages
        results:
          type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/ChatMessage'
            pagination:
              type: object
              properties:
                limit:
                  type: integer
                  example: 50
                offset:
                  type: integer
                  example: 0
                total:
                  type: integer
                  example: 1250
            chat_info:
              $ref: '#/components/schemas/Chat'
    ErrorBadRequest:
      type: object
      properties:
        code:
          type: string
          example: 400
          description: HTTP ステータスコードです
        message:
          type: string
          example: field cannot be blank
          description: 詳細エラーメッセージ
        results:
          type: object
          example: null
          description: 追加データ
    ErrorUnauthorized:
      type: object
      properties:
        code:
          type: string
          example: 401
          description: HTTP ステータスコードです
        message:
          type: string
          example: Unauthorized access
          description: 詳細エラーメッセージ
        results:
          type: object
          example: null
          description: 追加データ
    ErrorNotFound:
      type: object
      properties:
        code:
          type: string
          example: 404
          description: HTTP ステータスコードです
        message:
          type: string
          example: Chat not found
          description: 詳細エラーメッセージ
        results:
          type: object
          example: null
          description: 追加データ
    ErrorInternalServer:
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_SERVER_ERROR
          description: システムのコードにエラー
        message:
          type: string
          example: you are not loggin
          description: 詳細エラーメッセージ
        results:
          type: object
          example: null
          description: 追加データ
    ChatMessage:
      type: object
      properties:
        id:
          type: string
          example: 3EB0B430B6F8F1D0E053AC120E0A9E5C
          description: メッセージID
        chat_jid:
          type: string
          example: 6289685028129@s.whatsapp.net
          description: このメッセージが属するJIDチャット
        sender_jid:
          type: string
          example: 6289685028129@s.whatsapp.net
          description: Sender JID
        sender_display_name:
          type: string
          example: Saved Contact
          description: >-
            人が読める送信者ラベルは、この応答が生成されたときに動的に解決され、メッセージと一緒に保存されません。
            他の送信者の場合、保存された連絡先のフルネーム、保存された連絡先のプッシュ名、ビジネス名、JIDユーザーの一部、および生のJIDを好みます。
            アクティブなアカウントでは、デバイスの表示名(保存されているアカウントのプッシュ名に戻る)を好みます。
            アカウントJIDユーザーの一部、アカウントJID、送信者JIDユーザーの一部、および生の送信者JID。
            連絡先の名前を変更すると、履歴メッセージのラベルが変更されます。 `sender_jid` は安定した送信者識別子のままです。
        content:
          type: string
          example: Hello, how are you?
          description: メッセージテキストの内容
        timestamp:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: メッセージのタイムスタンプ
        is_from_me:
          type: boolean
          example: false
          description: このメッセージが現在のユーザーによって送信されたかどうか
        media_type:
          type: string
          example: image
          nullable: true
          description: メディアのタイプ (画像、ビデオ、オーディオ、ドキュメントなど)。 `call`は、格納された着信履歴を示します。
        reactions:
          type: array
          description: このメッセージに添付された絵文字の反応
          items:
            $ref: '#/components/schemas/ChatReaction'
        call_metadata:
          type: string
          example: '{"call_id":"ABC","auto_rejected":false}'
          description: >-
            media_type が `call` の場合のコール詳細付きの JSON 文字列です。 適用されない場合は省略されました（Go
            json omitemptyと一致します）。
        referral_metadata:
          type: string
          example: '{"ctwa_clid":"clid_123","source_app":"whatsapp"}'
          description: >-
            メッセージが「クリックからWhatsAppへ」広告から発信されたときに、メタ広告/アトリビューションの詳細が表示されるJSON文字列
            適用されない場合は省略されました（Go json omitemptyと一致します）。
        context_metadata:
          type: string
          example: '{"replied_to_id":"AC625C65EA7143E71D784176C4A90A93"}'
          description: >-
            返信コンテキストが既知の場合、返信メッセージIDを含むJSON文字列。 ライブ、送信、および履歴同期メッセージからキャプチャされます。
            返信コンテキストがない場合に省略されます。古い保存されている行がコンテキストで再入力されるまで含まれます。
        filename:
          type: string
          example: photo.jpg
          nullable: true
          description: メディアメッセージの元のファイル名
        url:
          type: string
          example: https://media.example.com/file.jpg
          nullable: true
          description: メディアファイルURL
        file_length:
          type: integer
          example: 1024768
          nullable: true
          description: メディア メッセージ用のバイト単位のファイル サイズ
        created_at:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: 作成タイムスタンプを記録
        updated_at:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: 最後の更新タイムスタンプを記録
    Chat:
      type: object
      properties:
        jid:
          type: string
          example: 6289685028129@s.whatsapp.net
          description: チャットJID識別子
        name:
          type: string
          example: John Doe
          description: チャットの表示名
        last_message_time:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: 最後のメッセージのタイムスタンプ
        ephemeral_expiration:
          type: integer
          example: 0
          description: Ephemeral message expiration time in seconds(0 = disabled)
        created_at:
          type: string
          format: date-time
          example: '2024-01-10T08:00:00Z'
          description: チャットの作成日時
        updated_at:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
          description: 最終更新日時
        archived:
          type: boolean
          example: false
          description: チャットをアーカイブしているかどうか
    ChatReaction:
      type: object
      properties:
        emoji:
          type: string
          example: 👍
          description: リアクション時に使用される絵文字
        sender_jid:
          type: string
          example: 628123456789@s.whatsapp.net
          description: リアクションしたユーザーのJID
        sender_display_name:
          type: string
          example: Saved Contact
          description: >-
            人が読める送信者のラベルは、この応答が生成されたときに動的に解決され、反応とともに保存されません。
            他の送信者の場合、保存された連絡先のフルネーム、保存された連絡先のプッシュ名、ビジネス名、JIDユーザーの一部、および生のJIDを好みます。
            アクティブなアカウントでは、デバイスの表示名(保存されているアカウントのプッシュ名に戻る)を好みます。
            アカウントJIDユーザーの一部、アカウントJID、送信者JIDユーザーの一部、および生の送信者JID。
            そのため、コンタクト名を変更することで、履歴反応に返されるラベルを変更できます。 `sender_jid`
            は安定した送信者識別子のままです。
        is_from_me:
          type: boolean
          example: false
          description: 現在のユーザーがリアクションを行ったかどうか
        timestamp:
          type: string
          format: date-time
          example: '2024-01-15T10:31:00Z'
          description: リアクションが受信された時
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

## Related topics

- [最新のニュースレター（チャンネル）メッセージを取得する](https://gowa-docs.mintlify.site/ja/api-reference/newsletter/最新のニュースレター（チャンネル）メッセージを取得する.md)
- [チャット一覧を取得する](https://gowa-docs.mintlify.site/ja/api-reference/chat/チャット一覧を取得する.md)
- [メッセージを取り消す](https://gowa-docs.mintlify.site/ja/api-reference/message/メッセージを取り消す.md)
- [メッセージの受信](https://gowa-docs.mintlify.site/ja/examples/receiving-messages.md)
- [携帯電話から古いチャット履歴をリクエストする](https://gowa-docs.mintlify.site/ja/api-reference/chat/携帯電話から古いチャット履歴をリクエストする.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.