Sending push notifications at scale

Backends for mobile apps Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Order the steps

Order sending a campaign push.

  • Campaign request is queued
  • Workers expand users to device tokens, applying preferences
  • Opened apps fetch fresh data from the API
  • Workers send batches to APNs or FCM over HTTP/2
  • Temporary errors retry with backoff; invalid tokens are removed

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A B D E C

  1. Campaign request is queued The API returns immediately.
  2. Workers expand users to device tokens, applying preferences Quiet hours, opt-outs.
  3. Workers send batches to APNs or FCM over HTTP/2 With rate limits.
  4. Temporary errors retry with backoff; invalid tokens are removed Keeps the token table clean.
  5. Opened apps fetch fresh data from the API Push was only the nudge.

30-second answer

Store device tokens per user and platform, refreshed whenever the app reports a new one. A notification request goes onto a queue; workers expand it to devices, respect each user's preferences and quiet hours, and call APNs and FCM over persistent HTTP/2 connections in batches, with rate limits and retries with backoff for temporary errors. Remove tokens the provider reports as invalid. Push is best-effort, so the app must fetch the real state when opened.

Practise saying it · 35 s. No recording, just a timer

Push at scale.

Say your answer out loud, then check which of these points you covered:

  • Token store
  • Queue + workers
  • APNs/FCM HTTP/2 batches
  • Retry, prune tokens
  • Push is a hint

Deep dive

APNs and FCM may coalesce or drop messages; never put the only copy of data in a push.

Use collapse keys so a device shows only the latest of a series.

Big broadcasts: spread them over minutes to avoid a thundering herd back to your API.

Track sent, delivered (where reported) and opened per campaign.

Common mistakes

  • Treating push as guaranteed delivery.
  • Keeping dead tokens forever.
  • Sending a broadcast to everyone at once so all apps hit the API together.

Senior take & follow-ups

Tokens, queue and workers, provider connections, preferences, cleanup, and push as a hint.

Follow-up questions

Think of your answer first, then open the hint.

  1. What do you do with an invalid-token response?

    Show hint

    Delete or mark that token.

  2. Why spread broadcasts?

    Show hint

    Every opened app calls your API; a herd can overload it.

Suggest a fix if something here is wrong or out of date.