···11+import type { NextRequest } from "next/server";
22+33+import { and, gte, lte } from "@openstatus/db";
44+import { db } from "@openstatus/db/src/db";
55+import { user } from "@openstatus/db/src/schema";
66+import { FollowUpEmail, sendEmail } from "@openstatus/emails";
77+88+export async function GET(request: NextRequest) {
99+ const authHeader = request.headers.get("authorization");
1010+ if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
1111+ return new Response("Unauthorized", {
1212+ status: 401,
1313+ });
1414+ }
1515+1616+ const date1 = new Date();
1717+ date1.setDate(date1.getDate() - 3);
1818+ const date2 = new Date();
1919+ date2.setDate(date2.getDate() - 3);
2020+ const users = await db
2121+ .select()
2222+ .from(user)
2323+ .where(and(gte(user.createdAt, date1), lte(user.createdAt, date2)))
2424+ .all();
2525+ for (const user of users) {
2626+ if (user.email) {
2727+ await sendEmail({
2828+ from: "Thibault Le Ouay Ducasse <thibault@openstatus.dev>",
2929+ subject: "Level up your website and API monitoring.",
3030+ to: [user.email],
3131+ react: FollowUpEmail(),
3232+ });
3333+ }
3434+ }
3535+ return Response.json({ success: true });
3636+}
+3-2
apps/web/src/components/marketing/hero.tsx
···3333 A better way to monitor your services.
3434 </h1>
3535 <p className="text-muted-foreground mx-auto max-w-md text-lg md:max-w-lg md:text-xl">
3636- Monitor your API and website globally. Receive notifications before
3737- your users alert you.
3636+ Monitor your API and website from 6 continents, detect some
3737+ performance issues and receive notifications before your users are
3838+ affected.
3839 </p>
3940 </div>
4041 <div className="my-4 grid gap-2 sm:grid-cols-2">
+1-1
packages/api/src/router/clerk/webhook.ts
···69697070 await sendEmail({
7171 from: "Thibault Le Ouay Ducasse <thibault@openstatus.dev>",
7272- subject: "Welcome to OpenStatus.dev ๐",
7272+ subject: "Level up your website and API monitoring.",
7373 to: [opts.input.data.data.email_addresses[0].email_address],
7474 react: WelcomeEmail(),
7575 });
+40
packages/emails/emails/followup.tsx
···11+import { Body, Head, Html, Link, Preview } from "@react-email/components";
22+33+const FollowUpEmail = () => {
44+ return (
55+ <Html>
66+ <Head>
77+ <title>How's it going with OpenStatus?</title>
88+ <Preview>How's it going with OpenStatus?</Preview>
99+ <Body>
1010+ Hey
1111+ <br />
1212+ <br />
1313+ Howโs everything going with Tinybird so far? Let me know if you run
1414+ into any issues, or have any feedback, good or bad!
1515+ <br />
1616+ <br />
1717+ Feel free to shoot me an email or schedule a call with me here:
1818+ <a href="https://cal.com/team/openstatus/30min">
1919+ https://cal.com/team/openstatus/30min
2020+ </a>
2121+ .
2222+ <br />
2323+ <br />
2424+ Thank you,
2525+ <br />
2626+ <br />
2727+ Thibault Le Ouay Ducasse
2828+ <br />
2929+ <br />โญ Star us on{" "}
3030+ <Link href="https://github.com/openstatushq/openstatus">GitHub</Link>
3131+ <br />
3232+ ๐ Visit our website{" "}
3333+ <Link href="https://www.openstatus.dev">OpenStatus.dev</Link>
3434+ </Body>
3535+ </Head>
3636+ </Html>
3737+ );
3838+};
3939+4040+export { FollowUpEmail };
+30-9
packages/emails/emails/welcome.tsx
···44 return (
55 <Html>
66 <Head>
77- <title>Welcome to OpenStatus.dev ๐</title>
88- <Preview>Welcome to OpenStatus.dev ๐</Preview>
77+ <title>Level up your website and API monitoring.</title>
88+ <Preview>Take the most of your OpenStatus monitoring</Preview>
99 <Body>
1010- Hey!
1010+ Hey ๐
1111 <br />
1212 <br />
1313- Welcome to OpenStatus.dev! We're excited to have you on board.
1414- <br /> I hope you will enjoy using our product as much as we enjoyed
1515- building it.
1313+ I'm Thibault <a href="https://www.openstatus.dev">OpenStatus</a>{" "}
1414+ co-founder.
1515+ <br />
1616+ <br /> I'm thrilled to see you joining us. We are building an
1717+ open-source status page and monitoring tool. We are here to help you
1818+ monitor your websites and API to get notified before your users alert
1919+ you.
1620 <br />
1721 <br />
1818- What kind of apps are going to monitor?
2222+ Here are a few things you can do with OpenStatus:
2323+ <br />- Use our{" "}
2424+ <a href="https://docs.openstatus.dev/packages/terraform">
2525+ Terraform providers
2626+ </a>{" "}
2727+ to manage your monitors
2828+ <br />- Integrate your status within your application with our{" "}
2929+ <a href="https://docs.openstatus.dev/packages/status-widget">
3030+ API
3131+ </a>{" "}
3232+ and{" "}
3333+ <a href="https://docs.openstatus.dev/packages/react">React Widget</a>
3434+ <br />- Build your own status page with our <a href="">API</a> and
3535+ host it where you want. Here's our{" "}
3636+ <a href="https://github.com/openstatusHQ/astro-status-page">
3737+ Astro template
3838+ </a>{" "}
3939+ that you can easily host on CloudFlare
1940 <br />
2020- How do you handle your incidents?
2141 <br />
4242+ If you have any questions, just let me know.
2243 <br />
2344 Thank you,
2445 <br />
···3657 );
3758};
38593939-export default WelcomeEmail;
6060+export { WelcomeEmail };
+3-1
packages/emails/index.ts
···11import { Alert, EmailDataSchema } from "./emails/alert";
22+import { FollowUpEmail } from "./emails/followup";
23import SubscribeEmail from "./emails/subscribe";
34import { validateEmailNotDisposable } from "./emails/utils/utils";
45import WaitingList from "./emails/waiting-list";
55-import WelcomeEmail from "./emails/welcome";
66+import { WelcomeEmail } from "./emails/welcome";
6778export {
89 WelcomeEmail,
···1112 Alert,
1213 EmailDataSchema,
1314 SubscribeEmail,
1515+ FollowUpEmail,
1416};
15171618export { sendEmail, sendEmailHtml } from "./emails/send";