Message

Represents a single communication sent through any channel (email, SMS, WhatsApp, push, letter). Tracks the complete message lifecycle from draft to delivery with status transitions, scheduling, and provider integration. Supports templates, attachments, and detailed delivery metrics.

26 properties
Schema

Properties

PropertyTypeModeDescriptionRequired
channelCommunicationChannel
stored

Reference to the communication channel used to send this message, defining the medium and provider configuration

Example: "channel-uuid-here"

Required
typestring
stored

The type of message based on delivery medium

Values: email, sms, letter, whatsapp, push, in-app, voice

Example: "email"

Required
statusstring
stored

Current delivery status of the message in its lifecycle

Values: draft, queued, sending, sent, delivered, read, failed, bounced, cancelled

Example: "delivered"

Required
senderjson
stored

Information about the message sender, including name, address or phone number, and optional reply-to address

Example: {"name":"Acme Corp Support","address":"support@acme.com","replyTo":"noreply@acme.com"}

Required
senderPersonPerson
stored

Reference to the person entity when the sender is a known person in the system

Optional
senderOrganizationOrganization
stored

Reference to the organization entity when the sender is a known organization in the system

Optional
recipientPerson
stored

Reference to the person entity receiving this message, when the recipient is a known entity in the system

Example: "person-uuid-here"

Optional
recipientAddressstring
stored

Direct contact address for the recipient such as email address, phone number, or postal address when recipient entity is not available

Example: "john.doe@example.com"

Optional
subjectstring
stored

Subject line or title of the message, primarily used for email and letter formats

Example: "Your order has been shipped"

Optional
contenttext
stored

The main body content of the message in plain text, HTML, or markdown format

Example: "Dear customer, your order #12345 has been shipped and will arrive within 3-5 business days."

Required
contentTypestring
stored

Format specification for the message content

Values: text, html, markdown

Example: "text"

Required
templateMessageTemplate
stored

Reference to the message template used to generate this message content

Example: "template-uuid-here"

Optional
templateVariablesjson
stored

Key-value pairs of variables substituted into the template to generate the final message content

Example: {"customerName":"John Doe","orderNumber":"12345","deliveryDate":"2025-12-01"}

Optional
attachmentsjson
stored

Array of file attachments included with the message, containing filename, content type, size, and storage reference

Example: [{"filename":"invoice.pdf","contentType":"application/pdf","size":45632,"url":"https://storage.example.com/attachments/invoice-123.pdf"}]

Optional
prioritystring
stored

Delivery priority level affecting queue processing order and delivery urgency

Values: low, normal, high, urgent

Example: "normal"

Required
scheduledAtdatetime
stored

Scheduled date and time for sending the message, allowing deferred delivery

Example: "2025-12-01T09:00:00Z"

Optional
sentAtdatetime
stored

Timestamp when the message was successfully sent to the delivery provider or channel

Example: "2025-11-27T14:30:00Z"

Optional
deliveredAtdatetime
stored

Timestamp when the message was confirmed as delivered to the recipient's device or mailbox

Example: "2025-11-27T14:31:15Z"

Optional
readAtdatetime
stored

Timestamp when the recipient opened or read the message, if tracking is enabled and supported

Example: "2025-11-27T15:45:30Z"

Optional
failedAtdatetime
stored

Timestamp when the message delivery failed or bounced

Optional
failureReasonstring
stored

Detailed explanation of why the message delivery failed, including error codes or provider responses

Optional
externalReferenceExternalReference
stored

Reference to the message record in the external communication provider system for tracking and webhook correlation

Optional
metadatajson
stored

Additional custom data associated with this message for integration, analytics, or business-specific tracking purposes

Example: {"campaignId":"summer-sale-2025","userId":"user-123","tags":["transactional","order-confirmation"]}

Optional
isDeliveredboolean
calculated

Indicates whether the message has been successfully delivered to the recipient

Example: true

Required
isFailedboolean
calculated

Indicates whether the message delivery has permanently failed or bounced

Required
deliveryDurationSecondsinteger
calculated

Time elapsed in seconds between sending and delivery confirmation

Example: 75

Optional

Examples

Example 1

{
  "@type": "Message",
  "channel": "channel-email-001",
  "type": "email",
  "status": "delivered",
  "sender": {
    "name": "Acme Corp",
    "address": "orders@acme.com",
    "replyTo": "support@acme.com"
  },
  "recipient": "person-123",
  "recipientAddress": "john.doe@example.com",
  "subject": "Your order #12345 has shipped",
  "content": "<html><body><h1>Order Shipped</h1><p>Dear John, your order has been shipped and will arrive within 3-5 business days.</p></body></html>",
  "contentType": "html",
  "template": "template-order-shipped",
  "templateVariables": {
    "customerName": "John",
    "orderNumber": "12345",
    "estimatedDelivery": "3-5 business days"
  },
  "attachments": [
    {
      "filename": "invoice-12345.pdf",
      "contentType": "application/pdf",
      "size": 52480,
      "url": "https://storage.acme.com/invoices/12345.pdf"
    }
  ],
  "priority": "normal",
  "scheduledAt": null,
  "sentAt": "2025-11-27T14:30:00Z",
  "deliveredAt": "2025-11-27T14:31:15Z",
  "readAt": "2025-11-27T15:45:30Z",
  "failedAt": null,
  "failureReason": null,
  "externalReference": {
    "@type": "ExternalReference",
    "systemName": "SendGrid",
    "externalId": "msg_abc123def456"
  },
  "metadata": {
    "campaignId": "order-notifications",
    "orderId": "12345",
    "customerSegment": "premium"
  },
  "isDelivered": true,
  "isFailed": false,
  "deliveryDurationSeconds": 75
}

Example 2

{
  "@type": "Message",
  "channel": "channel-sms-001",
  "type": "sms",
  "status": "queued",
  "sender": {
    "name": "AlertService",
    "address": "+15551234567"
  },
  "recipient": "person-456",
  "recipientAddress": "+15559876543",
  "subject": null,
  "content": "Your verification code is 837492. It will expire in 10 minutes.",
  "contentType": "text",
  "template": "template-verification-code",
  "templateVariables": {
    "code": "837492",
    "expiryMinutes": "10"
  },
  "attachments": null,
  "priority": "urgent",
  "scheduledAt": null,
  "sentAt": null,
  "deliveredAt": null,
  "readAt": null,
  "failedAt": null,
  "failureReason": null,
  "externalReference": {
    "@type": "ExternalReference",
    "systemName": "Twilio",
    "externalId": "sm_xyz789abc"
  },
  "metadata": {
    "purpose": "authentication",
    "attemptNumber": 1
  },
  "isDelivered": false,
  "isFailed": false,
  "deliveryDurationSeconds": null
}

Example 3

{
  "@type": "Message",
  "channel": "channel-whatsapp-001",
  "type": "whatsapp",
  "status": "failed",
  "sender": {
    "name": "Customer Support",
    "address": "+15551112222"
  },
  "recipient": null,
  "recipientAddress": "+44123456789",
  "subject": null,
  "content": "Thank you for contacting us. Your support ticket #8899 has been created and our team will respond within 24 hours.",
  "contentType": "text",
  "template": "template-support-ticket-created",
  "templateVariables": {
    "ticketNumber": "8899",
    "responseTime": "24 hours"
  },
  "attachments": null,
  "priority": "high",
  "scheduledAt": null,
  "sentAt": "2025-11-27T12:15:00Z",
  "deliveredAt": null,
  "readAt": null,
  "failedAt": "2025-11-27T12:15:45Z",
  "failureReason": "Recipient phone number not registered on WhatsApp",
  "externalReference": {
    "@type": "ExternalReference",
    "systemName": "WhatsApp",
    "externalId": "msg_fail_001"
  },
  "metadata": {
    "ticketId": "8899",
    "department": "technical-support",
    "retryAttempts": 3
  },
  "isDelivered": false,
  "isFailed": true,
  "deliveryDurationSeconds": null
}

Example 4

{
  "@type": "Message",
  "channel": "channel-postal-001",
  "type": "letter",
  "status": "draft",
  "sender": {
    "name": "Legal Department",
    "address": "123 Corporate Blvd, Suite 500, New York, NY 10001"
  },
  "recipient": "person-789",
  "recipientAddress": "456 Customer Lane, Apt 3B, Los Angeles, CA 90001",
  "subject": "Important Contract Amendment Notice",
  "content": "Dear Valued Customer,\n\nThis letter serves as formal notification of amendments to your service agreement. Please review the enclosed documentation carefully.\n\nSincerely,\nLegal Department",
  "contentType": "text",
  "template": null,
  "templateVariables": null,
  "attachments": [
    {
      "filename": "amended-contract.pdf",
      "contentType": "application/pdf",
      "size": 128000,
      "url": "https://storage.acme.com/legal/contracts/amendment-789.pdf"
    }
  ],
  "priority": "high",
  "scheduledAt": "2025-12-05T08:00:00Z",
  "sentAt": null,
  "deliveredAt": null,
  "readAt": null,
  "failedAt": null,
  "failureReason": null,
  "externalReference": null,
  "metadata": {
    "documentType": "legal-notice",
    "requiresSignature": true,
    "contractId": "contract-789"
  },
  "isDelivered": false,
  "isFailed": false,
  "deliveryDurationSeconds": null
}

Example 5

{
  "@type": "Message",
  "channel": "channel-push-001",
  "type": "push",
  "status": "read",
  "sender": {
    "name": "App Notifications",
    "address": "app://notifications"
  },
  "recipient": "person-321",
  "recipientAddress": null,
  "subject": "New comment on your post",
  "content": "Sarah Johnson commented: 'Great article! Very insightful analysis.'",
  "contentType": "text",
  "template": "template-comment-notification",
  "templateVariables": {
    "commenterName": "Sarah Johnson",
    "commentText": "Great article! Very insightful analysis.",
    "postTitle": "Understanding Distributed Systems"
  },
  "attachments": null,
  "priority": "normal",
  "scheduledAt": null,
  "sentAt": "2025-11-27T11:00:00Z",
  "deliveredAt": "2025-11-27T11:00:02Z",
  "readAt": "2025-11-27T11:05:30Z",
  "failedAt": null,
  "failureReason": null,
  "externalReference": {
    "@type": "ExternalReference",
    "systemName": "Firebase",
    "externalId": "notification_xyz123"
  },
  "metadata": {
    "postId": "post-567",
    "commentId": "comment-890",
    "deepLink": "app://posts/567/comments/890"
  },
  "isDelivered": true,
  "isFailed": false,
  "deliveryDurationSeconds": 2
}