The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Connect platforms reminder email (#3422)
Steven Tey6e1afcf332c4
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsxindex 6d3b0225e6..4bcb319cb1 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx@@ -62,10 +62,10 @@ export function ProfileDiscoveryGuide() {/></div><div>- <h2 className="text-lg font-semibold">Get discovered</h2>+ <h2 className="text-lg font-semibold">Complete your profile</h2><p className="text-content-inverted/60 text-base">- Finish these steps to show up in the Partner Network and get- invited to more programs.+ Finish these steps to improve your application approval rates and+ receive more invitations from programs in our network.</p></div></div>diff --git a/apps/web/lib/email/email-templates-map.ts b/apps/web/lib/email/email-templates-map.tsindex 115c3eeb8c..a605d06f78 100644--- a/apps/web/lib/email/email-templates-map.ts+++ b/apps/web/lib/email/email-templates-map.ts@@ -1,6 +1,7 @@import BountyApproved from "@dub/email/templates/bounty-approved";import ProgramMarketplaceAnnouncement from "@dub/email/templates/broadcasts/program-marketplace-announcement";import ConnectPayoutReminder from "@dub/email/templates/connect-payout-reminder";+import ConnectPlatformsReminder from "@dub/email/templates/connect-platforms-reminder";import DubPartnerRewind from "@dub/email/templates/dub-partner-rewind";import PartnerBanned from "@dub/email/templates/partner-banned";import PartnerDeactivated from "@dub/email/templates/partner-deactivated";@@ -12,6 +13,7 @@ import UnresolvedFraudEventsSummary from "@dub/email/templates/unresolved-fraud-export const EMAIL_TEMPLATES_MAP = {BountyApproved,ConnectPayoutReminder,+ ConnectPlatformsReminder,PartnerPayoutConfirmed,PartnerPayoutProcessed,PartnerDeactivated,diff --git a/apps/web/scripts/send-batch-emails.ts b/apps/web/scripts/send-batch-emails.tsindex cb20f44875..7c7516d00f 100644--- a/apps/web/scripts/send-batch-emails.ts+++ b/apps/web/scripts/send-batch-emails.ts@@ -1,71 +1,36 @@-import DubPartnerRewind from "@dub/email/templates/dub-partner-rewind";+import ConnectPlatformsReminder from "@dub/email/templates/connect-platforms-reminder";import { prisma } from "@dub/prisma";-import { chunk } from "@dub/utils";import "dotenv-flow/config";import { queueBatchEmail } from "../lib/email/queue-batch-email";+import { generateUnsubscribeToken } from "../lib/email/unsubscribe-token";async function main() {- const partnerRewinds = await prisma.partnerRewind.findMany({+ const usersToNotify = await prisma.user.findMany({where: {- partner: {- users: {- some: {- user: {- notificationPreferences: {- partnerAccount: true,- },- },- },- },+ notificationPreferences: {+ partnerAccount: true,+ },+ partners: {+ some: {},},- year: 2025,- sentAt: null,- },- include: {- partner: true,},});- console.log(`Found ${partnerRewinds.length} partner rewinds`);-- console.table(- partnerRewinds- .map(({ partner, id, year, partnerId, createdAt, sentAt, ...rest }) => ({- ...rest,- partner: partner.email,- country: partner.country,- }))- .slice(0, 10),- );+ console.log(`Found ${usersToNotify.length} users to notify`);- const res = await queueBatchEmail<typeof DubPartnerRewind>(- partnerRewinds.map(({ partner }) => ({- to: partner.email!,- subject: "Your Dub Partner Rewind 2025",+ const res = await queueBatchEmail<typeof ConnectPlatformsReminder>(+ usersToNotify.map((user) => ({+ to: user.email!,+ subject: "Verify your social platforms on Dub Partners",variant: "marketing",- replyTo: "noreply",- templateName: "DubPartnerRewind",+ templateName: "ConnectPlatformsReminder",templateProps: {- email: partner.email!,+ email: user.email!,+ unsubscribeUrl: `https://partners.dub.co/unsubscribe/${generateUnsubscribeToken(user.email!)}`,},})),);- console.log({ res });-- const chunks = chunk(partnerRewinds, 1000);- for (const chunk of chunks) {- const res = await prisma.partnerRewind.updateMany({- where: {- id: {- in: chunk.map(({ id }) => id),- },- },- data: {- sentAt: new Date(),- },- });- console.log(`Updated ${res.count} partner rewinds to sent`);- }+ console.log(res);}main();diff --git a/packages/email/src/components/footer.tsx b/packages/email/src/components/footer.tsxindex 5f17320ac7..6f6fd39878 100644--- a/packages/email/src/components/footer.tsx+++ b/packages/email/src/components/footer.tsx@@ -3,7 +3,7 @@ import { Hr, Link, Tailwind, Text } from "@react-email/components";export function Footer({email,marketing,- unsubscribeUrl,+ unsubscribeUrl = "https://app.dub.co/account/settings",notificationSettingsUrl,}: {email: string;@@ -11,48 +11,32 @@ export function Footer({unsubscribeUrl?: string;notificationSettingsUrl?: string;}) {- if (marketing) {- const unsubscribeHref =- unsubscribeUrl || "https://app.dub.co/account/settings";-- return (- <Tailwind>- <Hr className="mx-0 my-6 w-full border border-neutral-200" />- <Text className="text-[12px] leading-6 text-neutral-500">- We send out product update emails once a month – no spam, no nonsense.{" "}- <Link className="text-neutral-700 underline" href={unsubscribeHref}>- Manage your email preferences.- </Link>- </Text>- <Text className="text-[12px] text-neutral-500">- Dub Technologies, Inc.- <br />- 2261 Market Street STE 5906- <br />- San Francisco, CA 941114- </Text>- </Tailwind>- );- }-return (<Tailwind><Hr className="mx-0 my-6 w-full border border-neutral-200" /><Text className="text-[12px] leading-6 text-neutral-500">This email was intended for <span className="text-black">{email}</span>.If you were not expecting this email, you can ignore this email. If you- are concerned about your account's safety, please reply to this email to- get in touch with us.+ are concerned about your account's safety, please{" "}+ <Link+ className="text-neutral-700 underline"+ href="https://dub.co/support"+ >+ reach out to let us know+ </Link>+ .</Text>- {notificationSettingsUrl && (+ {(marketing || notificationSettingsUrl) && (<Text className="text-[12px] leading-6 text-neutral-500">- Don’t want to get these emails?{" "}+ Don't want to get these emails?{" "}<LinkclassName="text-neutral-700 underline"- href={notificationSettingsUrl}+ href={marketing ? unsubscribeUrl : notificationSettingsUrl}>- Adjust your notification settings+ {marketing+ ? "Manage your email preferences"+ : "Adjust your notification settings"}</Link></Text>)}diff --git a/packages/email/src/templates/connect-platforms-reminder.tsx b/packages/email/src/templates/connect-platforms-reminder.tsxnew file mode 100644index 0000000000..832ece7b73--- /dev/null+++ b/packages/email/src/templates/connect-platforms-reminder.tsx@@ -0,0 +1,118 @@+import { DUB_WORDMARK } from "@dub/utils";+import {+ Body,+ Container,+ Head,+ Heading,+ Html,+ Img,+ Link,+ Preview,+ Section,+ Tailwind,+ Text,+} from "@react-email/components";+import { Footer } from "../components/footer";++export default function ConnectPlatformsReminder({+ email = "[email protected]",+ unsubscribeUrl = "https://partners.dub.co/account/settings",+}) {+ return (+ <Html>+ <Head>+ <style>{`+ @media only screen and (max-width: 600px) {+ .email-container {+ padding-left: 16px !important;+ padding-right: 16px !important;+ }+ }+ `}</style>+ </Head>+ <Preview>+ Verify your social platforms and get noticed by more programs+ </Preview>+ <Tailwind>+ <Body className="mx-auto my-auto bg-white font-sans">+ <Container className="email-container mx-auto my-10 max-w-[600px] px-10 py-5">+ <Section className="mt-2 text-center">+ <Img+ src={DUB_WORDMARK}+ width="65"+ height="32"+ alt="Dub"+ style={{+ display: "block",+ margin: "0 auto",+ }}+ />+ </Section>++ <Heading className="mx-auto mb-2 mt-8 max-w-[420px] text-center text-2xl font-semibold text-black">+ Verify your social platforms and get noticed by more programs+ </Heading>++ <Text className="mx-auto mb-8 mt-0 max-w-[420px] text-center text-base leading-6 text-neutral-600">+ Improve your reputation score in the Dub partner network by+ verifying your social platforms and web properties.+ </Text>++ <Section className="mb-8 text-center">+ <Link+ href="https://ship.dub.co/partner-profile"+ style={{ textDecoration: "none" }}+ >+ <Img+ src="https://assets.dub.co/email-assets/connect-social-platforms.jpg"+ width="500"+ height="292"+ alt="Connect your social platforms"+ style={{+ display: "block",+ maxWidth: "100%",+ height: "auto",+ margin: "0 auto",+ }}+ />+ </Link>+ </Section>++ <Heading className="mx-0 mb-3 mt-0 p-0 text-center text-lg font-semibold text-black">+ Improve approval rates by 50%+ </Heading>++ <Text className="mx-auto mb-8 mt-0 max-w-[420px] text-center text-sm leading-6 text-neutral-600">+ Verified partners are 50% more likely to be approved by programs.+ You will also receive more invitations from some of our top+ programs to join their program and start earning.+ </Text>++ <Section className="mb-8 text-center">+ <Link+ href="https://ship.dub.co/partner-profile"+ className="box-border inline-block rounded-lg bg-neutral-900 px-6 py-3 text-center text-sm font-medium text-white no-underline"+ style={{+ backgroundColor: "#171717",+ color: "#ffffff",+ borderRadius: "8px",+ padding: "12px 24px",+ textDecoration: "none",+ display: "inline-block",+ fontWeight: "500",+ fontSize: "14px",+ }}+ >+ Verify your social platforms now+ </Link>+ </Section>++ <Section className="mx-auto max-w-[400px] text-center">+ <Footer email={email} marketing unsubscribeUrl={unsubscribeUrl} />+ </Section>+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+}diff --git a/packages/email/src/templates/welcome-email-partner.tsx b/packages/email/src/templates/welcome-email-partner.tsxindex bd4ca71b4b..ff76890b42 100644--- a/packages/email/src/templates/welcome-email-partner.tsx+++ b/packages/email/src/templates/welcome-email-partner.tsx@@ -57,7 +57,8 @@ export default function WelcomeEmailPartner({href="https://ship.dub.co/partner-profile"className="font-semibold text-black underline underline-offset-4">- completing your partner profile+ filling out your partner profile and verifying your social+ platforms</Link>. This will help you stand out from other partners in our partnernetwork.@@ -75,9 +76,7 @@ export default function WelcomeEmailPartner({Connect a payout method</Link>{" "}to get paid for your referrals. Your payout bank account must- match your local currency for compliance reasons. E.g. if you're- based in the UK, you will need to connect a GBP bank account to- receive payouts.{" "}+ match your local currency for compliance reasons.{" "}<Linkhref="https://ship.dub.co/payouts-guide"className="font-semibold text-black underline underline-offset-4"