{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asapp3/json-schema/asapp3-message-schema.json",
  "title": "Message",
  "description": "Represents a single message within a conversation.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asapp3-conversations-api-openapi.yml#/components/schemas/Message",
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "minLength": 1,
      "description": "The content of the message."
    },
    "sender": {
      "$ref": "#/$defs/Participant",
      "description": "Information about the participant who sent the message."
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "The time when the message was sent. Include the timezone, otherwise UTC will be assumed."
    }
  },
  "required": [
    "text",
    "sender",
    "timestamp"
  ],
  "$defs": {
    "Participant": {
      "description": "Represents a participant in the conversation.",
      "type": "object",
      "properties": {
        "role": {
          "$ref": "#/$defs/ParticipantRole",
          "description": "The role of the participant in the conversation."
        },
        "externalId": {
          "type": "string",
          "description": "The unique identifier for the participant in your external system. This should be consistent across all interactions for the same individual."
        }
      },
      "required": [
        "role",
        "externalId"
      ]
    },
    "ParticipantRole": {
      "description": "A participant role, usually the customer or an agent for human participants. System participant is also allowed but keep in mind\nthat this role won't be considered a participant in a conversation, just a message sender.\n",
      "type": "string",
      "enum": [
        "agent",
        "customer",
        "system"
      ]
    }
  }
}