Prompt
How do I schedule push notifications for later with an API?
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
To schedule push notifications for later via an API, you usually create a notification record now and set a delivery time for the future. A background service or the push provider then sends it at that time.
Typical approaches
1) Your backend schedules it
You send a request like:
POST /notifications
Content-Type: application/json
{
"title": "Reminder",
"body": "Your meeting starts in 15 minutes",
"targetUserId": "12345",
"sendAt": "2026-10-14T15:30:00Z"
}
Your server:
- stores the notification in a database
- marks it as
scheduled - uses a job queue/worker to send it when
sendAtis reached
Common tools:
- BullMQ / Redis
- Sidekiq
- Celery
- Hangfire
- Quartz
- cron + polling
2) Use a push provider that supports scheduled delivery
Some providers let you specify a future send time directly or via “delayed messages” / “scheduled campaigns.”
Examples:
- OneSignal: supports delayed delivery/scheduled notifications in some plans/use cases
- Firebase Cloud Messaging (FCM): does not natively schedule delivery; you schedule on your server
- APNs: does not schedule delivery; your server handles timing
- AWS SNS / Pinpoint: can support campaigns/journeys, depending on setup
What the API usually needs
At minimum:
recipientor segmenttitlebodysendAttimestamp in UTC- optional
datapayload - timezone handling if scheduling from local time
- status tracking:
scheduled,sent,failed,canceled
Example:
{
"recipientId": "user_123",
"title": "Daily summary",
"body": "Your report is ready",
"data": {
"reportId": "abc123"
},
"sendAt": "2026-10-14T18:00:00Z"
}
Important implementation details
- Use UTC timestamps to avoid timezone bugs.
- Validate send time is in the future.
- Support cancellation/rescheduling.
- Use idempotency keys so retries don’t create duplicate scheduled notifications.
- Have a worker that checks due jobs and sends them.
- Store delivery state and logs for debugging.
Simple backend flow
- Client calls
POST /schedule-notification - API stores notification with
sendAt - Worker wakes up or queue system triggers at that time
- Worker sends push via FCM/APNs/OneSignal/etc.
- Mark as sent/failed
Example pseudo-code
def schedule_notification(payload):
db.insert({
"user_id": payload["user_id"],
"title": payload["title"],
"body": payload["body"],
"send_at": payload["send_at"],
"status": "scheduled"
})
def worker():
due = db.query("SELECT * FROM notifications WHERE status='scheduled' AND send_at <= now()")
for n in due:
send_push(n)
db.update(n["id"], {"status": "sent"})
If you want, I can show you:
- a Node.js example with BullMQ
- a Python example with Celery
- or how to do it with FCM / APNs / OneSignal specifically.