{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/politicalcomms-com/json-schema/politicalcomms-com-conversation-message-schema.json",
  "title": "ConversationMessage",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/politicalcomms-com-openapi.json#/components/schemas/ConversationMessage",
  "type": "object",
  "properties": {
    "message_id": {
      "type": "string",
      "format": "uuid"
    },
    "direction": {
      "type": "string",
      "enum": [
        "inbound",
        "outbound"
      ]
    },
    "text": {
      "type": "string"
    },
    "media_urls": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "unsent",
        "queued",
        "sending",
        "sent",
        "delivered",
        "failed",
        "received",
        "on_hold"
      ]
    },
    "sent_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "delivered_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "received_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Arrival time of an inbound message; always null on outbound rows."
    },
    "error_code": {
      "type": [
        "string",
        "null"
      ],
      "description": "Delivery error code for a failed outbound message, in the same display form as the message.failed webhook and CSV exports (e.g. \"300\" opted-out, \"012\" invalid destination; see Delivery error codes). Treat it as an opaque string. null when the message did not fail, or when the failure was a platform-side outcome rather than a delivery result."
    },
    "carrier": {
      "type": [
        "string",
        "null"
      ],
      "description": "The contact's mobile carrier: the recipient's on an outbound message, the sender's on an inbound one. The three national networks are exactly `AT&T`, `Verizon`, or `T-Mobile` (brands and subsidiaries are reported under the network they run on, e.g. Cricket under `AT&T`, Straight Talk under `Verizon`, Mint Mobile under `T-Mobile`). Any other carrier is reported under its own registered name (e.g. `CELLULAR SOUTH, INC.`); treat it as an opaque string. null when the carrier is not known, and on inbound messages received before this field was introduced."
    }
  },
  "required": [
    "message_id",
    "direction",
    "text",
    "media_urls",
    "status"
  ],
  "additionalProperties": true
}