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 Tey2401db08154c
diff --git a/apps/web/app/api/resend/webhook/email-opened.ts b/apps/web/app/api/resend/webhook/email-opened.ts
index ea1576f16d..6442ce9a78 100644
--- a/apps/web/app/api/resend/webhook/email-opened.ts
+++ b/apps/web/app/api/resend/webhook/email-opened.ts
@@ -5,18 +5,13 @@ const NOTIFICATION_EMAIL_SUBJECT_KEYWORDS = ["bounty", "message"];
export async function emailOpened({
email_id: emailId,
subject,
+ tags,
}: {
email_id: string;
subject?: string;
+ tags?: Record<string, string>;
}) {
- // TODO: Ignore if not a message notification (when sendBatchEmail supports tags)
- // if (!tags || tags.type !== "notification-email") {
- // console.log(
- // `Ignoring email.opened webhook for email ${emailId} because it's not a notification-email...`,
- // );
- // return;
- // }
-
+ // TODO: replace this with tags once it's confirmed working
if (
!subject ||
!NOTIFICATION_EMAIL_SUBJECT_KEYWORDS.some((keyword) =>
@@ -29,6 +24,15 @@ export async function emailOpened({
return;
}
+ console.log(`Found tags: ${JSON.stringify(tags, null, 2)}`);
+
+ // if (!tags || tags.type !== "notification-email") {
+ // console.log(
+ // `Ignoring email.opened webhook for email ${emailId} because it doesn't have a notification-email tag...`,
+ // );
+ // return;
+ // }
+
const notificationEmail = await prisma.notificationEmail.findUnique({
where: {
emailId,