Message Expiration
Message Expiration Mechanics
Emess dynamically assigns Time-To-Live (TTL) values to all incoming SMS messages based on their urgency tier. This guarantees that time-sensitive codes (e.g. OTPs) do not arrive hours later if there is a temporary network disruption.
TTL Duration by Priority Tier
When Emess receives a message request, an absolute UTC timestamp (sendBefore) is automatically calculated from the resolved template's priority tier:
| Template Priority Tier | Resolved Type | Use cases | Default TTL |
|---|---|---|---|
| CRITICAL | critical | OTPs, security alerts | 2 Minutes |
| STANDARD | standard | Transactional notifications | 1 Hour |
| BULK | bulk | Marketing, broadcasts | 24 Hours |
*Note: You can override these defaults by explicitly passing a sendBefore ISO 8601 string in your request payload (must not be earlier than the default minimum for the template's tier).*
How Priority is Determined in v1 vs v0
In API v0: The caller manually passed type: "critical" | "standard" | "bulk" in every /sms/send payload.
In API v1: Priority is bound to the approved SMS Template (priorityTier). You no longer pass type when sending a message — Emess automatically routes and computes TTL from the matched template.
Delivery Workflow
Emess utilizes a deterministic execution pipeline to ensure your messages are processed correctly:
- Template Resolution & Ingestion: Emess validates your template parameters (or matches your raw message against approved templates) and queues the message for delivery.
- Expiration Guard: Right before delivery, Emess checks if the current time has surpassed the message's
sendBeforelimit. If it has, the delivery is aborted and the message is marked asEXPIRED. A refund is automatically credited back to your balance. - Execution: If valid, the message is dispatched. To prevent duplicated deliveries or unexpected behaviors, Emess performs no automatic retries on failed dispatches. Failed messages will simply be marked as such in your dashboard and via
GET /api/v1/sms/:id.