{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rubiconnect/json-schema/rubiconnect-message-received-event-schema.json",
  "title": "MessageReceivedEvent",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rubiconnect-webhooks-api-openapi.yml#/components/schemas/MessageReceivedEvent",
  "type": "object",
  "required": [
    "eventId",
    "event",
    "timestamp",
    "data"
  ],
  "properties": {
    "eventId": {
      "type": "string",
      "description": "Unique event identifier."
    },
    "event": {
      "type": "string",
      "enum": [
        "message.received"
      ]
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "The ISO 8601 timestamp when the event was generated."
    },
    "data": {
      "type": "object",
      "required": [
        "messageId",
        "sender",
        "content",
        "timestamp"
      ],
      "properties": {
        "messageId": {
          "type": "string",
          "description": "Unique received message identifier."
        },
        "sender": {
          "type": "string",
          "description": "Sender handset phone number in E.164 format."
        },
        "content": {
          "type": [
            "string",
            "null"
          ],
          "description": "Text content of the message."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "The ISO 8601 timestamp when the message was received by the system."
        },
        "suggestionResponse": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "text": {
              "type": "string",
              "description": "Button label text."
            },
            "postbackData": {
              "type": "string",
              "description": "Postback data payload associated with the button action."
            }
          }
        },
        "mediaUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL of the media attachment shared by the contact."
        },
        "location": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "latitude": {
              "type": "number"
            },
            "longitude": {
              "type": "number"
            },
            "label": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    }
  }
}