Skip to content

IE.7: Assessment Emails and Notifications

Summary

Assessment assignment and completion events send email and in-app notifications. Assignments notify account clients and guest email recipients with a take-assessment link. Completion notifies the assigning counselor with a results link.

Role

  • Primary: Counselor, Client, Guest
  • Secondary: System, Resend

Entry Point

  • Counselor assessment assignment UI
  • Public assessment link: /assessments/take/:token
  • Shared assessment landing: /assessments/share/:token
  • Results page: /assessments/:id/results

Preconditions

  • Assessment exists and can be assigned/shared.
  • Assignment identifies recipients by relationship/client or guest email.
  • Email and notification services are optional but required for delivery.

Steps

  1. Counselor assigns an assessment to clients and/or guest emails.
  2. Backend creates assessment submissions with access tokens.
  3. Backend starts assignment notifications asynchronously.
  4. Backend resolves recipient email and recipient user ID from guest email or counselor-client relationship.
  5. Backend builds the take-assessment link using /assessments/take/:accessToken.
  6. Backend sends an in-app assessment_assigned notification for account recipients.
  7. Backend sends an assessment_assigned email to the recipient email when available.
  8. When a submission is completed, backend starts completion notification work.
  9. Backend resolves the assigning counselor and respondent display name.
  10. Backend sends the counselor an in-app assessment_completed notification and an assessment_completed email.
  11. Backend records notification sent timestamps on the submission where applicable.

Diagram

Edge Cases

  • Guest recipient: Guests receive email only; no in-app notification exists without a user account.
  • Missing client email: Assignment logs a warning and skips email when no email can be resolved.
  • Email failure: Notification send failure is logged and does not fail the assignment/submission.
  • Language preference: Account recipients use their language preference where available; guest recipients default to English.
  • Completion without assigner: No completion notification is sent when AssignedBy is missing.
  • Expired submission: Public submission loading rejects expired submissions.

Current Implementation Notes

  • Backend: backend/internal/services/assessment_service.go
  • Frontend: frontend/src/features/assessments/components/assign-assessment-dialog.tsx, frontend/src/features/assessments/pages/public-assessment.tsx, frontend/src/features/assessments/pages/shared-assessment-landing.tsx
  • Templates: backend/scripts/seed_email_templates.sql, backend/scripts/seed_notification_templates.sql

Screenshot Status

  • Not captured.