From 5b50b0ce4f02f3d1a57513cb373dbd264d648ba9 Mon Sep 17 00:00:00 2001 From: joshua Date: Fri, 30 Oct 2026 08:34:41 +0200 Subject: [PATCH] Incoming webhooks and message links on API v2 (1.51.16) - /api/v2/webhooks/{yoco,payfast,whatsapp}; new provider set-ups use them, the v1 addresses keep working with the same handlers. - Calendar and one-click unsubscribe links point at v2; old links answer 308 (a one-click POST to the old address is still handled there). - /api/webhooks/whatsapp runs the real WhatsApp handler (was an empty stub). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot --- CHANGELOG.md | 25 +++++++++++++++++++++++++ README.md | 2 +- WHATS-NEW.md | 6 ++++++ backend/package-lock.json | 4 ++-- backend/package.json | 2 +- docs/HANDOVER.md | 16 ++++++++-------- docs/ROADMAP-v2.md | 6 +++--- frontend/package-lock.json | 4 ++-- frontend/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 11 files changed, 52 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7cf1af..914c5ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,31 @@ and this project follows [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [1.51.16] - 2026-10-30 + +### Added + +- **Incoming webhooks on v2:** `/api/v2/webhooks/yoco`, `/payfast` and `/whatsapp`. New provider + set-ups use them — the PayFast notify URL (every new checkout), the Yoco webhook URL offered in + Site settings → Payments, and the WhatsApp webhook URL. The v1 addresses (`/api/webhooks/…`, + `/api/whatsapp/webhook`) keep working with the same handlers, because a provider may not follow + a redirect on a POST; they now name their v2 address in a `Link` header. +- **Links in sent messages on v2:** "Add to calendar" links point at + `/api/v2/events/{id}/calendar.ics`, and the one-click unsubscribe header at + `/api/v2/unsubscribe/{token}/one-click`. The same links in messages already sent answer `308` + with their v2 address; a mail app's one-click POST to the old address is still handled there. + +### Fixed + +- `/api/webhooks/whatsapp` was an empty stub that answered 500; it now runs the WhatsApp webhook + handler like `/api/whatsapp/webhook`. + +### Upgrading + +- Nothing has to change: existing Yoco and WhatsApp webhook registrations keep working. To move a + registration to its v2 address, generate the Yoco webhook again (Site settings → Payments → Yoco) + and paste the webhook URL shown in Site settings → WhatsApp into WAWP. PayFast moves by itself. + ## [1.51.15] - 2026-10-30 ### Added diff --git a/README.md b/README.md index 4691cb2..ef017f5 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ set names that match your PM2 apps (`pm2 ls`) and the port you use. 2. Set all required environment variables (see backend/README.md). 3. Run Prisma migrations (if applicable). 4. Start the server with: npm start (or a process manager like PM2). -5. Expose the webhook endpoint /api/webhooks/yoco publicly and configure the YOCO webhook to point to it. +5. Expose the webhook endpoint /api/v2/webhooks/yoco publicly and register it with Yoco (Site settings → Payments → Yoco → Generate does this). 6. Ensure the uploads directory public/uploads exists and is writable. ### Frontend Deployment diff --git a/WHATS-NEW.md b/WHATS-NEW.md index 3b9a447..7658069 100644 --- a/WHATS-NEW.md +++ b/WHATS-NEW.md @@ -12,6 +12,12 @@ Write for church admins, not developers: no environment variables, endpoints or developer log is CHANGELOG.md. A tagged version without a section here shows "No details given". --> +## 1.51.16 + +- **The move to the new server connection is complete.** Payment confirmations from Yoco and + PayFast, WhatsApp messages coming in, and the calendar and unsubscribe links in emails now use + the new addresses. Links in emails you've already sent keep working. + ## 1.51.15 - **The app now talks to the server only through its new version.** Privacy settings, the admin diff --git a/backend/package-lock.json b/backend/package-lock.json index b981d5a..338fb8b 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "event-management-backend", - "version": "1.51.15", + "version": "1.51.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "event-management-backend", - "version": "1.51.15", + "version": "1.51.16", "hasInstallScript": true, "dependencies": { "@cj-tech-master/excelts": "^10.2.0", diff --git a/backend/package.json b/backend/package.json index 3151ca0..1c30f4b 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "event-management-backend", - "version": "1.51.15", + "version": "1.51.16", "description": "Event Management System Backend", "main": "src/index.js", "scripts": { diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index 66b358d..3617b71 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -1,6 +1,6 @@ # Handover — where things stand and how to carry on -Last updated: 2026-10-30, after **1.51.15** (and Hub 1.5.0). The plan itself is in +Last updated: 2026-10-30, after **1.51.16** (and Hub 1.5.0). The plan itself is in [ROADMAP-v2.md](./ROADMAP-v2.md) (decisions table at the end); the previous round of features is in [FEATURES-ROUND-1.md](./FEATURES-ROUND-1.md). @@ -17,6 +17,7 @@ encrypted settings unreadable or break existing installs. | 1.51.3 | **Express 5** (qs query parser and `req.body = {}` kept); scanner and at-the-door on v2 check-in; shared middleware answers v2-shaped on `/api/v2` (`legacyErrorsToV2`, `reason`); v1 `Deprecation` + `successor-version` headers (`src/v2/deprecation.ts`) | | 1.51.2 | **v2 accounts and check-in**: signup, login (+ code step), `PATCH /me`; check-in look-up and scan with `outcome`s. `src/services/auth.ts` (from userController) and `src/services/checkin.ts` (from ticketController); login/signup/profile pages on v2 | | 1.51.1 | **v2 registrations and payments**: register, get, cancel, checkout; create/cancel moved to `src/services/registrations.ts`, online checkout to `src/services/payments.ts` (v1 uses them too); typed frontend calls (`apiV2`, `npm run api:types`); register page, Pay now and My Events cancel on v2 | +| 1.51.16 | **Incoming webhooks and message links on v2** — `src/v2/links.ts` (`/api/v2/webhooks/…`, one-click unsubscribe, 308s for old links); provider URLs and email links point at v2 | | 1.51.15 | **Privacy and admin on v2** — `resources/adminPrivacy.ts`; every frontend call on v2; impersonation end/log allowed on v2 while read-only | | 1.51.14 | **People and messaging on v2** — `resources/peopleMessaging.ts`; `/event-listing` for the public pages; `defineRoute` refuses duplicates | | 1.51.13 | **Kids check-in and volunteers on v2** — `resources/kidsVolunteers.ts` | @@ -75,9 +76,9 @@ encrypted settings unreadable or break existing installs. Hub 1.1.0 is deployed with update requests rolled out, and `scripts/install.sh` has been tried on a test server (both done 2026-10-28). -1. **1.51.16: incoming webhooks and links in sent messages** get v2 URLs (every call the app makes - is on v2 since 1.51.15), with the v1 paths still answering (links redirect, webhooks handled by - the same code). Then **2.0.0** — AI helpers and v1 removed. +1. **2.0.0** — AI helpers, and v1 removed. Every endpoint is on v2 since 1.51.16. Keep + answering the v1 webhook paths and the old links in sent messages (`src/v2/links.ts`) after + v1 goes: providers and old emails still use them. 2. **Servers run Node 24** (Joshua, 2026-10-29), so the backend may need Node 22+. Still to do: move from ExcelTS — deprecated in favour of `documonster` by the same author (pre-1.0 in Oct 2026) — once documonster is stable. After 1.51.7 has run everywhere, the old `pgboss` schema @@ -174,7 +175,7 @@ a test server (both done 2026-10-28). up in its transaction history (`findPayments`); Yoco's Checkout API documents no lookup, so Yoco checkouts are "can't check". Tests: `backend/tests/paymentStatus.test.js`. - **Adding a provider:** write `providers/.js` with the same interface, add it to - `PROVIDERS` in `index.js`, mount `handleProviderWebhook('')` at `/api/webhooks/` + `PROVIDERS` in `index.js`, mount `handleProviderWebhook('')` at `/api/v2/webhooks/` (in `src/v2/links.ts`; add the v1 path in `routes/webhookRoutes.js` only for providers already registered there) (`routes/webhookRoutes.js`), and give it a settings card in `frontend/src/components/admin/PaymentsTab.tsx`. New providers start switched off. - `Payment.method` stays the wallet type (card, apple_pay…) because cashups bucket on it; @@ -192,7 +193,7 @@ a test server (both done 2026-10-28). - Bulk sends: `broadcastController`, `whatsappBroadcastController`, and `emailEventAttendees` / `whatsappEventAttendees` in `eventController` take `kind`; scheduled payloads carry it. - WhatsApp STOP: `handleIncomingMessage` in `whatsappController.js` (WAWP `message` event on - `/api/whatsapp/webhook?secret=…`; secret in AppSetting `WAWP_WEBHOOK_SECRET`). + `/api/v2/webhooks/whatsapp?secret=…` — older set-ups use `/api/whatsapp/webhook`, which still works; secret in AppSetting `WAWP_WEBHOOK_SECRET`). - Frontend: `app/dashboard/user/privacy`, `app/unsubscribe`, `app/dashboard/admin/data-requests`, `components/shared/NewsPrompt.tsx` (dashboard layout), `MessageKindPicker.tsx`. - **Anything new that stores personal data** must be added to `anonymiseUser` and @@ -609,8 +610,7 @@ a test server (both done 2026-10-28). into WAWP (events `message` + `session.status`), and only for senders WhatsApp identifies by phone number — a sender known only by a "LID" is logged and ignored (they can still use the link in the message). -- `/api/webhooks/whatsapp` (`webhookController.handleWhatsappWebhook`) is an old empty stub; the - real WAWP webhook is `/api/whatsapp/webhook`. Remove the stub in a later release. +- `/api/webhooks/whatsapp` runs the real WAWP handler since 1.51.16 (it was an empty stub). - There's no log of individual messages sent, so "Download my data" can't include "messages sent to you" yet. diff --git a/docs/ROADMAP-v2.md b/docs/ROADMAP-v2.md index a665f94..81b81d3 100644 --- a/docs/ROADMAP-v2.md +++ b/docs/ROADMAP-v2.md @@ -44,8 +44,8 @@ scanner on v2, v1 deprecation headers** shipped. 1.51.4 **security and dependenc ExcelTS** , 1.51.7 **setting events up on v2, pg-boss 11** and 1.51.8 **the rest of event set-up on v2** and 1.51.9 **series, passes, deals and campuses on v2** 1.51.10 **managing registrations on v2**, 1.51.11 **money on v2** and 1.51.12 **tickets and attendance on v2** 1.51.13 **kids and volunteers on v2**, 1.51.14 **people and messaging on v2** and 1.51.15 -**privacy and admin on v2** shipped — every call the app makes is on v2. **Next: 1.51.16 (incoming -webhooks and links in sent messages), then 2.0.0.** +**privacy and admin on v2** and 1.51.16 **incoming webhooks and links on v2** shipped — every +endpoint is on v2. **Next: 2.0.0.** **Repositories:** @@ -1014,7 +1014,7 @@ income justify the hardware: | 9 | 1.47.0 ✅ – 1.47.3 ✅, 1.48.0 ✅ | Event series & cloning (1.47.0 clone, 1.47.1 series, 1.47.2 year-on-year reports, 1.47.3 season pass), Outbound webhooks (Wallet passes removed from scope) | Smaller, independent wins | | 10 | 1.49.0 ✅ – 1.49.2 ✅, 1.50.0 ✅, 1.50.1 ✅, 1.50.2 ✅ | Admin dashboard/Ctrl+K/bulk actions/saved filters, Accessibility pass, pagination and search on long lists, event picker and webhook guide (Afrikaans removed from scope) | Polish before the big release | | 11 | 1.51.0 ✅, 1.51.1 ✅, 1.51.2 ✅, 1.51.3 ✅ | TypeScript backend + OpenAPI + `/api/v2` alongside v1: 1.51.0 foundations (build, launcher, route declarations, errors, paging, OpenAPI at `/docs/v2`, first read endpoints); 1.51.1 registrations and payments as TS services, typed frontend calls; 1.51.2 check-in and accounts; 1.51.3 Express 5, the scanner on v2, v1 deprecation headers, v2-shaped shared middleware | The breaking-change groundwork | -| 11b | 1.51.4 ✅ – 1.51.15 ✅, 1.51.16 | **Every endpoint on v2 before 2.0** (decided 2026-10-29): 1.51.4 dependency audit and Node 24 LTS; 1.51.5 Next.js 16 and ESLint 10 (ESLint 9 is out of support); 1.51.6 the complete command palette and ExcelTS instead of exceljs; 1.51.7 setting events up (the staff list, create, change, deactivate, copy-from, notification recipients) and pg-boss 11; 1.51.8 the rest of event set-up (the event in full, ticket options and variants, attachments, sections, costs, uploads, calendar file, alias); 1.51.9 series, season passes, bundles, coupons and campuses; 1.51.10 managing registrations (the staff lists, status, at the door, bulk actions, items, coupons, attendees, attendee forms); 1.51.11 money, staff side (payments, cashup, provider transactions, waitlist, sponsorship, consent, form builder, feedback); 1.51.12 tickets and attendance, staff side (tickets, scan locks, attendance, allocations); 1.51.13 kids check-in and volunteer rosters; 1.51.14 people and messaging (users, WhatsApp, broadcasts, scheduled emails, automations, banner, saved filters, dashboard, stats, analytics, reports); 1.51.15 privacy and admin (privacy, admin, settings, setup, Hub, outbound webhooks, backups); 1.51.16 **incoming webhooks and links in sent messages**: Yoco, PayFast and WAWP webhooks and the links in emails and WhatsApp (unsubscribe, consent, ticket transfer, calendar feeds, waitlist offers) get v2 URLs — new messages and provider registrations use them, and the v1 paths keep answering (links by a 308 redirect to v2, provider webhooks handled by the same code, since providers may not follow a redirect on a POST). Each puts its area's endpoints on v2 (1.51.1 – 1.51.10 by moving the logic into TS services; from 1.51.11 by `v1Route`, which runs the v1 handler behind a v2 route — moving those handlers into TS services is a 2.x clean-up that doesn't change the API), its screens onto `apiV2`, and its v1 routes into `SUCCESSORS` | 2.0 can then remove v1 | +| 11b | 1.51.4 ✅ – 1.51.16 ✅ | **Every endpoint on v2 before 2.0** (decided 2026-10-29): 1.51.4 dependency audit and Node 24 LTS; 1.51.5 Next.js 16 and ESLint 10 (ESLint 9 is out of support); 1.51.6 the complete command palette and ExcelTS instead of exceljs; 1.51.7 setting events up (the staff list, create, change, deactivate, copy-from, notification recipients) and pg-boss 11; 1.51.8 the rest of event set-up (the event in full, ticket options and variants, attachments, sections, costs, uploads, calendar file, alias); 1.51.9 series, season passes, bundles, coupons and campuses; 1.51.10 managing registrations (the staff lists, status, at the door, bulk actions, items, coupons, attendees, attendee forms); 1.51.11 money, staff side (payments, cashup, provider transactions, waitlist, sponsorship, consent, form builder, feedback); 1.51.12 tickets and attendance, staff side (tickets, scan locks, attendance, allocations); 1.51.13 kids check-in and volunteer rosters; 1.51.14 people and messaging (users, WhatsApp, broadcasts, scheduled emails, automations, banner, saved filters, dashboard, stats, analytics, reports); 1.51.15 privacy and admin (privacy, admin, settings, setup, Hub, outbound webhooks, backups); 1.51.16 **incoming webhooks and links in sent messages**: Yoco, PayFast and WAWP webhooks and the links in emails and WhatsApp (unsubscribe, consent, ticket transfer, calendar feeds, waitlist offers) get v2 URLs — new messages and provider registrations use them, and the v1 paths keep answering (links by a 308 redirect to v2, provider webhooks handled by the same code, since providers may not follow a redirect on a POST). Each puts its area's endpoints on v2 (1.51.1 – 1.51.10 by moving the logic into TS services; from 1.51.11 by `v1Route`, which runs the v1 handler behind a v2 route — moving those handlers into TS services is a 2.x clean-up that doesn't change the API), its screens onto `apiV2`, and its v1 routes into `SUCCESSORS` | 2.0 can then remove v1 | | 12 | **2.0.0** | **AI helpers** (§15 — headline feature: draft an event, summarise reports and feedback, draft messages, improve text; through the Hub with a rand cap per licence), v1 removed (all of it is on v2 by then; the old webhook URLs and links already sent in messages keep forwarding to v2), migration guide, marketing site/docs for selling | The release. AI needs the Hub (phase 6) for the key, metering and caps | Each phase should add matching help content (`frontend/src/content/help/`), diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d77dc4e..20c7489 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "hope-events-frontend", - "version": "1.51.15", + "version": "1.51.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hope-events-frontend", - "version": "1.51.15", + "version": "1.51.16", "dependencies": { "@dnd-kit/core": "^6.3.1", "@hookform/resolvers": "^5.2.1", diff --git a/frontend/package.json b/frontend/package.json index 67f7ea3..5e4b402 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "hope-events-frontend", - "version": "1.51.15", + "version": "1.51.16", "private": true, "scripts": { "dev": "next dev", diff --git a/package-lock.json b/package-lock.json index ce30be8..6f5c5eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hope-events", - "version": "1.51.15", + "version": "1.51.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hope-events", - "version": "1.51.15", + "version": "1.51.16", "license": "ISC", "devDependencies": { "@axe-core/playwright": "^4.14.0", diff --git a/package.json b/package.json index 5de2330..2fc678d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hope-events", - "version": "1.51.15", + "version": "1.51.16", "main": "index.js", "scripts": { "dev:backend": "cd backend && npm run dev",