Bell in the portal header. It shows an unread badge and polls every 30 s while the tab is visible. Opening it shows the newest 10 and marks them read. Each item links to the lead or chat. There is also a /notifications page with paging and Mark all read. Text is in English and Chinese, rendered from message codes.
services-system stores the notifications, using the unused notification table extended with company, type, link, collapse key and read state. It has internal endpoints for send, inbox, unread count, mark read and mark all read. The read endpoints only touch the caller's rows.
mobile-api adds /api/admin/notifications/**. The caller always comes from the JWT.
Triggers:
Lead assigned (counter): goes to the new salesperson. Nothing is sent when someone assigns a lead to themselves. To support this, capture and update now send doneByUserId.
Web sign-up (counter): goes to the salesperson, or to the event's sales team when no one is assigned.
Inbound WhatsApp (services-whatsapp): goes to the chat owner. Each chat has at most one unread notification (WA:<uuid>). It shows the contact name but never the phone number.
Daily follow-up summary (counter): runs at 08:00 Malaysia time, set by leads.follow-up-notice.cron. It collapses per day.
All sending is best effort and happens after commit, with a 2 s timeout. A failure never fails the action behind it. Logs carry ids only.
Tests touched outside the new files
InvitationWiringTest: registers StaffNotifier and EventSalespersonRepository, and asserts the notifier is wired. No assertion was weakened.
AdminEventLeadServiceTest: new test for doneByUserId.
WebhookIngestServiceTest: the constructor takes the notifier mock, and there are two new tests.
Also changed
Header at 360 px. Adding the bell pushed the user menu off-screen. Phones now use smaller gaps and a capped company picker, and the picker text truncates.
Message bodies keep code before params. Before this, Map.of order was not stable.
OpenSpec change `add-lead-notifications` (design `docs/superpowers/specs/2026-12-02-lead-notifications-design.md`, approved 2026-12-02).
## What
- **Bell in the portal header.** It shows an unread badge and polls every 30 s while the tab is visible. Opening it shows the newest 10 and marks them read. Each item links to the lead or chat. There is also a `/notifications` page with paging and Mark all read. Text is in English and Chinese, rendered from message codes.
- **services-system** stores the notifications, using the unused `notification` table extended with company, type, link, collapse key and read state. It has internal endpoints for send, inbox, unread count, mark read and mark all read. The read endpoints only touch the caller's rows.
- **mobile-api** adds `/api/admin/notifications/**`. The caller always comes from the JWT.
- **Triggers:**
- **Lead assigned** (counter): goes to the new salesperson. Nothing is sent when someone assigns a lead to themselves. To support this, capture and update now send `doneByUserId`.
- **Web sign-up** (counter): goes to the salesperson, or to the event's sales team when no one is assigned.
- **Inbound WhatsApp** (services-whatsapp): goes to the chat owner. Each chat has at most one unread notification (`WA:<uuid>`). It shows the contact name but never the phone number.
- **Daily follow-up summary** (counter): runs at 08:00 Malaysia time, set by `leads.follow-up-notice.cron`. It collapses per day.
- All sending is best effort and happens after commit, with a 2 s timeout. A failure never fails the action behind it. Logs carry ids only.
## Tests touched outside the new files
- `InvitationWiringTest`: registers `StaffNotifier` and `EventSalespersonRepository`, and asserts the notifier is wired. No assertion was weakened.
- `AdminEventLeadServiceTest`: new test for `doneByUserId`.
- `WebhookIngestServiceTest`: the constructor takes the notifier mock, and there are two new tests.
## Also changed
- **Header at 360 px.** Adding the bell pushed the user menu off-screen. Phones now use smaller gaps and a capped company picker, and the picker text truncates.
- **Message bodies** keep `code` before `params`. Before this, `Map.of` order was not stable.
## Verification
- Maven verify:
- services-system: 234 green
- mobile-api: 994 green
- counter: 358 green
- whatsapp: 146 green
- Portal: vitest 1883 passed (exit 0), tsc clean, lint 0 errors (4 existing warnings).
- **Live Playwright check** on the local stack (branch portal on 3015), signed in as admin:
- A web sign-up on `/p/INS/hotel-technology` gave one row for the event's sales team (INS user), and none for CV.
- Assigning that lead gave one LEAD_ASSIGNED row for the INS salesperson.
- Three mock WhatsApp messages on an owned CV chat gave one unread row, timed at the last message. The bell item opens `/whatsapp?c=<uuid>`.
- The follow-up job, with its cron set to every 2 minutes for the test, gave the summary. Reruns collapsed into the unread row.
- The bell, the page and Mark all read work in English and Chinese, at 1280 and 360 px. Mark all read only changed the caller's rows.
- **Not checked in the UI:** another user's bell. Only the admin login is available locally, so the other receivers' rows were checked in the database.
## Deploy
- SQL is in `openspec/changes/add-lead-notifications/sql/`: `01` (DDL), `02` (labels), `99-rollback`. See `docs/deployment.md`.
- Run one service-counter replica, or the morning summary is sent once per replica.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Runs at 08:00 Malaysia time (leads.follow-up-notice.cron). One summary per
salesperson per company, collapsed per day so a rerun does not duplicate.
Message bodies now keep code before params.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
One unread notification per chat (collapse key WA:<conversation uuid>), linking to
/whatsapp?c=<uuid>. Parameters carry the contact name, never the phone number.
Best effort: a failing store never fails ingest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
The bell polls the unread count every 30 s while the tab is visible. Opening it
loads the newest 10 and marks the unread ones read; items link only to paths on
this site. /notifications lists all with paging and Mark all read. Titles and
bodies render from message codes, in English and Chinese.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
The bell pushed the user menu off a 360 px screen; the right-hand controls now
use smaller gaps and a capped company picker on phones. Mark all read on the
page now tells the bell to recount at once instead of on its next poll.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
OpenSpec change
add-lead-notifications(designdocs/superpowers/specs/2026-12-02-lead-notifications-design.md, approved 2026-12-02).What
/notificationspage with paging and Mark all read. Text is in English and Chinese, rendered from message codes.notificationtable extended with company, type, link, collapse key and read state. It has internal endpoints for send, inbox, unread count, mark read and mark all read. The read endpoints only touch the caller's rows./api/admin/notifications/**. The caller always comes from the JWT.doneByUserId.WA:<uuid>). It shows the contact name but never the phone number.leads.follow-up-notice.cron. It collapses per day.Tests touched outside the new files
InvitationWiringTest: registersStaffNotifierandEventSalespersonRepository, and asserts the notifier is wired. No assertion was weakened.AdminEventLeadServiceTest: new test fordoneByUserId.WebhookIngestServiceTest: the constructor takes the notifier mock, and there are two new tests.Also changed
codebeforeparams. Before this,Map.oforder was not stable.Verification
/p/INS/hotel-technologygave one row for the event's sales team (INS user), and none for CV./whatsapp?c=<uuid>.Deploy
openspec/changes/add-lead-notifications/sql/:01(DDL),02(labels),99-rollback. Seedocs/deployment.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs