24 · Notifications & push
“Get a ping when the assistant has a question or there’s news in a chat.” Assistant → Notifications. Code: worker/src/push.js (Web Push), worker/src/notify.js (who gets what, email fallback, quiet hours).
Turning it on, per device
- Turn on notifications here → the browser asks permission → the device is saved in
push_subscriptions(endpoint, keys, who turned it on, a random device id, label, failure count, last success). “✓ On for this device”, Send a test (“Test notification sent”), Turn off. - iPhone/iPad: the planner must be added to the Home Screen first (iOS 16.4+).
- “This browser doesn’t support push notifications.” / “Notifications are blocked for this site in your browser settings. Allow them there, then come back.”
- Routes:
POST /api/push/subscriptions,/api/push/unsubscribe,/api/push/test.
Who gets pinged
| Event | Push | Email fallback |
|---|---|---|
| A question from the assistant (mid-chat or check-in) | both partners | yes, every time, to anyone with no device that took the push |
| Activity in a chat | the other partner | at most once per chat per hour (chat_email_notices) |
| A question from the email assistant | both | no (the reply email already carries it) |
The device that sent a message is never pinged about it. Email fallback goes from the planner mailbox (“Email fallback is off until the planner mailbox is set up.”).
Settings per partner (settings.chat_notify_prefs)
- What to notify you about: everything, or questions only.
- Quiet hours: start and end in UK time, may cross midnight. During quiet hours nothing is sent; what came in is held (
settings.chat_notify_held:<email>, left out of backups) and goes out as one “While you were away: …” summary on the first cron run after they end. - Your name in chats is set on the same card.
- In password mode there’s one shared setting for both of you.
Security
- Payloads are end-to-end encrypted (RFC 8291) and signed with the planner’s own VAPID key (RFC 8292), generated on first use into
settings.push_vapid(excluded from backups). - Only well-known push services are ever contacted: hosts ending
.googleapis.com,.push.apple.com,.mozilla.com,.mozaws.net,.notify.windows.com. (PUSH_ALLOW_HOSTSis for local tests only.) - Test suite
worker/test-push.mjs(encryption + VAPID), andtest-chat.mjsuses a fake push service that decrypts every push.