Schedule icon
Request icon
Script icon
Switch icon
Log icon
SlackIncomingWebhook icon

Resend Domain DNS & Deliverability Sentinel

Audit Resend sending domain DNS verification and DKIM records on a schedule to detect delivery drop risks before sender reputation is damaged.

Categories
CloudInfrastructure

Transactional and marketing email infrastructure like Resend powers critical customer authentication flows, password resets, and product notifications. Modern email inbox providers (Google, Yahoo, Microsoft) enforce strict sender authentication standards, requiring valid DKIM, SPF, and DMARC alignment. When nameserver migrations, DNS provider changes, or domain renewals inadvertently drop or invalidate TXT and CNAME records, transactional emails are silently dropped or routed to spam folders without application-level HTTP errors.

This blueprint implements an automated Day 2 operations sentinel for Resend sending domains. Operating on a periodic daily schedule, it directly queries the Resend Domains REST API, inspects domain verification states, detects missing or failing DKIM/SPF DNS records, and dispatches rich Slack incident alert cards with actionable nameserver remediation instructions.

How it works

  1. Scheduled Invocation: The workflow executes on a periodic daily schedule (0 8 * * *, daily at 08:00 UTC, shipped disabled for initial configuration) or on demand.
  2. Resend REST Query: fetch_resend_domains executes an HTTP GET request to https://api.resend.com/domains via io.kestra.plugin.core.http.Request, authenticating with the bearer token secret RESEND_API_KEY.
  3. Python Metric Extraction: parse_domain_reputation executes inside an isolated python:3.11-slim container, parsing the domains response. It cross-references status and individual DKIM/SPF record verification states against target_domain.
  4. Operational Branching: evaluate_domain_health utilizes io.kestra.plugin.core.flow.Switch to evaluate the classified status:
    • When Healthy: Emits an audit log confirming all DNS records are verified.
    • When Degraded: Invokes io.kestra.plugin.slack.notifications.SlackIncomingWebhook to dispatch a formatted alert card to #messaging-ops detailing the domain name, status, and recommended DNS verification actions.
  5. Telemetry Logging: log_audit_completion records the overall audit summary and degraded domain counts.
  6. Error Resilience: A dedicated errors handler catches HTTP connection timeouts or authentication failures, ensuring on-call teams are alerted if the health check itself cannot reach the API.

What you get

  • Automated Deliverability Protection: Continuous verification detects broken DKIM and SPF records hours before transactional emails bounce.
  • Zero Infrastructure Footprint: Runs completely serverless using Kestra native tasks and containerized Python parsing, requiring no persistent monitoring agents.
  • Actionable Slack Alerts: Context-rich Slack messages direct DevOps and infrastructure engineers immediately to the offending domain with concrete DNS verification directives.
  • Multi-Domain Support: Validates individual target sending domains or audits an entire Resend account domain portfolio.

Who it's for

  • DevOps & Platform Engineers responsible for managing DNS nameservers, domain renewals, and email infrastructure.
  • Product Engineers operating transactional email delivery for critical authentication and customer messaging flows.
  • Site Reliability Engineers (SREs) maintaining notification reliability and external third-party API dependencies.

Why orchestrate this with Kestra

Writing custom cron jobs or Lambda functions to poll email APIs creates unmonitored scripts, unmasked secrets, and brittle alert plumbing. Kestra provides:

  • Declarative YAML Orchestration: The entire monitoring and alert topology is codified in version-controlled YAML with transparent execution history.
  • Encrypted Secret Management: Resend API keys and Slack incoming webhook URLs remain securely encrypted and masked in all execution logs.
  • Built-in Flow Logic: Native Switch branching and containerized Python scripts provide robust error recovery without external microservice dependencies.

Prerequisites

  • A Resend account with an API key from resend.com/api-keys.
  • An incoming Slack webhook URL for operational alerting.

Secrets

Configure the following secrets in your Kestra namespace or instance settings:

Secret Name Description Example
RESEND_API_KEY Resend API authentication token re_••••••••••••
SLACK_WEBHOOK Incoming webhook URL for destination Slack channel https://hooks.slack.com/services/T00/B00/X00

Quick start

  1. In Kestra, navigate to Flows and import this blueprint into your designated namespace (e.g., company.messaging).
  2. Add your RESEND_API_KEY and SLACK_WEBHOOK into Settings > Secrets.
  3. Click Execute and provide your target_domain to test the audit pass.
  4. Review execution logs to verify domain parsing and ensure the Slack alert card renders properly.
  5. In the flow definition, toggle disabled: false on periodic_resend_audit to activate the automated daily monitoring schedule.

How to extend

  • Cloudflare DNS Auto-Repair: Chain an automated DNS reconciliation task using io.kestra.plugin.core.http.Request to Cloudflare's API to re-add dropped DKIM records when remediation_mode == 'AUTO_REPAIR'.
  • PagerDuty Escalation: Add an io.kestra.plugin.pagerduty.Incident task within the DOMAIN_DEGRADED branch to escalate persistent deliverability drops to on-call engineers.
  • Multi-Domain Sweep: Replace the single domain input with io.kestra.plugin.core.flow.Loop to audit all organization domains in parallel.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.