AWS Builder Center
Building Scheduled Notifications with Supabase, DynamoDB Streams, and Amazon EventBridge Scheduler

Building Scheduled Notifications with Supabase, DynamoDB Streams, and Amazon EventBridge Scheduler

A practical serverless pattern for scheduled notifications using Supabase webhooks, AWS Lambda, DynamoDB Streams, and Amazon EventBridge Scheduler, with support for cancellations and rescheduling.

AWS Solutions Architect | DevOps Engineer

Architecture

The pipeline uses three AWS Lambda functions, each with a separate responsibility: receiving changes, managing schedules, and sending notifications.

1. Receive the change

A Supabase database webhook invokes the first Lambda function when an event is created, updated, or deleted.
The function validates the request, persists the event in DynamoDB, and returns HTTP 200 after the write succeeds. Notification processing happens asynchronously, keeping the webhook handler short.

2. Manage the schedule

DynamoDB Streams triggers the second Lambda function.
It checks notification preferences and creates, updates, or deletes a one-time schedule in Amazon EventBridge Scheduler.
Each schedule has a deterministic name derived from the event and recipient IDs. When an event is rescheduled or cancelled, the function can recompute that name without storing a separate schedule-ID mapping.

3. Send the notification

At the scheduled reminder time, EventBridge Scheduler invokes the third Lambda function to send the Telegram message.
The delivery function can be extended to support other channels, including email, mobile push notifications, and SMS.

Benefits of this approach

  • Short webhook processing. The receiving function acknowledges the request after persisting the event.
  • Separate responsibilities. Scheduling logic and notification delivery can evolve independently.
  • No periodic database scans. Event changes drive scheduling, and Scheduler handles future invocations.
  • Usage-based infrastructure. There is no continuously running notification worker to provision or maintain.

Reliability considerations

  • Avoid duplicates. Retries may process the same event more than once. Repeated attempts should not create duplicate schedules or send duplicate notifications.
  • Handle rapid edits. Each change produces a separate DynamoDB Stream record. Check which change is newest, or briefly wait for edits to settle before updating the schedule.
  • Check before sending. Confirm that the event has not been cancelled or moved to another time.
  • Keep track of failures. Set retry limits, save failed events for investigation, and add alerts so failures do not go unnoticed.

This pattern is useful whenever a user schedules something for later: a reminder, an email, or a follow-up message. Each change updates the schedule, and AWS handles the future invocation without a recurring job scanning the database.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article