MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / applyResendEvent

Function applyResendEvent

apps/api/src/api/webhooks/resend.utils.ts:212–246  ·  view source on GitHub ↗
(
  event: IResendEventBase
)

Source from the content-addressed store, hash-verified

210 * so route handlers can include it in the ACK response.
211 */
212export const applyResendEvent = async (
213 event: IResendEventBase
214): Promise<number> => {
215 const reason = resendEventToReason(event);
216
217 if (reason === null) {
218 return 0;
219 }
220
221 const email = extractRecipient(event);
222
223 if (email === null) {
224 logger.warn("Resend deliverability event without recipient address", {
225 event: "webhook.resend.recipient_missing",
226 type: event.type,
227 });
228
229 return 0;
230 }
231
232 const input: IRecordSuppressionInput = {
233 email,
234 reason,
235 provider: EMAIL_SUPPRESSION_PROVIDERS.RESEND,
236 providerMessageId: event.data?.email_id ?? undefined,
237 metadata: {
238 type: event.type,
239 bounceType: event.data?.bounce?.type ?? null,
240 bounceMessage: event.data?.bounce?.message ?? null,
241 },
242 };
243 const result = await emailSuppressionService.record(input);
244
245 return result.recorded ? 1 : 0;
246};

Callers 2

resend.routes.tsFile · 0.90

Calls 4

resendEventToReasonFunction · 0.85
extractRecipientFunction · 0.85
warnMethod · 0.80
recordMethod · 0.45

Tested by

no test coverage detected