From 36d98731d3f626be89e2052a86fb0bb79cf47f4a Mon Sep 17 00:00:00 2001 From: rogutkuba Date: Mon, 23 Feb 2026 00:52:01 -0500 Subject: [PATCH] Add feedback email scheduled for 7 days after signup Send a personal feedback request email from kuba@coderscreen.com to new users 7 days after they sign up, using Resend's built-in scheduling feature. Email asks for product feedback and routes replies to team@coderscreen.com. Co-Authored-By: Claude Haiku 4.5 --- apps/api/src/lib/auth.ts | 5 +++ .../services/third-party/Resend.service.ts | 27 +++++++++++++++ .../third-party/emails/signup-feedback.ts | 34 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 apps/api/src/services/third-party/emails/signup-feedback.ts diff --git a/apps/api/src/lib/auth.ts b/apps/api/src/lib/auth.ts index 5ee37a5..c241f59 100644 --- a/apps/api/src/lib/auth.ts +++ b/apps/api/src/lib/auth.ts @@ -53,6 +53,11 @@ export const useAuth: ( .set({ isOnboarded: true }) .where(eq(schema.user.id, user.id)); }); + + // Schedule feedback email for 7 days after signup + resendService + .sendScheduledFeedbackEmail(user.email, { user_name: user.name }) + .catch((err) => console.error('Failed to schedule feedback email:', err)); }, }, }, diff --git a/apps/api/src/services/third-party/Resend.service.ts b/apps/api/src/services/third-party/Resend.service.ts index dbc626c..4294a53 100644 --- a/apps/api/src/services/third-party/Resend.service.ts +++ b/apps/api/src/services/third-party/Resend.service.ts @@ -2,6 +2,7 @@ import { Context } from 'hono'; import { Resend } from 'resend'; import { AppContext } from '@/index'; import { buildOrgInvitationEmail } from './emails/org-invitation'; +import { buildSignupFeedbackEmail } from './emails/signup-feedback'; import { buildVerificationEmail } from './emails/verification'; type TransactionalEmailTypes = 'verification_code' | 'org_invitation'; @@ -73,4 +74,30 @@ export class ResendService { throw new Error(`Failed to send email: ${error.message}`); } } + + async sendScheduledFeedbackEmail(email: string, params: { user_name: string }): Promise { + const { subject, html } = buildSignupFeedbackEmail(params); + if (this.ctx.env.NODE_ENV === 'development') { + console.log('Skipping scheduled feedback email in development. Details:', { + email, + subject, + scheduledAt: 'in 7 days', + params, + }); + return; + } + + const { error } = await this.client.emails.send({ + from: 'Kuba from CoderScreen ', + replyTo: 'team@coderscreen.com', + to: email, + subject, + html, + scheduledAt: 'in 7 days', + }); + + if (error) { + console.error('Failed to schedule feedback email:', error); + } + } } diff --git a/apps/api/src/services/third-party/emails/signup-feedback.ts b/apps/api/src/services/third-party/emails/signup-feedback.ts new file mode 100644 index 0000000..a41b2b7 --- /dev/null +++ b/apps/api/src/services/third-party/emails/signup-feedback.ts @@ -0,0 +1,34 @@ +interface SignupFeedbackEmailParams { + user_name: string; +} + +export function buildSignupFeedbackEmail(params: SignupFeedbackEmailParams) { + const firstName = params.user_name.split(' ')[0]; + + return { + subject: 'Quick question about CoderScreen', + html: ` + + + + + + +
+

Hey ${firstName},

+

It's Kuba, one of the founders of CoderScreen. I noticed you signed up about a week ago and wanted to reach out personally.

+

I'd love to hear how things are going — whether you've had a chance to run any interviews, or if anything felt confusing or missing.

+

No pressure at all, but if you have a minute, just hit reply and let me know:

+
    +
  • What made you try CoderScreen?
  • +
  • Is there anything that didn't work the way you expected?
  • +
  • What would make it more useful for you?
  • +
+

Even a one-liner helps a ton. We're a small team and genuinely read every response.

+

Thanks for giving us a shot!

+

Kuba

+
+ +`, + }; +}