← StafFixHR home

Email & notification matrix

Every notification the platform emits, who it goes to, and which channels carry it. Today: in-app + WhatsApp (with opt-in) are live. Email is gated on SMTP credentials — when those are added, the preferences below activate per tenant.

In-app
LIVE

Always emitted; persisted on the Notification model. Read in /me/inbox.

WhatsApp
LIVE (mock)

Mirrors a subset of events. Requires Meta Cloud API creds + per-tenant template approval.

Email
PENDING

UI + storage live. Awaiting SMTP creds (SendGrid / SES / Resend) before delivery is wired.

Employee-facing events

EventKindRecipientTriggerSource
Payslip readyPAYSLIPEmployeeAfter payroll generated/importedcompensation/payroll-generate.service.ts, payslips/payslip-import.service.ts
Leave decisionLEAVEEmployeeHR approves / rejects leaveleaves/leaves.service.ts
Leave recorded by HRLEAVEEmployeeHR adds leave on behalf of employeeleaves/leaves.service.ts
Team on leaveLEAVEManagerDirect report's leave is approvedleaves/leaves.service.ts
Document decisionSYSTEMEmployeeHR approves or rejects an uploaded documentemployee-documents/employee-documents.service.ts
Regularisation decisionATTENDANCEEmployeeHR approves/rejects an attendance regularisationattendance/regularisation.service.ts
Absent todayATTENDANCEEmployeeNo punch detected by 10:30 local timeattendance/processor.service.ts
Late-arrival violationATTENDANCEEmployeePunch breaches the policy's grace windowattendance/processor.service.ts
Review assignedSYSTEMReviewer + SubjectPerformance cycle review participants setperformance/performance.service.ts
1:1 scheduledSYSTEMBoth attendeesManager / direct-report 1:1 createdperformance/performance.service.ts
Grievance status updateGRIEVANCERaiserHR updates grievance statusgrievances/grievances.service.ts

HR-admin / manager-facing events

EventKindRecipientTriggerSource
New grievanceGRIEVANCEHR_ADMINEmployee raises grievancegrievances/grievances.service.ts
Document awaiting verificationSYSTEMHR_ADMINEmployee uploads a document needing approvalemployee-documents/employee-documents.service.ts
Attendance regularisation requestATTENDANCEManager + HREmployee requests punch correctionattendance/regularisation.service.ts
Overtime requestATTENDANCEManager + HREmployee submits OT for approvalattendance/overtime-request.service.ts
Short permission requestATTENDANCEManager + HREmployee asks for short permissionattendance/short-permission.service.ts
New applicantSYSTEMHR_ADMINPublic careers page receives an applicationats/ats.service.ts

POSH (sensitive flow)

EventKindRecipientTriggerSource
POSH complaint filedSYSTEMICC membersConfidential — only Internal Committee + raiser see contentposh/posh.service.ts
POSH complaint outcomeSYSTEMRaiserICC closes the inquiryposh/posh.service.ts

Platform-owner-facing events (you / your team)

EventKindRecipientTriggerSource
New tenant signupSYSTEMPlatform AdministratorSelf-serve signup completes (trial or paid)subscriptions/provisioning.service.ts
Subscription eventSYSTEMTenant ownerRazorpay webhook: charged / paused / cancelled / haltedsubscriptions/subscriptions.service.ts
Daily backup completedSYSTEMPlatform AdministratorNightly DB backup finishes (manifest, row counts)backup/backup.service.ts
Support ticket raisedSYSTEMPlatform AdministratorTenant opens a /me/support ticketplatform-support/platform-support.service.ts

Channel rules

  • In-app always fires — no toggle. Stored on the Notification model, polled by the bell badge every 30 s.
  • WhatsApp fires only if (a) module enabled per tenant, (b) Meta Cloud API creds present, (c) User.whatsappOptIn=true, (d) template approved for that tenant. Current state: shipped in mock mode — see /docs/whatsapp.
  • Email fires only when (a) SMTP creds present (pending), (b) tenant has opted that event on for that role, (c) recipient hasn't unsubscribed.

How to configure (per tenant)

Once SMTP is live, owners and HR admins manage their tenant's preferences at /admin/notifications. They get a grid of (event × role × channel) checkboxes. Defaults reflect the recommended setup: payslips emailed to employees, decisions to raisers, escalations to admins, backups to Platform Administrator.

Platform-level events (new signup, subscription, daily backup) are configured separately under/admin/platform-support— those go to hr@staffixhr.com by default and aren't exposed per tenant.

Email volume estimate (per tenant, per month)

For a typical 50-employee tenant with default settings:

  • Payslip ready: ~50 (one per employee per month)
  • Leave decisions: ~25 (assuming 0.5 leaves/employee/month)
  • Document approvals: ~10-15 (uploads + reviews)
  • Attendance regularisations + OT + permissions: ~30-50 (varies wildly by sector)
  • HR-admin escalations: ~10-20
  • Rough total: 125-175 emails/month per 50-emp tenant

At ~1,000 emails/month across 5-10 tenants, you sit comfortably in the free tier of SendGrid (3 K free/mo) or Resend (3 K free/mo). Switch to paid (~$15/mo) when you cross 10 K/mo.

Implementation status

In-app delivery✅ Live — all events
WhatsApp delivery🟡 Live (mock) — needs Meta credentials + template approval
Email matrix UI✅ Built — /admin/notifications (preferences saveable)
Email storage of prefs✅ NotificationPreference table
Email actual sending❌ Not wired — needs SMTP creds (SendGrid/SES/Resend)
Email retry/bounce❌ Pending — will be added with the provider