Templates: The Foundation of Unified Messaging

Templates in Sent represent the architectural solution to one of the most complex challenges in modern messaging: creating content that works seamlessly across multiple communication channels while maintaining consistency, compliance, and optimal user experience.

Rather than forcing developers to manage channel-specific message formats, templates provide a unified abstraction that automatically adapts to the capabilities and requirements of each messaging platform.

The Template Abstraction

Before template systems, messaging applications faced significant architectural challenges. Developers had to manage the complexity of different messaging channels, each with their own formatting rules, character limits, and approval processes.

Templates abstract away the complexity of different messaging channels, providing a unified interface for content creation and management.

Channel-Agnostic Messaging

Templates introduce a channel-agnostic message definition layer that describes communication intent and structure without being bound to specific channel implementations:

  • Unified Definition Model: A single template definition automatically generates appropriate content for all supported channels, eliminating the need for channel-specific message creation.

  • Progressive Enhancement: Templates support rich content (media, interactive buttons, structured layouts) that gracefully degrades to simpler formats on channels with limited capabilities.

  • Regulatory Compliance: Templates manage complex approval workflows required by different channels, particularly WhatsApp's pre-approval process, without developer intervention.

Template Anatomy

Templates use a declarative content model with four primary components, each supporting dynamic content:

Body (Required)

The core message content that every channel must support, including text with embedded variables, links, and media references.

Header (Optional)

Attention-grabbing introduction that can include text or media, adapting to each channel's capabilities—becoming MMS attachments on SMS, rich media headers on WhatsApp.

Footer (Optional)

Additional context such as disclaimers or contact information, appended or integrated based on channel formatting capabilities.

Buttons (Optional)

Interactive elements including quick replies, URL buttons, and custom actions that channels implement according to their interaction models.

Dynamic Content

Templates implement a sophisticated entity system that handles dynamic content insertion with 2 primary types:

Dynamic Variables

  • Text variables: Dynamic placeholders with type information (text, number, date, etc.) and sample values for testing. The system ensures type safety and provides meaningful fallbacks when values are missing.
  • Media variables: Image and file references with automatic optimization, CDN delivery, and format adaptation that ensures rich content is delivered appropriately across channels.

Dynamic Links

  • URL references with built-in optimization including automatic shortening, click tracking, and channel-appropriate formatting that adapts to channel constraints.

Content Adaptation Mechanics

The template system processes content through sophisticated adaptation:

Structural Transformation: Templates define ideal message structure that automatically transforms to match each channel's capabilities—full structure for WhatsApp, collapsed text for SMS.

Variable Substitution: Type-aware rendering ensures variables display appropriately for each channel while maintaining business meaning and context.

Interactive Element Conversion: Buttons and quick replies become text alternatives with URL links for SMS while maintaining full interactivity on capable platforms.

Template Lifecycle

Templates implement a managed lifecycle that handles complexity and compliance automatically:

Draft State

New templates begin in draft state, allowing experimentation without impacting production messaging or triggering external approval processes.

Validation and Processing

When published, templates undergo automatic validation, entity processing, and format optimization before becoming available for message sending.

Approval Integration

For channels requiring pre-approval (particularly WhatsApp), the system automatically submits templates and tracks approval status, managing complex interaction with external platform APIs.

Templates for Developers

Applications should adopt a template-first approach by implementing Template-Driven messaging architectures. Your application should:

Treat templates as contracts

Templates define the interface between application logic and message delivery, creating a stable contract that isolates business logic from messaging platform complexity.

Provide dynamic variables

Applications provide data to templates rather than constructing messages directly, enabling consistent formatting and automated optimization.

Implement channel-agnostic operations

Messaging code references template IDs and provides variable data, while the platform handles channel selection, formatting, and delivery optimization. This allows you to send messages to WhatsApp, SMS, and other channels with the same codebase.

Success with templates requires adopting specific thinking patterns:

  • Think Intent, Not Channels: Focus on communication purpose rather than technical delivery methods.

  • Design for Progressive Enhancement: Create rich experiences knowing that automatic adaptation ensures broad compatibility.

  • Trust Template Intelligence: Allow the platform to handle compliance, optimization, and adaptation rather than implementing custom logic.