MessageTemplate
Represents a reusable template for generating messages across channels (email, SMS, push, WhatsApp). Supports variable substitution with {{placeholder}} syntax, multi-language content, versioning, and status lifecycle management. Enables consistent messaging with dynamic personalization for transactional, marketing, and notification use cases.
Properties
| Property | Type | Mode | Description | Required |
|---|---|---|---|---|
| name | string | stored | Unique machine-readable identifier for the template used in code and API references, following kebab-case naming convention such as welcome-email, password-reset-sms, or order-confirmation-push Example: | Required |
| displayName | string | stored | Human-readable name displayed in user interfaces, administrative panels, and template selection screens to help users identify the template purpose Example: | Required |
| description | text | stored | Comprehensive explanation of the template purpose, intended use cases, appropriate contexts for deployment, and any special considerations for usage or customization Example: | Optional |
| type | string | stored | Communication channel type that defines the delivery mechanism and format constraints for the template content Values: Example: | Required |
| subject | string | stored | Message subject line or title supporting variable substitution through placeholder syntax like {{variableName}}, primarily used for email and letter types where subject metadata is displayed Example: | Optional |
| content | text | stored | Primary message body containing the template content with variable placeholders using {{variableName}} syntax for dynamic substitution, formatted according to the contentType specification Example: | Required |
| contentType | string | stored | Format specification for the content field defining how the template should be parsed, rendered, and displayed across different presentation contexts Values: Example: | Required |
| variables | json | stored | Structured definition of all available variables for substitution, each specifying name, data type, required flag, default value, validation rules, and usage description to guide template implementers Example: | Optional |
| language | Language | stored | Reference to the language entity for the template content, enabling multi-language support and localization | Optional |
| timezone | Timezone | stored | Default timezone for rendering time-based content in this template, such as appointment times or scheduled events | Optional |
| category | string | stored | Classification of the template purpose and usage context to organize templates by business function and facilitate template discovery and governance Values: Example: | Required |
| status | string | stored | Current lifecycle state of the template indicating availability for use, enabling workflow management, approval processes, and version control Values: Example: | Required |
| version | number | stored | Numeric version identifier tracking template revisions and enabling rollback capabilities, A/B testing, and change management processes Example: | Required |
| isDefault | boolean | stored | Flag indicating whether this template should be automatically selected as the default option for its type and category combination when no specific template is specified Example: | Optional |
| metadata | json | stored | Extensible container for additional template configuration including sender information, styling preferences, tracking parameters, compliance flags, and integration-specific settings Example: | Optional |
| messagesUsingCount | number | calculated | Calculated total count of messages that have been generated using this template, providing usage analytics and helping identify popular or underutilized templates Example: | Optional |
| lastUsedAt | datetime | calculated | Calculated timestamp of the most recent message generation using this template, helping identify stale templates and supporting template lifecycle management Example: | Optional |
Examples
Example 1
{
"@type": "MessageTemplate",
"name": "welcome-email",
"displayName": "Welcome Email Template",
"description": "Automated welcome email sent to new users upon successful account registration, introducing platform features and providing initial guidance",
"type": "email",
"subject": "Welcome to {{platformName}}, {{userName}}!",
"content": "<html><head><style>body{font-family:Arial,sans-serif;line-height:1.6;color:#333;}</style></head><body><div style=\"max-width:600px;margin:0 auto;padding:20px;\"><h1 style=\"color:#4CAF50;\">Hello {{userName}},</h1><p>Welcome to {{platformName}}! We're excited to have you on board.</p><p>Your account has been created successfully. Here's what you can do next:</p><ul><li>Complete your profile</li><li>Explore our features</li><li>Connect with other users</li></ul><p>If you have any questions, feel free to reach out to our support team.</p><p style=\"margin-top:30px;\">Best regards,<br>The {{platformName}} Team</p></div></body></html>",
"contentType": "html",
"variables": [
{
"name": "userName",
"type": "string",
"required": true,
"description": "Full name of the newly registered user"
},
{
"name": "platformName",
"type": "string",
"required": true,
"defaultValue": "Our Platform",
"description": "Name of the platform or application"
}
],
"language": {
"@type": "Language",
"code": "en"
},
"category": "transactional",
"status": "active",
"version": 2,
"isDefault": true,
"metadata": {
"senderEmail": "welcome@platform.com",
"senderName": "Platform Welcome Team",
"replyTo": "support@platform.com",
"trackOpens": true,
"trackClicks": true,
"tags": [
"onboarding",
"registration"
]
},
"messagesUsingCount": 15847,
"lastUsedAt": "2025-11-27T10:30:00Z"
}Example 2
{
"@type": "MessageTemplate",
"name": "password-reset-sms",
"displayName": "Password Reset SMS",
"description": "Security SMS template for delivering password reset verification codes with time-limited validity",
"type": "sms",
"subject": null,
"content": "{{platformName}}: Your password reset code is {{resetCode}}. This code expires in {{expiryMinutes}} minutes. Do not share this code with anyone.",
"contentType": "text",
"variables": [
{
"name": "platformName",
"type": "string",
"required": true,
"defaultValue": "Platform",
"description": "Name of the platform for brand identification"
},
{
"name": "resetCode",
"type": "string",
"required": true,
"description": "Six-digit verification code for password reset"
},
{
"name": "expiryMinutes",
"type": "number",
"required": true,
"defaultValue": 15,
"description": "Number of minutes until code expiration"
}
],
"language": {
"@type": "Language",
"code": "en"
},
"category": "transactional",
"status": "active",
"version": 1,
"isDefault": true,
"metadata": {
"senderID": "PLATFORM",
"priority": "high",
"maxLength": 160,
"allowUnicode": false
},
"messagesUsingCount": 3421,
"lastUsedAt": "2025-11-27T11:15:00Z"
}Example 3
{
"@type": "MessageTemplate",
"name": "order-confirmation-email",
"displayName": "Order Confirmation Email",
"description": "Transactional email confirming successful order placement with detailed order summary and tracking information",
"type": "email",
"subject": "Order Confirmation - #{{orderNumber}}",
"content": "<html><body><h1>Thank you for your order, {{customerName}}!</h1><p>Your order <strong>#{{orderNumber}}</strong> has been confirmed and is being processed.</p><h2>Order Details:</h2><p>Total Amount: {{totalAmount}} {{currency}}</p><p>Estimated Delivery: {{deliveryDate}}</p><p>You can track your order status at: <a href=\"{{trackingUrl}}\">Track Order</a></p><p>If you have any questions, contact us at {{supportEmail}}</p></body></html>",
"contentType": "html",
"variables": [
{
"name": "customerName",
"type": "string",
"required": true,
"description": "Name of the customer who placed the order"
},
{
"name": "orderNumber",
"type": "string",
"required": true,
"description": "Unique order reference number"
},
{
"name": "totalAmount",
"type": "number",
"required": true,
"description": "Total order amount"
},
{
"name": "currency",
"type": "string",
"required": true,
"defaultValue": "USD",
"description": "Currency code"
},
{
"name": "deliveryDate",
"type": "string",
"required": true,
"description": "Estimated delivery date"
},
{
"name": "trackingUrl",
"type": "string",
"required": true,
"description": "URL for order tracking"
},
{
"name": "supportEmail",
"type": "string",
"required": true,
"defaultValue": "support@platform.com",
"description": "Customer support email address"
}
],
"language": {
"@type": "Language",
"code": "en"
},
"category": "transactional",
"status": "active",
"version": 3,
"isDefault": true,
"metadata": {
"senderEmail": "orders@platform.com",
"senderName": "Platform Orders",
"replyTo": "support@platform.com",
"includeInvoice": true,
"trackOpens": true
},
"messagesUsingCount": 8932,
"lastUsedAt": "2025-11-27T11:45:00Z"
}Example 4
{
"@type": "MessageTemplate",
"name": "appointment-reminder-multi",
"displayName": "Appointment Reminder (Multi-Channel)",
"description": "Multi-channel reminder template for upcoming appointments, suitable for both email and SMS delivery with automatic formatting",
"type": "email",
"subject": "Reminder: Your appointment on {{appointmentDate}}",
"content": "Hi {{clientName}},\n\nThis is a reminder about your upcoming appointment:\n\nDate: {{appointmentDate}}\nTime: {{appointmentTime}}\nLocation: {{locationName}}\n\nProvider: {{providerName}}\nService: {{serviceName}}\n\nTo reschedule or cancel, please contact us at {{contactPhone}} or visit {{rescheduleUrl}}\n\nSee you soon!",
"contentType": "text",
"variables": [
{
"name": "clientName",
"type": "string",
"required": true,
"description": "Name of the person with the appointment"
},
{
"name": "appointmentDate",
"type": "string",
"required": true,
"description": "Date of the appointment"
},
{
"name": "appointmentTime",
"type": "string",
"required": true,
"description": "Time of the appointment"
},
{
"name": "locationName",
"type": "string",
"required": true,
"description": "Name or address of appointment location"
},
{
"name": "providerName",
"type": "string",
"required": false,
"description": "Name of service provider or practitioner"
},
{
"name": "serviceName",
"type": "string",
"required": false,
"description": "Type of service or appointment reason"
},
{
"name": "contactPhone",
"type": "string",
"required": true,
"description": "Phone number for rescheduling"
},
{
"name": "rescheduleUrl",
"type": "string",
"required": false,
"description": "URL for online rescheduling"
}
],
"language": {
"@type": "Language",
"code": "en"
},
"category": "reminder",
"status": "active",
"version": 1,
"isDefault": false,
"metadata": {
"senderEmail": "appointments@platform.com",
"senderName": "Appointment Reminders",
"reminderHours": 24,
"allowSMSFallback": true,
"smsTemplate": "appointment-reminder-sms"
},
"messagesUsingCount": 5621,
"lastUsedAt": "2025-11-27T09:00:00Z"
}Example 5
{
"@type": "MessageTemplate",
"name": "marketing-newsletter-monthly",
"displayName": "Monthly Marketing Newsletter",
"description": "Comprehensive monthly newsletter template for marketing campaigns featuring product updates, blog highlights, and promotional content with rich HTML formatting",
"type": "email",
"subject": "{{monthName}} Newsletter - {{companyName}}",
"content": "<html><head><style>body{font-family:'Helvetica Neue',Arial,sans-serif;margin:0;padding:0;background:#f4f4f4;}.container{max-width:600px;margin:20px auto;background:#fff;}.header{background:#2c3e50;color:#fff;padding:30px;text-align:center;}.content{padding:30px;}.footer{background:#34495e;color:#fff;padding:20px;text-align:center;font-size:12px;}</style></head><body><div class=\"container\"><div class=\"header\"><h1>{{companyName}} Newsletter</h1><p>{{monthName}} {{year}}</p></div><div class=\"content\"><h2>{{headlineTitle}}</h2><p>{{headlineContent}}</p><hr><h3>Featured Articles</h3>{{articlesHtml}}<hr><h3>Special Offer</h3><p>{{offerContent}}</p><a href=\"{{offerUrl}}\" style=\"display:inline-block;padding:10px 20px;background:#3498db;color:#fff;text-decoration:none;border-radius:5px;\">Learn More</a></div><div class=\"footer\"><p>{{companyName}} | {{companyAddress}}</p><p><a href=\"{{unsubscribeUrl}}\" style=\"color:#bdc3c7;\">Unsubscribe</a></p></div></div></body></html>",
"contentType": "html",
"variables": [
{
"name": "companyName",
"type": "string",
"required": true,
"description": "Company or brand name"
},
{
"name": "monthName",
"type": "string",
"required": true,
"description": "Name of the month"
},
{
"name": "year",
"type": "string",
"required": true,
"description": "Current year"
},
{
"name": "headlineTitle",
"type": "string",
"required": true,
"description": "Main headline title"
},
{
"name": "headlineContent",
"type": "string",
"required": true,
"description": "Main headline content or description"
},
{
"name": "articlesHtml",
"type": "string",
"required": true,
"description": "HTML content for featured articles section"
},
{
"name": "offerContent",
"type": "string",
"required": true,
"description": "Special offer description"
},
{
"name": "offerUrl",
"type": "string",
"required": true,
"description": "URL for special offer landing page"
},
{
"name": "companyAddress",
"type": "string",
"required": true,
"description": "Company physical address"
},
{
"name": "unsubscribeUrl",
"type": "string",
"required": true,
"description": "URL for newsletter unsubscribe"
}
],
"language": {
"@type": "Language",
"code": "en"
},
"category": "marketing",
"status": "inactive",
"version": 4,
"isDefault": false,
"metadata": {
"senderEmail": "newsletter@platform.com",
"senderName": "Platform Marketing",
"replyTo": "marketing@platform.com",
"listSegment": "subscribers-monthly",
"trackOpens": true,
"trackClicks": true,
"a_b_test_enabled": true,
"complianceFlags": [
"CAN-SPAM",
"GDPR"
]
},
"messagesUsingCount": 12456,
"lastUsedAt": "2025-10-31T08:00:00Z"
}