Prompt

How do I retry failed push notifications reliably?

Technology / API Platforms1 observationLast seen Oct 14, 2026

Latest observation

Oct 14, 2026OpenAI APIWeb search: off

To retry failed push notifications reliably, you want a durable, idempotent delivery pipeline rather than “send and hope.” The key is to separate:

  1. creating the notification
  2. attempting delivery
  3. retrying failures
  4. tracking final outcome

A reliable pattern

1) Persist every notification before sending

Store each notification in a database with a status like:

  • pending
  • sending
  • sent
  • failed_retryable
  • failed_permanent

Include:

  • notification ID
  • recipient/device token
  • payload
  • attempt count
  • next retry time
  • last error
  • provider message ID if available

This ensures you don’t lose notifications if your app crashes.


2) Use a queue + worker

Put send jobs onto a durable queue (e.g. SQS, RabbitMQ, Pub/Sub, Kafka, Celery, Sidekiq, BullMQ).

A worker should:

  • claim one job
  • attempt delivery
  • classify the response
  • update state
  • schedule retry if needed

Avoid doing push sends inline in request/response paths.


3) Retry only retryable failures

Not all failures should be retried.

Retryable examples

  • network timeout
  • temporary provider outage
  • 5xx from push provider
  • throttling / rate limiting (429)

Permanent examples

  • invalid token / unregistered device
  • malformed payload
  • unauthorized credentials
  • app removed / token expired beyond recovery

For permanent failures, mark the token invalid and stop retrying.


4) Use exponential backoff with jitter

For retryable errors, retry with increasing delays, for example:

  • attempt 1: immediately
  • attempt 2: after 1 minute
  • attempt 3: after 5 minutes
  • attempt 4: after 15 minutes
  • attempt 5: after 1 hour

Add jitter so many failed notifications don’t retry at the exact same time.

Example:

  • delay = base * 2^attempt + random(0, small_range)

This helps avoid retry storms.


5) Make sends idempotent

Push providers and your own system should tolerate duplicate attempts.

Use a stable notification identifier, and before sending, check whether it was already marked sent.

Important: push systems may still deliver duplicates if retries happen after the provider accepted the message but your app didn’t record the success. Design for “at least once” delivery, not exactly once.


6) Set a max retry policy

Don’t retry forever.

Example policy:

  • max 5 attempts
  • max age 24 hours
  • stop earlier for permanent failures

After that, move the notification to a dead-letter/failure table for inspection or manual recovery.


7) Handle token cleanup

For mobile push, stale tokens are a major source of failures.

When the provider says the token is invalid/unregistered:

  • mark the device token inactive
  • stop sending to it
  • prompt re-registration on next app launch if needed

This prevents repeated failed retries.


8) Track observability

Log and monitor:

  • send success rate
  • retry counts
  • permanent failure counts
  • provider error codes
  • queue depth
  • age of oldest pending notification

Alert on:

  • rising 5xx / 429 rates
  • backlog growth
  • sudden spike in invalid tokens

Simple retry flow

  1. Create notification record in DB.
  2. Enqueue send job.
  3. Worker sends push.
  4. If success:
    • mark sent
  5. If retryable failure:
    • increment attempts
    • compute next retry time
    • requeue or reschedule
  6. If permanent failure:
    • mark failed_permanent
    • invalidate token if appropriate
  7. If max retries exceeded:
    • mark failed and move to dead-letter storage

Practical recommendations by provider

Firebase Cloud Messaging (FCM)

  • Retry on transient HTTP errors and 5xx.
  • Treat unregistered token responses as permanent.
  • Watch quota/rate-limit errors.

Apple Push Notification service (APNs)

  • Retry on transient server errors or connection issues.
  • Treat bad device token / unregistered device as permanent.

Common mistakes to avoid

  • retrying every error blindly
  • no persistence of send state
  • infinite retries
  • no backoff
  • retrying synchronously in user-facing requests
  • not invalidating dead tokens
  • assuming provider acceptance means device delivery

If you want a robust architecture

Use:

  • DB table for notification state
  • durable queue
  • worker pool
  • exponential backoff with jitter
  • dead-letter queue/table
  • token invalidation
  • idempotency keys

If you want, I can give you:

  1. a database schema for this,
  2. a retry algorithm/pseudocode, or
  3. an example implementation in Node.js, Python, or Go.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.