LESSON 03 · Policy and content

Resolve who should receive what

Read current contact, consent, and template data before fanout.

SYSTEM VIEW

The delivery path

Diagram view
Push tokens—
Attempts—
DB reads—

Watch one shipping update resolve to two push attempts and no email, then lose a dead tablet token.

  1. Shipping update evt-5120 reaches the Resolver, which looks up the recipient in Preferences: a token for the phone, one for an old tablet, a verified email and no verified phone number. Tokens are stored per device, since one user-level address can’t reach several devices.

    Push tokens
    phone, old tablet
    Email
    verified
    Phone number
    not verified

    What changed

    • Shipping update evt-5120
    • 2 push tokens, 1 verified email
  2. Before creating any attempt, the Resolver checks preferences: shipping emails are turned off, so no email, and no verified phone number means no SMS. That leaves push. Scheduled work rechecks consent close to send time, since a user can opt out after it is queued.

    Shipping email
    turned off
    SMS
    no verified number

    What changed

    • Email: shipping emails off
    • SMS: no verified number
    • Push only
  3. The Resolver renders Template v3 with validated data for push. Untrusted fields are escaped, and the text fits Apple’s 4 KB limit for a standard push payload, with no secrets on the lock screen. One GSM-encoded SMS segment holds 160 characters.

    Push payload
    4 KB max
    SMS segment
    160 characters

    What changed

    • Template v3
    • Push text, fields escaped
  4. The Resolver creates two push attempts, one per device token, and none for email or SMS; the Push worker holds both. Each attempt records the policy and template version used, so operators can later explain this delivery.

    Push attempts
    phone, tablet
    Recorded
    policy, Template v3

    What changed

    • Push worker
    • 2 push attempts
    • Policy and v3 recorded
  5. The Push worker sends both attempts to the Push service, which accepts the phone’s token and rejects the tablet’s as invalid. The worker removes the tablet token from Preferences. One token is left, so the next event creates one attempt.

    Phone token
    accepted
    Tablet token
    invalid, removed

    What changed

    • Push service
    • Tablet token
    • Next event: 1 attempt
  6. The same intent, evt-5120, arrives again. Its dedupe key, event ID plus recipient plus category, matches the first, so the Resolver creates no new attempt: still 2. The key must not be so broad that it merges two real events.

    Dedupe key
    event + recipient + category

    What changed

    • Same key: no new attempt
  7. A 5 million person campaign means 5 million preference lookups. With a 60-second Preference cache, cached lookups skip Preferences, but an opt-out can miss a send by up to a minute. With no cache, every lookup reads Preferences, and opt-outs apply at once.

    Campaign
    5 million lookups
    Cache copy
    up to 60 s old

    What changed

    • 5 million lookups per campaign
    • Cache: less load, later opt-outs
    Preference reads

Space plays · ← → step · Home resets

THE IDEA

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.

DECISION POINT

A user opts out of marketing email after a campaign was queued but before its scheduled send. What should happen?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Eligibility depends on current consent, verified destinations, and device state.
  • Version templates and define the exact scope of deduplication.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 3
RecallQUESTION 01

Why store push tokens per device?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 3 checkpoints answered correctly to complete this lesson.