app: email and WhatsApp's screens, changelog and README (APP-1.0-PLAN §8)

Me → What the App sends me (email, WhatsApp, both or off per kind, the
devotional's time; WhatsApp only to a verified number that hasn't replied
STOP), today's devotional offered once on Home after the first sign-in, the
booking sheet picking WhatsApp for reminders when it reaches the member, and
Admin → Email and WhatsApp (what it sends from, where it's changed, Fetch
again, Send me a test, messages waiting and not sent).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 14:29:14 +02:00
co-authored by Claude Opus 5.5
parent 8bfd0b767d
commit fc0a4ad6a0
12 changed files with 411 additions and 10 deletions
+34 -5
View File
@@ -2,8 +2,9 @@
## [Unreleased]
Being built for `app@1.0.0` (docs/APP-1.0-PLAN.md). Four migrations so far (`20261201000000_init`,
`20261202000000_house_of_prayer`, `20261203000000_prayer_requests`, `20261204000000_content`).
Being built for `app@1.0.0` (docs/APP-1.0-PLAN.md). Five migrations so far (`20261201000000_init`,
`20261202000000_house_of_prayer`, `20261203000000_prayer_requests`, `20261204000000_content`,
`20261205000000_messaging`).
Ships `@crosscode/seo` 1.1.0 (`articleJsonLd`, workspace).
### Added
@@ -54,7 +55,7 @@ Ships `@crosscode/seo` 1.1.0 (`articleJsonLd`, workspace).
gaps, who prays when (names, each view in the new `AccessLog`), booking for a member, cancelling
any slot, the wall's rules (AppSetting `prayer_wall`), campaigns, testimonies.
- Jobs: `prayer-reminders` (every minute) and `prayer-renewals` (09:00; 14 and 3 days before the
end) queue messages in `OutboxMessage`; sending them by email and WhatsApp comes with plan §8.
end) queue messages in `OutboxMessage`, sent by email and WhatsApp (plan §8, below).
- The heartbeat's `prayer` counts (last 7 days' coverage, active commitments); `user.export` and
`user.deleted` cover commitments, "I prayed" marks and testimonies (future slots open up, the
past stays as counts only).
@@ -82,8 +83,8 @@ Ships `@crosscode/seo` 1.1.0 (`articleJsonLd`, workspace).
HTML, `react-markdown`), image, an optional button, a campus from the church profile, everyone or
members only, pinned, a publish time and an end. Public ones are pages of their own (canonical,
Article JSON-LD, in the sitemap); members-only ones ask for a sign-in and are noindex. Content
admins write them (`/admin/announcements`). "Also send it" by email or WhatsApp is saved, and
sent once at the publish time with §8. The heartbeat counts the last 30 days.
admins write them (`/admin/announcements`). "Also send it" by email or WhatsApp sends it once, at
the publish time (§8, below). The heartbeat counts the last 30 days.
- **Devotionals** (plan §6, `src/content/devotionals.ts`): Cross Code's from the Hub
(`crosscode-devotionals`, 01:15, and Sync now: the next 2 weeks from today in the church's
timezone, with the licence; exactly those days replaced, earlier ones kept, so a Hub outage
@@ -98,6 +99,34 @@ Ships `@crosscode/seo` 1.1.0 (`articleJsonLd`, workspace).
and read-only copies of Cross Events' and the Website's (`event-feed`, every 15 minutes and on
their `event.changed`) with Register on the Events site and a canonical to the origin. Event
JSON-LD on the App's own events only. Linked products: publish, and show events from each sibling.
- **Email and WhatsApp** (plan §8, `src/messaging/`):
- The church's one set of settings from Accounts (`messaging.get`; the SMTP password and WAWP
token sealed with the link's secret, kept encrypted in AppSetting `messaging_settings`): fetched
when the App links to Accounts, on Accounts' signed `messaging.changed`
(`/api/accounts/v1/messaging-changed`), once a day, and on **Fetch again**. The App never asks
for its own (decision 4); the last copy keeps working while Accounts can't be reached.
- `messages-send` (every minute, `MESSAGES_ENABLED`): the outbox, 100 a run, email (nodemailer)
and WhatsApp (WAWP), laid out as Accounts' and Events' emails with a plain-text version. **STOP
is checked before every WhatsApp** (the member's `whatsapp_opted_out` from Accounts, and anyone
in the App with the same number). What a member asked for (reminders, renewals, notices, the
devotional) goes by email when WhatsApp can't reach them; announcements never do. Tried again
after 2, 4, 8 and 16 minutes, then given up; a reminder never after its slot started, nothing
more than 3 days late; while the church has neither email nor WhatsApp, messages wait. No
prayer request's text in any message.
- `announcement-sends` (every minute): "Also send it" once at the publish time, to members who
turned announcements on, on the channels the admin chose and the member allows (their choice
and their news consent in Accounts, now kept as `Member.newsEmail` / `newsWhatsApp`).
- `devotional-sends` (every 5 minutes): today's devotional at each member's time (06:00 by
default), once a day, with the title, the verse and its translation's notice, and a link.
- Me → **What the App sends me** (`NotificationSettings`): email, WhatsApp, both or off for request
updates (email by default), announcements and the devotional (off), the devotional's time;
WhatsApp only to a verified number that hasn't replied STOP. Home offers the devotional once
after the first sign-in. Booking a slot picks WhatsApp for its reminder when it reaches them.
- Admin → **Email and WhatsApp** (Owner, Church admin): the address and WAWP instance it sends
from (no secrets), where they're changed (Cross Events or Accounts), Fetch again, **Send me a
test** (email or WhatsApp), what's waiting and what wasn't sent in 7 days.
- Counts per day and channel (`MessageCount`) for the heartbeat's `messages.email30d` /
`whatsapp30d`; `user.export` has the notification choices, deleted with the account.
- Home shows today's devotional, the latest announcements (pinned first) and what's on. A sitemap
of the public pages (`/sitemap.xml`, never prayer, members-only items or imported events), named
in robots.txt. `GET /api/v1/app` gives the App's own address (`url`).