Channel-Specific Formatting
What you'll learn: How to transform notification content and metadata to match each delivery channel's unique requirements and constraints.
Different notification channels speak different languages. An SMS message has a 160-character limit and no formatting. A push notification needs a title, body, and optional image. An email can include rich HTML, attachments, and extensive metadata. Even within push notifications, iOS and Android expect different payload structures.
The Core Challenge
When your notification system decides what to send, it must then adapt that message to how each channel expects to receive it. The same "Your order has shipped" notification becomes:
SMS: Plain text, 160 chars max, tracking link shortened Email: HTML template with logo, tracking map, order details table Push: Title + body + deep link + badge count In-app: Rich notification object with action buttons and images
Implementation Strategy
Your notification service needs channel-specific formatters that transform a canonical notification object into channel-ready payloads. Each formatter understands:
- Length constraints (SMS truncation, push title limits)
- Supported media types (plain text vs HTML vs rich media)
- Metadata requirements (email headers, push categories, deep link schemes)
- Provider-specific fields (FCM vs APNS token formats)
Think of formatters as translators at the UN—they all hear the same message but must convey it in their channel's "native language."
Best Practices
Store formatting templates per channel. Include fallback logic when rich features aren't available. Test that truncated messages remain meaningful. Validate provider-specific requirements before sending.
Key Takeaway: Channel-specific formatting transforms a single canonical notification into multiple channel-appropriate payloads, respecting each channel's constraints, capabilities, and provider requirements.