An email webhook is an automated HTTP request that an email platform sends to your application when a message event occurs, such as acceptance, delivery, a temporary failure, a permanent bounce, an open, a link click, an unsubscribe, or a spam complaint. Instead of repeatedly asking an email API for updates, your system receives event data as it happens and can act on it immediately.
What is an email webhook in plain language?
Think of an email webhook as a delivery-status notification for software. Your application sends an email, but the sending API cannot know every final outcome at the exact instant you submit the message. The provider may first accept the message, then attempt delivery, receive a response from the recipient's mail server, and later observe an open, click, complaint, or unsubscribe.
Without webhooks, your application would need to poll an events API on a schedule: “Did this message bounce yet? Was it delivered? Did the recipient unsubscribe?” That approach adds delay, creates unnecessary API traffic, and makes it harder to respond consistently. A webhook reverses the flow. The email platform calls an endpoint you control whenever a subscribed event happens.
For example, if https://app.example.com/email-events is your webhook endpoint, the provider may send an HTTP POST request there when a recipient marks a campaign message as spam. Your endpoint reads the payload, verifies that it genuinely came from the provider, records the complaint, and immediately suppresses that address from future marketing sends.
An email webhook is therefore not the email itself, a mailbox rule, or a DNS record. It is an event-driven integration between an email infrastructure provider and your own application.
Why email webhooks matter for deliverability
Deliverability is not just whether an email API accepted a message. It is the broader ability to reach the intended recipient's inbox or mail server consistently and with a sender reputation that supports future delivery. Webhooks make the delivery signals behind that work available to your systems fast enough to use them.
They turn delivery events into operational actions
A permanent delivery failure usually means the address cannot receive mail: perhaps the mailbox does not exist, the domain is invalid, or the recipient server rejects the address permanently. If your system keeps mailing that recipient, you can create repeated failures that damage list quality and waste sending capacity.
A bounce webhook lets you remove, suppress, or investigate the address right away. That matters more than merely seeing a bounce count in a dashboard days later. The event becomes an automated list-hygiene action.
The same principle applies to other events:
- Unsubscribed: stop promotional email immediately and retain a consent record.
- Complained: suppress the recipient and investigate the campaign, targeting, or permission source.
- Temporary failure: monitor the issue and avoid treating a temporary deferral as a permanent invalid address.
- Delivered: update customer-facing message status or confirm a time-sensitive notification reached the destination server.
- Opened or clicked: feed engagement data into segmentation, frequency controls, and campaign reporting.
The important distinction is that a webhook does not improve sender reputation by itself. It gives you the timely, structured feedback needed to operate the practices that do: prompt suppression, accurate segmentation, meaningful monitoring, and disciplined follow-up.
They reduce the gap between an event and your response
For transactional email, the response window can be short. If an order confirmation or password-reset email permanently fails, a support team may need to know right away. An application can use a failure webhook to create an internal alert, surface a status in the user interface, or offer an alternative verified contact method.
For campaigns, speed matters differently. A complaint event should update suppression logic quickly, before the same subscriber receives another scheduled message. An unsubscribe should also be reflected promptly in the system that chooses campaign audiences—not only in the sending platform's own suppression list.
They make deliverability data more useful than a report alone
A reporting dashboard is useful for trends. Webhooks are useful for decisions at the individual-event level. The dashboard may show that failures rose on a particular day; webhook data can tell your systems which recipients, sending domains, templates, tags, or campaigns were involved.
That distinction allows better questions:
- Did failures happen mostly on one recipient domain?
- Did a specific transactional stream start receiving deferrals?
- Did complaint activity rise after a subject-line or audience change?
- Are unsubscribes concentrated among recently imported contacts?
- Is a specific application tenant generating unusually poor outcomes?
When the event payload includes message identifiers, timestamps, recipient domains, tags, SMTP responses, or user-supplied metadata, an email webhook can tie delivery outcomes back to the business action that caused the send.
How an email webhook works step by step
The workflow is simple conceptually, even though production implementation deserves care.
- Your system sends an email. It uses SMTP or an email API to submit a transactional message or campaign message.
- The provider processes the message. It accepts the message, attempts delivery, tracks supported engagement events, and receives recipient-server responses.
- An event occurs. Examples include
accepted,delivered,temporary_fail,permanent_fail,opened,clicked,unsubscribed, andcomplained. - The provider makes an HTTP POST request. It sends a structured payload—commonly JSON—to the endpoint configured for that event.
- Your endpoint authenticates the request. It verifies the provider's signature, checks timestamp freshness, and rejects invalid traffic.
- Your application stores and processes the event. It records the event durably, deduplicates it, then triggers relevant business rules.
- Your endpoint returns a success response. A prompt
2xxresponse tells the provider it received the request; non-success responses can cause retries depending on the provider's policy.
A simplified payload may resemble this:
{
"event": "permanent_fail",
"id": "evt_01JXYZ123",
"timestamp": 1760000000,
"recipient": "person@example.net",
"message": {
"headers": {
"message-id": "<abc123@example.com>",
"subject": "Confirm your account"
}
},
"delivery-status": {
"code": 550,
"description": "Mailbox unavailable"
},
"tags": ["account-confirmation"]
}
This is an illustrative shape, not a universal schema. Field names and event names differ across providers, and payloads can evolve. Build integrations to tolerate additive fields: read the fields you need, preserve the raw payload for diagnosis, and avoid assuming the provider will never add a new field.
Common email webhook event types
Different sending services use different naming conventions, but the underlying stages are broadly similar. Understanding what each event means prevents incorrect automation.
Accepted
An accepted event generally means the provider received the message submission and intends to process it. It is not proof that the recipient server accepted the email, that the message reached the inbox, or that a person read it.
Accepted events are useful for application audit trails. If a customer says they did not get a receipt, your support tooling can distinguish “the application never submitted it” from “the provider accepted it but a later delivery event failed.”
Delivered
A delivered event usually means the recipient's mail server accepted the email. This is an important success signal, but it is not the same as inbox placement or human attention. A message accepted by a recipient server can still later be filtered into spam, a secondary tab, a quarantine area, or an inbox folder the recipient does not check.
Use delivered events for operational status, but do not treat them as a complete measure of campaign success. Combine them with complaint, unsubscribe, click, conversion, and appropriate engagement signals.
Temporary failure or deferral
A temporary failure means delivery was not completed on that attempt, but the problem may resolve. Examples can include a recipient server being unavailable, a transient network problem, a temporary reputation-related deferral, or a mailbox temporarily over quota.
A temporary failure should not automatically cause permanent suppression. Email providers commonly retry delivery under their own queue policies. Your application should distinguish a temporary event from a final failure and should avoid sending duplicate copies of the same transactional message while the original is still being retried.
Permanent failure or hard bounce
A permanent failure indicates that delivery cannot be completed without changing something. Common reasons include a nonexistent mailbox, invalid recipient address, nonexistent recipient domain, or a recipient-server policy rejection that is classified as permanent.
This is one of the most important events for list hygiene. For marketing traffic, suppress the address from future sends unless you have a specific, validated reason to believe the event was misclassified or the recipient has corrected the address. For transactional email, record the failure, do not repeatedly retry from your application, and consider asking the user to update or verify their address through another authenticated channel.
Opened
An open event generally occurs when a tracking image loads. This makes it useful as a directional engagement signal, not as a definitive statement that a human read the message. Image blocking, privacy features, security scanners, proxying, and client behavior can all affect open measurement.
Do not use an open webhook as the sole basis for critical decisions such as deleting a subscriber for inactivity or declaring a user has read a legal notice. Use it carefully alongside clicks, conversions, account activity, and consent data.
Clicked
A click event generally records that a tracked link was requested. It can be more actionable than an open, but it also has limits. Security tools may inspect links automatically, and a click does not necessarily indicate a completed purchase, completed onboarding, or genuine intent.
For campaign optimization, click webhooks can feed audience segments such as “engaged with product updates” or “visited pricing content.” For transactional email, click events can help diagnose whether a user received and used a confirmation or reset link—provided you account for automated scanners and privacy constraints.
Unsubscribed
An unsubscribe event indicates that a recipient used an unsubscribe mechanism. Your system should honor this promptly for the relevant message category and should maintain a durable record of the choice. Do not rely on a webhook as permission to overwrite a subscriber's preferences with a later data import.
It is useful to preserve the event timestamp, recipient, mailing list or stream, and the message or campaign identifier. This supports audits, support requests, and correct application of consent rules.
Complained
A complaint event means a recipient marked the message as spam or the provider received a corresponding feedback-loop signal. Complaints are high-value reputation warnings because they show recipients actively objecting to the mail.
Immediately suppress complaint recipients from promotional mail, then investigate the broader pattern. A spike can point to weak permission practices, misleading content, abrupt frequency increases, a stale list, poor audience selection, or a sender identity recipients do not recognize.
Is an email webhook a metric?
An email webhook is not a metric. It is a delivery mechanism for event data. The metrics come from aggregating the events it delivers.
For example, a webhook endpoint may receive permanent-failure events, delivery events, complaint events, and unsubscribe events. Your analytics system can use those events to calculate bounce rate, delivery rate, complaint rate, unsubscribe rate, click rate, and event-processing reliability.
A worked bounce-rate example
Suppose a campaign attempts to send to 20,000 recipients. Your webhook processor receives 180 permanent-failure events and 60 final temporary-failure events that the provider ultimately cannot deliver. If your organization defines bounce rate as all final failed deliveries divided by attempted deliveries, the calculation is:
Bounce rate = final failed deliveries / attempted deliveries × 100
Bounce rate = (180 + 60) / 20,000 × 100
Bounce rate = 240 / 20,000 × 100
Bounce rate = 1.2%
The result is a 1.2% bounce rate.
Be explicit about definitions in your reporting. Some teams report only permanent failures as bounces, while others include final failures after retry attempts. A temporary event that is later delivered should not be counted as a final bounce. Likewise, duplicate webhook deliveries must not inflate the numerator.
Useful webhook operations metrics
Because webhooks are infrastructure, you should also measure the health of the integration itself:
- Webhook receipt rate: received webhook requests divided by expected provider events, where an expected count can be independently estimated.
- Verification failure rate: signature or timestamp validation failures divided by received requests.
- Processing latency: time between provider event timestamp and successful internal processing.
- Duplicate-event rate: duplicate event IDs divided by total received requests.
- Endpoint error rate: non-2xx responses or internal processing failures divided by webhook requests.
- Queue depth: number of webhook jobs waiting to be processed.
These metrics reveal a failure mode that email dashboards cannot: the provider may be generating accurate events while your application fails to capture or act on them.
How to build a reliable email webhook endpoint
A webhook receiver should be designed as a small, resilient ingestion service rather than as a page handler that performs a long chain of business logic synchronously.
Verify authenticity before trusting the payload
An internet-accessible endpoint will receive unsolicited traffic. Never trust a request solely because it has an email-related JSON body or comes from an IP address you expect. Providers commonly sign webhooks using a shared secret and an HMAC signature derived from request values.
A typical verification flow looks like this:
- Read the raw request body or the exact signed values required by your provider.
- Retrieve the signature, timestamp, and any nonce or token from the request.
- Compute the expected HMAC using the provider's webhook-signing secret.
- Compare the supplied and expected signatures with a timing-safe comparison.
- Reject stale timestamps to limit replay attacks.
- Only then parse and act on the event as trusted provider data.
The exact algorithm, headers, body fields, and canonicalization rules are provider-specific. Follow the implementation guidance in your sending provider's email API reference and setup guides, because signing the wrong byte sequence or using an API key in place of a webhook signing secret can make a secure-looking integration fail.
A conceptual Node.js handler
The following example demonstrates the architecture, not a provider-specific verification scheme. In production, use the exact signing instructions for your provider.
app.post("/webhooks/email", express.raw({ type: "application/json" }), async (req, res) => {
try {
const isValid = verifyProviderSignature({
rawBody: req.body,
headers: req.headers
});
if (!isValid) {
return res.status(401).send("Invalid signature");
}
const event = JSON.parse(req.body.toString("utf8"));
const eventId = event.id;
const inserted = await database.insertWebhookEventIfNew({
eventId,
eventType: event.event,
occurredAt: event.timestamp,
rawPayload: event
});
if (inserted) {
await queue.publish("email-event", { eventId });
}
return res.status(204).end();
} catch (error) {
logger.error({ error }, "email webhook processing failed");
return res.status(500).send("Temporary failure");
}
});
This handler does three important things: it validates before trusting the content, stores the event idempotently, and queues slower work instead of trying to complete every downstream action before responding.
Return quickly, process asynchronously
Webhook providers often expect a quick acknowledgment. If your handler waits for a CRM update, a database aggregation, a Slack notification, a customer-profile lookup, and a fraud check before returning, a temporary dependency outage can cause a timeout and trigger retries.
A safer pattern is:
- Verify the request.
- Persist the raw event and a normalized record in durable storage.
- Place an internal job on a queue.
- Return a successful response.
- Let workers perform enrichment, suppression changes, notifications, and analytics updates.
This approach limits lost events while keeping the endpoint fast. It also creates a replay path: if a downstream consumer has a bug, you can reprocess stored events rather than hoping the provider sends them again.
Make processing idempotent
Assume an event can arrive more than once. Retries happen when a provider cannot confirm your response, and network failures can occur after your server has processed an event but before the provider receives the success status.
Idempotency means processing the same event twice has the same practical result as processing it once. Store a provider event ID when one exists and enforce uniqueness at the database layer. If no stable event ID is supplied, build a carefully considered fallback key from provider-supported identifiers, event type, recipient, and timestamp—but prefer the provider's own event identifier whenever available.
For example, “add this recipient to the suppression table” is naturally idempotent if the suppression record has a unique recipient-and-category key. “Increment the complaint counter” is not idempotent unless you first establish that the event is new.
Common email webhook problems and their causes
Webhook failures can quietly undermine otherwise good email operations. The most serious issue is not always an obvious outage; it may be a partial loss of complaints, bounces, or unsubscribe events that leaves your lists and reporting out of date.
The endpoint returns errors or times out
A 500 response, unhandled exception, overloaded application server, blocked database connection, or slow dependency can prevent a successful acknowledgment. Many providers retry failures, but retry windows and retry schedules vary, so a retry policy is not a substitute for reliability.
Fix this by separating receipt from downstream processing. Monitor endpoint latency and status codes, impose sensible timeouts on internal calls, use a durable queue, and alert on abnormal error rates. Test behavior during database, queue, and CRM outages—not only when every dependency is healthy.
Signature verification fails unexpectedly
The most common causes are using the wrong secret, reading parsed JSON rather than the raw body when the provider signs raw bytes, changing character encoding, failing to preserve the timestamp or token exactly, or using an ordinary string comparison that does not follow the documented scheme.
Fix the integration against the provider's current documentation and known test payloads. Log enough diagnostic context to identify whether failures are due to missing headers, stale timestamps, malformed payloads, or signature mismatch, but never log reusable signing secrets.
Events are processed twice
Duplicates can arise from legitimate provider retries, multiple endpoint registrations, accidental deployment overlap, or an application responding slowly enough that the provider does not see its acknowledgment.
Use a unique event ID and idempotent database writes. Also review configuration scope. Some providers allow webhooks at account and domain levels; configuring different destinations may be intentional, but configuring the same logical consumer twice can create confusing duplicate data flows.
Unsubscribes or complaints do not change audience selection
A sender may correctly receive and store events but fail to connect them to the campaign system that chooses future recipients. This can happen when the marketing platform, customer database, and email service use different subscriber identifiers or update on different schedules.
Fix the identity model. Use stable internal recipient or customer IDs where possible, record the normalized email address, and make suppression checks part of the send-time audience decision. A nightly synchronization is often too slow for complaint and unsubscribe handling.
Open and click data is treated as perfect truth
Open tracking is influenced by image loading and privacy behavior. Click tracking can be triggered by security scanners. A webhook faithfully reports the tracking event it observed, but that event is still a proxy for human engagement.
Fix the interpretation, not the webhook. Use opens and clicks as signals, combine them with first-party conversion or product activity, and avoid punitive automation based on one ambiguous event.
A permanent bounce is handled as a temporary issue
If a mailbox does not exist, repeatedly sending the same campaign or notification will not repair it. Worse, automatic retries from your own application can multiply failed delivery attempts while the provider may already have its own retry logic.
Fix classification rules. Treat permanent failures as a prompt to suppress or correct the address. Treat temporary failures as a reason to observe provider retries and investigate patterns, especially when many events affect the same recipient domain or sending stream.
How to use webhooks to improve campaign performance
Campaign performance improves when event data changes future decisions, not when it merely populates a dashboard.
Build a suppression feedback loop
The foundational workflow is straightforward: when a permanent failure, complaint, or unsubscribe webhook arrives, update the appropriate suppression or preference record before the recipient qualifies for another campaign.
The categories should remain distinct. A marketing unsubscribe does not necessarily mean you must stop essential security notices, depending on your permission model and applicable obligations. A spam complaint, however, is a strong signal to stop promotional traffic. A permanent invalid address may need broad suppression because the mailbox cannot receive any category.
Segment with restraint
Engagement webhooks can support useful segments:
- Recipients who clicked a product announcement.
- Subscribers who have not clicked in a defined period.
- Customers who received but did not act on a renewal notice.
- Users who clicked a feature guide after an onboarding message.
But segmentation should respect the uncertainty in engagement telemetry. Do not increase send frequency merely because an address registered multiple opens; a privacy proxy, shared device, or security product can make that number misleading. Stronger campaign decisions use multiple signals, including purchases, visits, in-app activity, stated preferences, and recent deliverability outcomes.
Use tags and metadata for diagnosis
If your sending system supports tags or custom variables, attach stable, non-sensitive labels that identify the email stream, template family, application tenant, or campaign. Then webhook events can reveal whether an issue is isolated.
For example, a surge in temporary failures may be normal for one recipient provider during an outage. A surge limited to a newly launched stream may indicate an authentication, content, volume, or list-quality problem worth immediate investigation.
Avoid placing sensitive personal data in tags or custom event metadata. Treat webhook payloads as operational data that may be stored, logged, and accessed by engineering, support, and analytics systems.
Webhooks versus polling an email events API
Webhooks and event APIs can work together. The choice is not always either-or.
A webhook is usually best when your application needs timely reaction: suppressing an unsubscribe, detecting a transactional failure, updating a support case, or triggering a fallback workflow. It pushes the event to you without waiting for your next scheduled query.
Polling is useful for reconciliation, historical backfills, and recovery. If you deploy a broken webhook receiver or discover a processing bug, an events API may help you find events that need replaying, depending on the provider's retention and query features.
A mature setup often uses both patterns:
- Webhooks for near-real-time ingestion and automation.
- Durable internal storage for every accepted webhook.
- Scheduled reconciliation against provider event records where available.
- Alerts when webhook volumes fall unexpectedly or reconciliation exposes gaps.
This design recognizes that every distributed system can fail. Webhooks offer speed; reconciliation offers confidence.
Security and privacy best practices for email webhooks
Email-event payloads can include recipient addresses, message IDs, headers, provider response text, clicked URLs, and custom metadata. Handle them as potentially sensitive operational data.
Use HTTPS with a valid certificate. Store the webhook-signing secret in a proper secret manager rather than source control. Verify signatures and reject stale requests to reduce forgery and replay risks. Restrict access to event logs, encrypt sensitive data at rest where appropriate, and set retention periods that match the purpose of the data.
Be cautious when logging raw payloads. Raw event storage is valuable for debugging and replay, but message headers and metadata can expose personal data. Redact or avoid collecting data that is not necessary for the workflow. If you record clicked URLs, consider whether query strings contain identifiers or other sensitive parameters.
Also separate provider authentication from webhook authentication. Your API key or SMTP credential authorizes sending. A webhook signing secret helps verify inbound event notifications. They serve different security purposes and should not be treated as interchangeable.
Practical checklist for an email webhook integration
Before sending production traffic, validate the full lifecycle rather than only confirming that a test request reaches your server.
- Create a dedicated HTTPS endpoint for email events.
- Subscribe only to event types you will use initially, then expand intentionally.
- Verify the provider signature using its exact current scheme.
- Validate timestamp freshness and safely reject invalid requests.
- Store the raw payload and a normalized event record durably.
- Use a unique provider event ID for deduplication.
- Return a success response quickly after durable receipt.
- Process notifications, CRM updates, and analytics asynchronously.
- Map permanent failures, complaints, and unsubscribes to clear suppression rules.
- Keep temporary failures separate from final delivery failures.
- Test duplicate deliveries, endpoint timeouts, malformed payloads, and downstream outages.
- Monitor webhook errors, lag, queue depth, and unexpected drops in event volume.
- Reconcile critical delivery data with provider event records when possible.
- Review privacy, retention, and access controls for recipient-level event data.
If you are evaluating delivery infrastructure, include webhook capabilities in the assessment alongside sending APIs, authentication support, event retention, and cost. The practical value is not merely whether a provider has webhooks, but whether the event data, signing model, retry behavior, and configuration options support reliable operations at your volume. Review transactional email pricing and sending plans in the context of the event visibility and operational controls your application needs.
Conclusion
An email webhook is the real-time bridge between your email provider's event stream and your application's decision-making. It lets you react when an email is accepted, delivered, deferred, permanently rejected, opened, clicked, unsubscribed, or reported as spam.
For deliverability, its biggest value is speed and automation. Promptly suppressing invalid, unsubscribed, and complaint recipients protects list quality. For transactional messaging, it provides a reliable way to expose message status, identify failures, and trigger carefully designed fallbacks. For campaigns, it turns delivery and engagement signals into data that can improve targeting and reporting.
The implementation details matter. Verify signatures, acknowledge quickly, store events durably, make processing idempotent, and treat engagement events as useful but imperfect evidence. With those practices in place, email webhooks become a dependable part of your sending infrastructure rather than a fragile integration that only works during ideal conditions.
FAQ
What is the difference between an email webhook and an email API?
An email API is typically what your application uses to submit messages or query information. An email webhook is how the provider proactively notifies your application that an event occurred. The API is usually request-driven by your application; the webhook is event-driven by the provider.
Does a delivered webhook mean the message reached the inbox?
Not necessarily. A delivered event generally means the recipient's mail server accepted the message. It does not guarantee inbox placement, visibility in a particular tab or folder, or that the recipient read the message.
Should I suppress a recipient after a temporary failure webhook?
Usually no. A temporary failure indicates that delivery may succeed after retries. Suppress recipients after confirmed permanent failures, complaints, and relevant unsubscribes; investigate repeated temporary failures for broader delivery patterns.
Can email webhooks be delivered more than once?
Yes. A provider may retry when it cannot confirm your endpoint received a successful response, and distributed systems can produce duplicate delivery attempts. Design your receiver to deduplicate by the provider's event ID and to make downstream actions idempotent.
Are email open webhooks accurate?
They are useful indicators, but not perfect proof of human reading. Opens normally depend on tracking-image requests and can be affected by privacy protections, image behavior, proxies, and automated systems. Use opens alongside clicks and first-party engagement data rather than as a single source of truth.