Openstatus www.openstatus.dev
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿ’Œ more follow up email (#695)

authored by

Thibault Le Ouay and committed by
GitHub
69dcc505 5c38a822

+113 -13
+36
apps/web/src/app/api/internal/email/route.ts
··· 1 + import type { NextRequest } from "next/server"; 2 + 3 + import { and, gte, lte } from "@openstatus/db"; 4 + import { db } from "@openstatus/db/src/db"; 5 + import { user } from "@openstatus/db/src/schema"; 6 + import { FollowUpEmail, sendEmail } from "@openstatus/emails"; 7 + 8 + export async function GET(request: NextRequest) { 9 + const authHeader = request.headers.get("authorization"); 10 + if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) { 11 + return new Response("Unauthorized", { 12 + status: 401, 13 + }); 14 + } 15 + 16 + const date1 = new Date(); 17 + date1.setDate(date1.getDate() - 3); 18 + const date2 = new Date(); 19 + date2.setDate(date2.getDate() - 3); 20 + const users = await db 21 + .select() 22 + .from(user) 23 + .where(and(gte(user.createdAt, date1), lte(user.createdAt, date2))) 24 + .all(); 25 + for (const user of users) { 26 + if (user.email) { 27 + await sendEmail({ 28 + from: "Thibault Le Ouay Ducasse <thibault@openstatus.dev>", 29 + subject: "Level up your website and API monitoring.", 30 + to: [user.email], 31 + react: FollowUpEmail(), 32 + }); 33 + } 34 + } 35 + return Response.json({ success: true }); 36 + }
+3 -2
apps/web/src/components/marketing/hero.tsx
··· 33 33 A better way to monitor your services. 34 34 </h1> 35 35 <p className="text-muted-foreground mx-auto max-w-md text-lg md:max-w-lg md:text-xl"> 36 - Monitor your API and website globally. Receive notifications before 37 - your users alert you. 36 + Monitor your API and website from 6 continents, detect some 37 + performance issues and receive notifications before your users are 38 + affected. 38 39 </p> 39 40 </div> 40 41 <div className="my-4 grid gap-2 sm:grid-cols-2">
+1 -1
packages/api/src/router/clerk/webhook.ts
··· 69 69 70 70 await sendEmail({ 71 71 from: "Thibault Le Ouay Ducasse <thibault@openstatus.dev>", 72 - subject: "Welcome to OpenStatus.dev ๐Ÿ‘‹", 72 + subject: "Level up your website and API monitoring.", 73 73 to: [opts.input.data.data.email_addresses[0].email_address], 74 74 react: WelcomeEmail(), 75 75 });
+40
packages/emails/emails/followup.tsx
··· 1 + import { Body, Head, Html, Link, Preview } from "@react-email/components"; 2 + 3 + const FollowUpEmail = () => { 4 + return ( 5 + <Html> 6 + <Head> 7 + <title>How's it going with OpenStatus?</title> 8 + <Preview>How's it going with OpenStatus?</Preview> 9 + <Body> 10 + Hey 11 + <br /> 12 + <br /> 13 + Howโ€™s everything going with Tinybird so far? Let me know if you run 14 + into any issues, or have any feedback, good or bad! 15 + <br /> 16 + <br /> 17 + Feel free to shoot me an email or schedule a call with me here: 18 + <a href="https://cal.com/team/openstatus/30min"> 19 + https://cal.com/team/openstatus/30min 20 + </a> 21 + . 22 + <br /> 23 + <br /> 24 + Thank you, 25 + <br /> 26 + <br /> 27 + Thibault Le Ouay Ducasse 28 + <br /> 29 + <br />โญ Star us on{" "} 30 + <Link href="https://github.com/openstatushq/openstatus">GitHub</Link> 31 + <br /> 32 + ๐Ÿš€ Visit our website{" "} 33 + <Link href="https://www.openstatus.dev">OpenStatus.dev</Link> 34 + </Body> 35 + </Head> 36 + </Html> 37 + ); 38 + }; 39 + 40 + export { FollowUpEmail };
+30 -9
packages/emails/emails/welcome.tsx
··· 4 4 return ( 5 5 <Html> 6 6 <Head> 7 - <title>Welcome to OpenStatus.dev ๐Ÿ‘‹</title> 8 - <Preview>Welcome to OpenStatus.dev ๐Ÿ‘‹</Preview> 7 + <title>Level up your website and API monitoring.</title> 8 + <Preview>Take the most of your OpenStatus monitoring</Preview> 9 9 <Body> 10 - Hey! 10 + Hey ๐Ÿ‘‹ 11 11 <br /> 12 12 <br /> 13 - Welcome to OpenStatus.dev! We're excited to have you on board. 14 - <br /> I hope you will enjoy using our product as much as we enjoyed 15 - building it. 13 + I'm Thibault <a href="https://www.openstatus.dev">OpenStatus</a>{" "} 14 + co-founder. 15 + <br /> 16 + <br /> I'm thrilled to see you joining us. We are building an 17 + open-source status page and monitoring tool. We are here to help you 18 + monitor your websites and API to get notified before your users alert 19 + you. 16 20 <br /> 17 21 <br /> 18 - What kind of apps are going to monitor? 22 + Here are a few things you can do with OpenStatus: 23 + <br />- Use our{" "} 24 + <a href="https://docs.openstatus.dev/packages/terraform"> 25 + Terraform providers 26 + </a>{" "} 27 + to manage your monitors 28 + <br />- Integrate your status within your application with our{" "} 29 + <a href="https://docs.openstatus.dev/packages/status-widget"> 30 + API 31 + </a>{" "} 32 + and{" "} 33 + <a href="https://docs.openstatus.dev/packages/react">React Widget</a> 34 + <br />- Build your own status page with our <a href="">API</a> and 35 + host it where you want. Here's our{" "} 36 + <a href="https://github.com/openstatusHQ/astro-status-page"> 37 + Astro template 38 + </a>{" "} 39 + that you can easily host on CloudFlare 19 40 <br /> 20 - How do you handle your incidents? 21 41 <br /> 42 + If you have any questions, just let me know. 22 43 <br /> 23 44 Thank you, 24 45 <br /> ··· 36 57 ); 37 58 }; 38 59 39 - export default WelcomeEmail; 60 + export { WelcomeEmail };
+3 -1
packages/emails/index.ts
··· 1 1 import { Alert, EmailDataSchema } from "./emails/alert"; 2 + import { FollowUpEmail } from "./emails/followup"; 2 3 import SubscribeEmail from "./emails/subscribe"; 3 4 import { validateEmailNotDisposable } from "./emails/utils/utils"; 4 5 import WaitingList from "./emails/waiting-list"; 5 - import WelcomeEmail from "./emails/welcome"; 6 + import { WelcomeEmail } from "./emails/welcome"; 6 7 7 8 export { 8 9 WelcomeEmail, ··· 11 12 Alert, 12 13 EmailDataSchema, 13 14 SubscribeEmail, 15 + FollowUpEmail, 14 16 }; 15 17 16 18 export { sendEmail, sendEmailHtml } from "./emails/send";