refactor: update email templates for clarity and consistency across notifications

This commit is contained in:
paritosh18
2026-04-08 16:10:36 +05:30
parent be0667d8e9
commit 16d075b5f7
10 changed files with 142 additions and 129 deletions

View File

@@ -2,18 +2,19 @@
import { brevoService } from '@/common/email/brevoApi';
import ApiError from '@/common/utils/helper/ApiError';
export async function sendAMEmailForHostAssign(emailAddress: string): Promise<{
export async function sendAMEmailForHostAssign(emailAddress: string, accountManagerName?: string): Promise<{
sent: boolean;
// messageId: string
}> {
const subject = 'Minglar Admin: Host Assignment Notification';
const subject = "You've Been Assigned a New Host";
const displayName = accountManagerName?.trim() || "there";
const htmlContent = `
<p>Hi,</p>
<p>Youve been assigned the <strong>Host</strong> role by Minglar Admin.</p>
<p>Best regards,<br/>Minglar Admin Team</p>
<p>Hi ${displayName},</p>
<p>A new host has been assigned to you by the Minglar team.</p>
<p>You can now manage and support this host through your admin dashboard. Log in to review the host's details, connect with them, and take the next steps as needed.</p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -35,3 +36,5 @@ export async function sendAMEmailForHostAssign(emailAddress: string): Promise<{
}
}
// ...existing code...

View File

@@ -24,7 +24,8 @@ export class AMNotificationService {
}
try {
await sendAMEmailForHostAssign(amUser.emailAddress);
const amName = [amUser.firstName, amUser.lastName].filter(Boolean).join(' ').trim();
await sendAMEmailForHostAssign(amUser.emailAddress, amName);
return true;
} catch (err) {
console.error('Error sending AM assignment email', err);

View File

@@ -10,15 +10,16 @@ export async function sendEmailToHostForApprovedApplication(
// messageId: string
}> {
const subject = "Approval for your application";
const subject = "Host Onboarding Application Approved";
const htmlContent = `
<p>Dear ${name},</p>
<p>Congratulations, Your application to minglar admin has been approved.</p>
<p>You can start onboarding your activities through the host panel.</p>
<p> You can login to your account using the link below:<br/>
<strong>Link:</strong> ${config.HOST_LINK} </p>
<p>Best regards,<br/>Minglar Team</p>
<p>Hi ${name},</p>
<p>We're pleased to inform you that your host onboarding application has been approved by our team.</p>
<p>You can now proceed with completing your activity pre-qualification process.</p>
<p>Please click the link below to log in to your account and continue:</p>
<p><a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a></p>
<p>If you have any questions or need assistance, feel free to reach out to us at info@minglargroup.com.</p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -47,13 +48,16 @@ export async function sendEmailToHostForMinglarApproval(
// messageId: string
}> {
const subject = "Approval for your application";
const subject = "Host Onboarding Application Approved";
const htmlContent = `
<p>Dear Host,</p>
<p>Congratulations, Your application to minglar admin has been approved by minglar admin.</p>
<p>Minglar admin will assign account manager to your application.</p>
<p>Best regards,<br/>Minglar Team</p>
<p>Hi there,</p>
<p>We're pleased to inform you that your host onboarding application has been approved by our team.</p>
<p>You can now proceed with completing your activity pre-qualification process.</p>
<p>Please click the link below to log in to your account and continue:</p>
<p><a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a></p>
<p>If you have any questions or need assistance, feel free to reach out to us at info@minglargroup.com.</p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -87,12 +91,12 @@ export async function sendAMPQQAcceptanceMailtoHost(
const htmlContent = `
<p>Hi ${name},</p>
<p>Were pleased to inform you that your activity has been qualified on the Minglar platform.</p>
<p>We're pleased to inform you that your activity has been qualified on the Minglar platform.</p>
<p>You can now proceed to complete the details of your activity through the Host portal.</p>
<p>Please click the link below to log in to your account and continue:<br/>
<p>Please click the link below to log in to your account and continue:</p>
<p><a href="${config.HOST_LINK_PQ}" target="_blank">${config.HOST_LINK_PQ}</a></p>
<p>If you have any questions or need assistance, feel free to reach out at info@minglargroup.com.</p>
<p>Warm regards,<br/><strong>Team Minglar</strong></p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -122,15 +126,19 @@ export async function sendActivityAcceptanceMailtoHost(
// messageId: string
}> {
const subject = "Approval for your activity details application";
const subject = "Onboarding Completed | You Can Now Set Up Your Activity Schedule and Listing";
const htmlContent = `
<p>Dear ${name},</p>
<p>Congratulations, Your activity details application to minglar admin has been approved.</p>
<p>You can start getting orders for your activity.</p>
<p>You can login to your account using the link below:<br/>
<strong>Link:</strong> ${config.HOST_LINK} </p>
<p>Best regards,<br/>Minglar Team</p>
<p>Hi ${name},</p>
<p>Great news!</p>
<p>You have successfully completed the onboarding process for your activity on Minglar.</p>
<p>You can now move on to the next step by setting up your activity's schedule. Once this is done, your activity will be ready to be listed on the Minglar app.</p>
<p><strong>Access your Host Portal:</strong><br/>
<a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a>
</p>
<p>If you have any questions or need assistance while setting things up, our team is here to help at info@minglargroup.com.</p>
<p>We're excited to see your activity take shape and look forward to having it live on Minglar soon.</p>
<p>Warm regards,<br/>Team Minglar</p>
`;
try {
@@ -151,3 +159,5 @@ export async function sendActivityAcceptanceMailtoHost(
throw new ApiError(500, "Failed to send OTP to minglar admin via email.");
}
}

View File

@@ -9,22 +9,16 @@ export async function sendInvitationEmailForMinglarAdmin(
// messageId: string
}> {
const subject = "Minglar Admin: Your Team Invitation";
const subject = "Team Invitation: Account Manager at Minglar";
const htmlContent = `
<p>Hi there,</p>
<p>We're excited to invite you to join the <strong>Minglar Admin Team</strong>!<br/>
Please use the link below to set up your account and get started.</p>
<p><strong>Access Your Invitation:</strong><br/>
<a href="${link}">${link}</a></p>
<p>If you have any questions or need assistance, feel free to reach out — were here to help.<br/>
We look forward to having you on board!</p>
<p>Welcome aboard!<br/>
<strong>The Minglar Admin Team</strong></p>
<p>Hi ${emailAddress},</p>
<p>We're happy to invite you to join the Minglar team as an Account Manager.</p>
<p>To get started, please set up your account using the link below:</p>
<p><a href="${link}" target="_blank">${link}</a></p>
<p>If you have any questions or need help during the setup process, feel free to reach out.</p>
<p>We look forward to working with you.</p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -45,3 +39,4 @@ We look forward to having you on board!</p>
throw new ApiError(500, "Failed to send invitation via email.");
}
}

View File

@@ -1411,7 +1411,7 @@ export class MinglarService {
const amUser = await this.prisma.user.findUnique({
where: { id: accountManagerXid, isActive: true },
select: { emailAddress: true },
select: { emailAddress: true, firstName: true, lastName: true },
});
if (!amUser || !amUser.emailAddress) {
@@ -1422,7 +1422,8 @@ export class MinglarService {
}
try {
await sendAMEmailForHostAssign(amUser.emailAddress);
const amName = [amUser.firstName, amUser.lastName].filter(Boolean).join(' ').trim();
await sendAMEmailForHostAssign(amUser.emailAddress, amName);
return true;
} catch (err) {
console.error('Error sending AM assignment email', err);

View File

@@ -13,12 +13,13 @@ export async function sendEmailToHostForRejectedApplication(
const subject = "Action Needed: Host Onboarding Application";
const htmlContent = `
<p>Hi ${firstName},</p><br/><br/>
<p>After reviewing your submission, were unable to proceed at this stage, as some details require further updates.<br/>
We encourage you to log in to your Host portal to review the feedback provided and make the necessary changes.</p><br/><br/>
<p>Host portal login : ${config.HOST_LINK}</p><br/><br/>
<p>We appreciate your interest in Minglar and look forward to reviewing your updated application.</p><br/><br/>
<p>Warm regards,<br/><strong>Team Minglar</strong></p>
<p>Hi ${firstName},</p>
<p>After reviewing your submission, we're unable to proceed at this stage, as some details require further updates. We encourage you to log in to your Host portal to review the feedback provided and make the necessary changes.</p>
<p><strong>Host portal login:</strong><br/>
<a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a>
</p>
<p>We appreciate your interest in Minglar and look forward to reviewing your updated application.</p>
<p>Warm regards,<br/>Team Minglar</p>
`;
try {
@@ -53,15 +54,10 @@ export async function sendAMRejectionMailtoHost(
const htmlContent = `
<p>Hi ${name},</p>
<p>After reviewing your submission, were unable to proceed at this stage, as some details require further updates. <br/>
We encourage you to log in to your Host portal to review the feedback provided and make the necessary changes.</p><br/><br/>
<p><a href="${link}" target="_blank">
${link}
</a>
</p>
<p>After reviewing your submission, we're unable to proceed at this stage, as some details require further updates. We encourage you to log in to your Host portal to review the feedback provided and make the necessary changes.</p>
<p><a href="${link}" target="_blank">${link}</a></p>
<p>We appreciate your interest in Minglar and look forward to reviewing your updated application.</p>
<p>Warm regards,<br/>
<strong>Team Minglar</strong></p>
<p>Warm regards,<br/>Team Minglar</p>
`;
try {
@@ -95,20 +91,14 @@ export async function sendAMPQQRejectionMailtoHost(
const subject = "Action Needed: Activity Pre-qualification";
const htmlContent = `
<p>Hi ${name},</p><br/><br/>
<p>Thank you for taking the time to submit your activity pre-qualification detaills on the Minglar platform.<br/><br/>
After reviewing your submission, were unable to approve the application at this stage. However, we encourage you to make the suggested updates and refinements, as many applications are successfully approved after revision.</p><br/><br/>
<p>You can log in to the Host portal to review the feedback and continue updating your application:<br/>
<a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a></p><br/><br/>
<p>If you need any guidance, feel free to reach out to us at info@minglargroup.com.</p><br/><br/>
<p>We appreciate your interest in partnering with Minglar and look forward to reviewing your updated submission.</p><br/><br/>
<p>Warm regards,<br/>
<strong>Minglar Team</strong></p>
<p>Hi ${name},</p>
<p>Thank you for taking the time to submit your activity pre-qualification details on the Minglar platform.</p>
<p>After reviewing your submission, we're unable to approve the application at this stage. However, we encourage you to make the suggested updates and refinements, as many applications are successfully approved after revision.</p>
<p>You can log in to the Host portal to review the feedback and continue updating your application:</p>
<p><a href="${config.HOST_LINK_PQ}" target="_blank">${config.HOST_LINK_PQ}</a></p>
<p>If you need any guidance, feel free to reach out to us at info@minglargroup.com.</p>
<p>We appreciate your interest in partnering with Minglar and look forward to reviewing your updated submission.</p>
<p>Thank you,<br/>Minglar Team</p>
`;
try {
@@ -139,22 +129,19 @@ export async function sendActivityRejectionMailtoHost(
// messageId: string
}> {
const subject = "Improvement of your activity onboarding application";
const subject = "Action Needed: Activity Onboarding";
const htmlContent = `
<p>Dear ${name},</p>
<p>Your account manager has reviewed your activity application and provided some suggestions.<br/>
Please make the necessary improvements and re-submit your activity application along with the pre-qualification answers to proceed with the onboarding process on Minglar.</p>
<p>You may access your activity onboarding application using the link below:<br/>
<strong>Link:</strong> ${config.HOST_LINK}</p>
<p>If you have any questions, please feel free to contact the Minglar Support Team.</p>
<p>Best regards,<br/>
<strong>Minglar Team</strong></p>
<p>Hi ${name},</p>
<p>Thank you for submitting your activity for review.</p>
<p>After evaluating the details provided, we're unable to approve the listing at this stage. A few updates are required before we can proceed.</p>
<p>Please log in to your Host Portal to review the feedback and make the necessary revisions.</p>
<p><strong>Access your Host Portal:</strong><br/>
<a href="${config.HOST_LINK}" target="_blank">${config.HOST_LINK}</a>
</p>
<p>Once the updates have been submitted, our team will re-evaluate your activity promptly.</p>
<p>If you have any questions or need clarification on the feedback, feel free to reach out to us at info@minglargroup.com. We're happy to assist.</p>
<p>Warm regards,<br/>The Minglar Team</p>
`;
try {
@@ -175,3 +162,4 @@ export async function sendActivityRejectionMailtoHost(
throw new ApiError(500, "Failed to send OTP to minglar admin via email.");
}
}

View File

@@ -9,13 +9,16 @@ export async function sendOtpEmailForMinglarAdmin(
// messageId: string
}> {
const subject = "OTP for Minglar Admin Registration";
const subject = "Your Minglar Verification Code";
const htmlContent = `
<p>Dear User,</p>
<p>Your OTP for minglar admin registration is: <strong>${otp}</strong></p>
<p>This code is valid for 5 minutes. Please do not share it with anyone.</p>
<p>Best regards,<br/>Minglar Team</p>
<p>Hi there,</p>
<p>To continue your Minglar Admin registration, please use the following One-Time Password (OTP):</p>
<p><strong>${otp}</strong></p>
<p>This code is valid for 5 minutes.</p>
<p>For your security, please do not share this code with anyone.</p>
<p>If you did not request this OTP, please ignore this email.</p>
<p>Warm regards,<br/>Minglar Team</p>
`;
try {
@@ -36,3 +39,4 @@ export async function sendOtpEmailForMinglarAdmin(
throw new ApiError(500, "Failed to send OTP to minglar admin via email.");
}
}