Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update email-opened.ts

Steven Tey6544642ac407
diff --git a/apps/web/app/api/resend/webhook/email-opened.ts b/apps/web/app/api/resend/webhook/email-opened.ts
index 86d04c627a..ea1576f16d 100644
--- a/apps/web/app/api/resend/webhook/email-opened.ts
+++ b/apps/web/app/api/resend/webhook/email-opened.ts
@@ -1,9 +1,6 @@
import { prisma } from "@dub/prisma";
-const NOTIFICATION_EMAIL_SUBJECT_PREFIXES = [
- "New message from",
- "New bounty available",
-];
+const NOTIFICATION_EMAIL_SUBJECT_KEYWORDS = ["bounty", "message"];
export async function emailOpened({
email_id: emailId,
@@ -22,8 +19,8 @@ export async function emailOpened({
if (
!subject ||
- !NOTIFICATION_EMAIL_SUBJECT_PREFIXES.some((prefix) =>
- subject.startsWith(prefix),
+ !NOTIFICATION_EMAIL_SUBJECT_KEYWORDS.some((keyword) =>
+ subject.includes(keyword),
)
) {
console.log(
@@ -46,7 +43,7 @@ export async function emailOpened({
}
console.log(
- `Updating notification email read statuses for email ${emailId}...`,
+ `Updating notification email read statuses for email ${emailId}. Subject: ${subject}`,
);
const res = await prisma.$transaction(async (tx) => {
@@ -84,5 +81,7 @@ export async function emailOpened({
});
});
- console.log(res);
+ console.log(
+ `Finished processing email.opened webhook for email ${emailId}: ${JSON.stringify(res, null, 2)}`,
+ );
}