{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/whatsapp/json-schema/whatsapp-message-history-response-schema.json",
  "title": "MessageHistoryResponse",
  "description": "Paginated response containing message history entries",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/whatsapp-message-history-api-openapi.yml#/components/schemas/MessageHistoryResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "description": "Array of message history entries",
      "items": {
        "$ref": "#/$defs/WhatsAppMessageHistory"
      }
    },
    "paging": {
      "$ref": "#/$defs/PaginationInfo"
    }
  },
  "$defs": {
    "MessageDeliveryStatusEvent": {
      "type": "object",
      "description": "Message delivery status event occurrence",
      "required": [
        "id",
        "delivery_status",
        "timestamp"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier for the delivery status event"
        },
        "delivery_status": {
          "$ref": "#/$defs/WhatsAppMessageDeliveryStatus"
        },
        "webhook_update_state": {
          "$ref": "#/$defs/WebhookUpdateState"
        },
        "timestamp": {
          "type": "integer",
          "format": "int64",
          "description": "Unix timestamp when the delivery status event occurred"
        },
        "application": {
          "type": "object",
          "description": "Application information for the event",
          "properties": {
            "id": {
              "type": "string",
              "description": "Application ID that processed the event"
            }
          }
        },
        "webhook_uri": {
          "type": "string",
          "format": "uri",
          "description": "Webhook URI where the event was delivered"
        },
        "error_description": {
          "type": "string",
          "description": "Error description if the delivery failed"
        }
      }
    },
    "PaginationInfo": {
      "type": "object",
      "description": "Pagination information for navigating through results",
      "properties": {
        "cursors": {
          "type": "object",
          "description": "Pagination cursors for navigation",
          "properties": {
            "before": {
              "type": "string",
              "description": "Cursor for the previous page of results"
            },
            "after": {
              "type": "string",
              "description": "Cursor for the next page of results"
            }
          }
        },
        "previous": {
          "type": "string",
          "format": "uri",
          "description": "URL for the previous page of results"
        },
        "next": {
          "type": "string",
          "format": "uri",
          "description": "URL for the next page of results"
        }
      }
    },
    "WebhookUpdateState": {
      "type": "string",
      "description": "State of webhook update delivery",
      "enum": [
        "PENDING",
        "DELIVERED",
        "FAILED",
        "RETRYING"
      ]
    },
    "WhatsAppMessageDeliveryStatus": {
      "type": "string",
      "description": "Message delivery status",
      "enum": [
        "SENT",
        "DELIVERED",
        "READ",
        "FAILED",
        "DELETED"
      ]
    },
    "WhatsAppMessageHistory": {
      "type": "object",
      "description": "WhatsApp message history entry with delivery status information",
      "required": [
        "id",
        "message_id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier for the message history entry"
        },
        "message_id": {
          "type": "string",
          "description": "WhatsApp message ID (WAMID) for the message"
        },
        "events": {
          "type": "object",
          "description": "Message delivery status events and occurrences",
          "properties": {
            "data": {
              "type": "array",
              "description": "Array of delivery status events",
              "items": {
                "$ref": "#/$defs/MessageDeliveryStatusEvent"
              }
            },
            "paging": {
              "$ref": "#/$defs/PaginationInfo"
            }
          }
        }
      }
    }
  }
}