Building notifications into Moose

In Progress

Goal

  1. Trigger.dev - This is responsbile for cron jobs and will be responsible for batching and sending out the notifications to Apples server.
  2. Swift app - This is the Moose app which currently already exists on the app store. https://apps.apple.com/au/app/moose-studio-crossover/id6780323407
  3. Supabase backend - This is our backend run with Supabase.
  1. Session cancelled
  2. Booking confirmed
  3. Class today

The Plan

Scope

#NotificationTriggerCategory
1Session cancelled (folds in “1 credit refunded”)Studio cancels a sessionTransactional
2Booking confirmedMember books a sessionTransactional
3Class todayMorning-of reminderTransactional (reminder)

Architecture

Architecture diagram

Data model

The new tables are:

device_tokens (Table)

columnnotes
idPK
member_idFK members(id), indexed
tokenAPNs device token (opaque), unique
platformios for now; column exists so Android/web slot in later
environmentsandbox / production (APNs env the token belongs to)
last_registered_atupdated on every re-upload from the app
last_invalidated_atset when APNs returns 410/unregistered; row pruned or soft-disabled

notification_preference (Table)

columnnotes
member_idFK
categoryenum: transactional, announcements
push_enabledbool

Note: push_enabled isn’t responsible for if the device recieves notifications that is still left up to Apple.

notifications (Table)

columnnotes
id, member_id, notification_type, category
title, body, deep_linkrendered content
event_id / broadcast_idprovenance
delivered_at, read_at (future inbox)

members.timezone (Column)

Day 1

On top of this we generated the necessary keys for our sandbox and production APNS. Was a succesful few hours and planning to continue on with this over the week.

Day 2

Day 3

Day 4