How Do Verified Sending Domains, Webhooks, and Logs Work in an Email API?
These three pieces are what let you run email through an API instead of your own mail server: domain verification proves you're allowed to send as your domain, webhooks push you real-time events instead of making you poll, and logs give you a queryable record of what happened to every message. I'll explain how each works generally, then show exactly how Notify implements them — since the generic…
Verified Sending Domains, Webhooks, and Logs form the foundation for running email through an API rather than a traditional mail server. These components ensure legitimacy, real-time notifications, and comprehensive tracking of email messages.
Verified Sending Domains prove that emails are genuinely sent from the domain they claim to be from. This is achieved by adding three DNS records: SPF lists authorized servers, DKIM cryptographically signs messages, and DMARC dictates actions when authentication fails. Notify simplifies this process by providing the necessary records upon domain addition through the Domains dashboard.
Verification typically takes 24-48 hours once DNS propagation completes. Domain limits vary by plan, ranging from 1 on Free to 10 on Scale, and sending from an unverified domain results in outright rejection with a DOMAIN_NOT_VERIFIED error.
Webhooks provide real-time event notifications instead of requiring constant polling. Instead of repeatedly checking if an email bounced or was opened, you register an HTTPS endpoint that receives JSON payloads for events like delivered, bounced, opened, clicked, rejected, and more. Notify's webhook events include Send, Delivery, Open, Click, Bounce, Complaint, and DeliveryDelay.
Unlike many providers that include a signature in webhook payloads, Notify does not sign them. To register a webhook, specify it per verified domain with optional narrowing to subdomains or from addresses. Up to 10 webhook endpoints are available on the Scale plan. To test the webhook endpoint, Notify offers a dedicated test endpoint.
A properly designed webhook handler should acknowledge quickly with a 2xx response and process events asynchronously to avoid false failures. Due to the lack of signature verification in Notify's webhooks, handling the receiving end demands careful design, especially for idempotency to accommodate duplicate deliveries.
Logs serve as a queryable record of every message's journey, including metadata and delivery statuses. Each send generates a record with a messageId, sentAt timestamp, and an events array detailing the event types and timestamps. Notifications are retained for varying periods depending on the plan—48 hours on Free, permanent on Pro and Scale.
Querying logs can be filtered by event type and date range, paginated, and accessed via the API. Notify also allows filtering by event type but does not support custom tags or arbitrary headers directly in logs. To correlate log entries with your own system, use the messageId obtained from the send call. The typical flow involves verifying the domain first, sending via the API, registering webhooks for real-time notifications, and falling back to the logs API for comprehensive reporting.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.