Email Notification Service
The Email Notification Service provides automated communication between the recruitment team and applicants. It ensures that candidates are kept informed of their application progress in real-time as administrators update their status within the system.
Overview
The system integrates with Resend via Supabase Edge Functions to dispatch professionally formatted HTML emails. Notifications are triggered automatically when an administrator changes an applicant's status in the Applicant Detail view.
Key Features
- Automatic Triggers: Notifications are sent immediately upon status updates.
- Dynamic Templates: Personalized emails including the applicant's name and their preferred Japanese course.
- Visual Branding: Styled HTML templates with clear calls to action and status-specific messaging.
Supported Status Notifications
The service maps internal application states to specific email templates:
| Status | Email Subject | Purpose | | :--- | :--- | :--- | | Reviewed | Your Application is Under Review | Informs the candidate that their profile is being actively evaluated. | | Accepted | Congratulations! Your Application Has Been Accepted | A congratulatory message welcoming the student to their selected course. | | Rejected | Update on Your Application | A polite notification informing the candidate they will not be moving forward. | | Pending | Application Status Update | A generic update indicating the application is back in the queue. |
Technical Configuration
The notification service is hosted as a Supabase Edge Function. To ensure emails are delivered successfully, the following configuration is required.
Prerequisites
- A Resend account and API Key.
- The API Key must be added to your Supabase project secrets:
supabase secrets set RESEND_API_KEY=re_your_api_key_here
Edge Function Interface
The service is located at /supabase/functions/send-status-notification. It accepts a POST request with the following JSON schema:
interface StatusNotificationRequest {
applicantName: string; // Full name of the applicant
applicantEmail: string; // Recipient address
newStatus: string; // 'pending' | 'reviewed' | 'accepted' | 'rejected'
preferredCourse: string; // The course the applicant applied for
}
Usage Example (Frontend)
The notification is typically triggered from the ApplicantDetail page using the supabase.functions.invoke method:
const { data, error } = await supabase.functions.invoke("send-status-notification", {
body: {
applicantName: "John Doe",
applicantEmail: "john@example.com",
newStatus: "accepted",
preferredCourse: "JLPT N3 Preparation",
},
});
Delivery Behavior & Limitations
- Sender Identity: By default, emails are sent from
Admissions <onboarding@resend.dev>. In production environments, this should be updated to a verified domain in the Resend dashboard. - Demo Mode: During the internship/demo phase, the service is configured to route notifications to a hardcoded administrator email (
ashishupadhyay7353@gmail.com) for testing purposes. To enable direct applicant delivery, update thetofield in the Edge Function'sresend.emails.sendcall. - Error Handling: If an email fails to send (e.g., due to an invalid API key), the system will still update the applicant's status in the database but will display a warning toast to the administrator: "Status updated (Email notification failed)".