How it works
A recipient may have two current push tokens, an email address, and no verified phone number. Store device tokens by device, remove tokens rejected as invalid, and verify email or phone ownership before using those channels. A user-level destination alone cannot describe multi-device push.
Evaluate notification category and channel preferences before creating delivery attempts. Promotional opt-out and quiet hours, the times a user has asked not to be disturbed, should be explicit; legal or essential transactional exceptions require a product policy, not an accidental bypass. Recheck mutable consent close to send time, especially for scheduled work. Record the policy and template version used so operators can explain a historical delivery.
For example, take a shipping update for someone with a phone token, an old tablet token, a verified email, and shipping emails turned off. The resolver creates two push attempts and no email or SMS. The push service rejects the tablet token, so it is removed and the next event creates one attempt. These reads add up: a 5 million person campaign means 5 million preference lookups. A 60-second cache saves load, but an opt-out can then miss a send by up to a minute.
Render a versioned template with validated data and channel-specific limits: one GSM-encoded SMS segment holds 160 characters, and Apple’s push service limits a standard payload to 4 KB. Escape untrusted fields and avoid putting secrets in lock-screen push payloads. A deduplication key such as event ID plus recipient plus category prevents repeat intents from generating another message; it should not collapse distinct legitimate events.
A user opts out of marketing email after a campaign was queued but before its scheduled send. What should happen?
The send worker rechecks current marketing-email consent and suppresses the attempt. Record the suppression reason for support and analytics; an earlier eligibility check does not override a later opt-out.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Eligibility depends on current consent, verified destinations, and device state.
- Version templates and define the exact scope of deduplication.