Skip to content

feat(notifications): track notification delivery receipts - #1861

Merged
github-actions[bot] merged 2 commits into
Smartdevs17:mainfrom
zarah-s:feat/1749-delivery-receipts
Oct 26, 2026
Merged

github-actions[bot] merged 2 commits into
Smartdevs17:mainfrom
zarah-s:feat/1749-delivery-receipts

Conversation

@zarah-s

@zarah-s zarah-s commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

A notification record says a transport accepted a message. This adds delivery receipts (#1749): a per-channel status timeline of what happened afterwards — the carrier confirming the SMS landed, an email bounce, a push ticket that expired — so support can answer "did the customer actually get it?" without opening a provider dashboard.

Backend

  • deliveryReceiptService — forward-only, idempotent status lifecycle (accepted → sent → delivered, or failed / undelivered / expired). Out-of-order provider callbacks cannot regress a receipt. In-memory repository plus a per-user retention cap mirroring history.
  • deliveryReceiptTransport — a ChannelTransport decorator that records one receipt per attempt and captures a provider message id when the transport stashes it. Wrapped around the email and SMS transports in services/container.ts, so a send that never reaches a transport leaves no receipt.
  • deliveryStatusRouter (mounted at /api/delivery-receipts):
    • GET /api/delivery-receipts?userId=…[&channel=…&limit=…]
    • GET /api/delivery-receipts/summary?userId=…
    • GET /api/delivery-receipts/:id
    • POST /api/delivery-receipts/status — Twilio-compatible callback (form or JSON); optional HTTP Basic auth via TWILIO_ACCOUNT_SID; unknown ids ack with 202 so providers stop retrying.

Frontend

  • deliveryReceiptsStore — read-through client cache over the API.
  • DeliveryStatusScreen — per-channel latest status plus recent-attempt timelines.
  • Settings entry point and navigation registration.

Docs

New "Delivery receipts" section in docs/NOTIFICATIONS.md.

Testing

  • deliveryReceiptService.test.ts + deliveryStatusRouter.test.ts — 46 tests, real HTTP server over the router (status lifecycle, out-of-order regression, summary, retention, callback parsing/auth, JSON + form bodies).
  • deliveryReceiptsStore.test.ts — 7 tests (fetch, caching, error, reset).
  • DeliveryStatusScreen.test.tsx — summary, timeline, empty, refresh, error states.
  • npx jest -c jest.backend.config.js backend/services/notification green for new suites; remaining failures identical to baseline.
  • ESLint/Prettier clean; tsc introduces no new errors (516 total, same as main).

closes #1749

zarah-s and others added 2 commits October 20, 2026 14:34
Adds delivery receipts (Smartdevs17#1749): a per-channel status timeline tracking what
happened after a provider accepted a message.

Backend
- deliveryReceiptService: forward-only, idempotent status lifecycle
  (accepted/sent/delivered/failed/undelivered/expired) with an in-memory
  repository and per-user retention cap
- deliveryReceiptTransport: ChannelTransport decorator that records one
  receipt per attempt and captures a provider message id when stashed by the
  transport; wired around the email and SMS transports in the container
- deliveryStatusRouter: /api/delivery-receipts list/summary/single plus a
  Twilio-compatible status callback (form or JSON), with optional HTTP Basic
  auth via TWILIO_ACCOUNT_SID

Frontend
- deliveryReceiptsStore: read-through client cache over the API
- DeliveryStatusScreen: per-channel summary + recent-attempt timelines
- Settings entry point and navigation registration

Docs: delivery-receipts section in docs/NOTIFICATIONS.md
# Conflicts:
#	backend/server.ts
#	backend/services/container.ts
#	docs/NOTIFICATIONS.md
#	src/navigation/modules/SettingsStack.tsx
#	src/navigation/types.ts
@github-actions
github-actions Bot merged commit 03f6140 into Smartdevs17:main Oct 26, 2026
11 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add delivery receipts for notifications

2 participants