{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/humanforai-dev/json-schema/humanforai-dev-message-thread-schema.json",
  "title": "MessageThread",
  "description": "A message thread as its owner sees it. status is 'received' until the operator replies, then 'answered'. An empty replies list means not yet — poll occasionally, not in a loop.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/humanforai-dev-api-openapi.json#/components/schemas/MessageThread",
  "type": "object",
  "properties": {
    "message_id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "received",
        "answered"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "from": {
      "type": "string"
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "message": {
      "type": "string",
      "description": "The original message text."
    },
    "replies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "author": {
            "type": "string",
            "enum": [
              "operator",
              "requester"
            ]
          },
          "message": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "reply_count": {
      "type": "integer"
    },
    "last_reply_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "reply_channel": {
      "type": "string",
      "enum": [
        "email",
        "webhook",
        "thread_only"
      ]
    },
    "webhook_last_delivery": {
      "type": "object",
      "description": "Present for webhook threads after the first push attempt: at, event, HTTP status, ok, and an error string on failure.",
      "additionalProperties": true
    },
    "note": {
      "type": "string"
    }
  }
}