Notifications (@loyaltyos/notifications)
Multi-channel notification delivery engine.
Channels
| Channel | Provider(s) |
|---|---|
| Resend (production), SMTP (dev) | |
| SMS | Twilio REST API |
| PUSH | OneSignal REST API |
| WEBHOOK | HTTP POST with HMAC-SHA256 |
| IN_APP | Stored-only (noop) |
Architecture
Event → sendTrigger() → Template Matching → Handlebars Render → Create Notification
↓
BullMQ Enqueue
↓
Worker: deliver()
↓
Provider (SMTP / Twilio / OneSignal / Webhook)
↓
Status: SENT or FAILED
Templates
Handlebars syntax with sandboxed variable access:
Features:
- Create, update, preview, and test-send templates
- Template variables from event payload + member context
- Opt-out management per channel per member
- Transactional vs marketing classification
Webhooks
Outgoing webhooks signed with HMAC-SHA256:
curl -X POST http://localhost:3002/api/v1/admin/webhooks \
-H "X-API-Key: dev-key" -H "X-Program-Id: prog_dev" \
-H "Content-Type: application/json" \
-d '{"url": "https://partner.example.com/webhooks", "events": ["points.earned"], "secret": "whsec_..."}'
See the full README on GitHub for details.