rebrand to useSend (#210)

This commit is contained in:
KM Koushik
2025-09-03 08:21:55 +10:00
committed by GitHub
parent b1a59d2705
commit 07c53d3f58
219 changed files with 1349 additions and 2835 deletions
+11 -11
View File
@@ -53,7 +53,7 @@ export async function parseSesHook(data: SesEvent) {
// Handle race condition: If email not found by sesEmailId, try to find by custom header
if (!email) {
const emailIdHeader = data.mail.headers.find(
(h) => h.name === "X-Unsend-Email-ID"
(h) => h.name === "X-Usesend-Email-ID" || h.name === "X-Unsend-Email-ID",
);
if (emailIdHeader?.value) {
@@ -71,7 +71,7 @@ export async function parseSesHook(data: SesEvent) {
});
logger.info(
{ emailId: email.id, sesEmailId },
"Updated email with sesEmailId from webhook (race condition resolved)"
"Updated email with sesEmailId from webhook (race condition resolved)",
);
}
}
@@ -131,8 +131,8 @@ export async function parseSesHook(data: SesEvent) {
? SuppressionReason.HARD_BOUNCE
: SuppressionReason.COMPLAINT,
source: email.id,
})
)
}),
),
);
logger.info(
@@ -141,7 +141,7 @@ export async function parseSesHook(data: SesEvent) {
recipients: recipientEmails,
reason: isHardBounced ? "HARD_BOUNCE" : "COMPLAINT",
},
"Added emails to suppression list due to bounce/complaint"
"Added emails to suppression list due to bounce/complaint",
);
} catch (error) {
logger.error(
@@ -150,7 +150,7 @@ export async function parseSesHook(data: SesEvent) {
recipients: recipientEmails,
error: error instanceof Error ? error.message : "Unknown error",
},
"Failed to add emails to suppression list"
"Failed to add emails to suppression list",
);
// Don't throw error - continue processing the webhook
}
@@ -251,7 +251,7 @@ export async function parseSesHook(data: SesEvent) {
await updateCampaignAnalytics(
email.campaignId,
mailStatus,
isHardBounced
isHardBounced,
);
}
}
@@ -334,7 +334,7 @@ async function checkUnsubscribe({
event === EmailStatus.BOUNCED
? UnsubscribeReason.BOUNCED
: UnsubscribeReason.COMPLAINED,
})
}),
),
]);
}
@@ -390,13 +390,13 @@ export class SesHookParser {
}),
async () => {
await this.execute(job.data);
}
},
);
},
{
connection: getRedis(),
concurrency: 50,
}
},
);
private static async execute(event: SesEvent) {
@@ -412,7 +412,7 @@ export class SesHookParser {
return await this.sesHookQueue.add(
data.messageId,
data.event,
DEFAULT_QUEUE_OPTIONS
DEFAULT_QUEUE_OPTIONS,
);
}
}