diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-12-15 20:17:22 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-12-15 20:19:43 -0800 |
| commit | 2814d5520623efe5f48c26f639d3ed6cc5f0d8d2 (patch) | |
| tree | 3fc1af65dac5ed55aceaab7574b22fea32cad86a /src/activity/index.ts | |
| parent | 2e41f030f02a336c2e9866d3d56b0494da5a622e (diff) | |
| download | posthook-2814d5520623efe5f48c26f639d3ed6cc5f0d8d2.tar.gz posthook-2814d5520623efe5f48c26f639d3ed6cc5f0d8d2.zip | |
Add email integration
Diffstat (limited to 'src/activity/index.ts')
| -rw-r--r-- | src/activity/index.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/activity/index.ts b/src/activity/index.ts index d3537b4..ea2ae09 100644 --- a/src/activity/index.ts +++ b/src/activity/index.ts @@ -18,6 +18,7 @@ import type { Storage } from '../storage/index.js'; import { ContentType } from '../types/index.js'; import { verifyHCaptcha } from '../integrations/hcaptcha.js'; import { sendNtfyNotification } from '../integrations/ntfy.js'; +import { sendEmailNotification } from '../integrations/email.js'; import { TokenSigner } from '../token/index.js'; const webhookRequestMetric = Metric.fromName('Webhook.Process').asResult(); @@ -310,6 +311,17 @@ export class WebhookActivityImpl implements IWebhookActivity { } } + // Send email notification if configured + if (route.email?.enabled) { + const emailResult = await sendEmailNotification(route.email, storedRequest); + if (emailResult.left().present()) { + const err = emailResult.left().get(); + tReq.trace.traceScope(LogLevel.WARN).trace(`email notification failed: ${err.message}`); + } else { + tReq.trace.trace('email notification sent'); + } + } + const baseName = `${storedRequest.timestamp}_${storedRequest.uuid}`; return tReq.move( |
