Email Delivery Tracking & Webhook Integration
Email Delivery Tracking & Webhook Integration
NurtureHub receives real-time email delivery and engagement events from Resend via webhooks. These events update contact records, journey statuses, and intent scores automatically — no manual action is required from agents.
How It Works
When NurtureHub sends an email through Resend, it embeds a set of tracking tags in the message. When Resend delivers, bounces, or records engagement on that email, it posts a webhook event back to NurtureHub at:
POST /api/webhooks/resend
NurtureHub verifies the request's authenticity, identifies the internal records from the embedded tags, and routes the event into the appropriate processing pipeline via Inngest.
Tracked Events
Delivered
When Resend confirms successful delivery to the recipient's mail server:
- The
scheduledEmailrecord is markedsentwith adeliveredAttimestamp - The corresponding
journeyEmailstep is markedsent - A
deliveredengagement event is recorded (neutral weight — no scoring impact)
Bounced
When a message cannot be delivered:
- The contact's email address is suppressed
- The active nurture journey is paused
- The agent receives a notification
Spam Complaint
When a recipient marks the email as spam:
- The contact's email address is suppressed
- The contact's consent status is set to
denied - The agent receives a notification
Opened
When a recipient opens an email:
- An
openedengagement event is recorded - Intent score recalculation is triggered for the contact
Link Clicked
When a recipient clicks a link in an email:
- A
clickedengagement event is recorded with the clicked URL - Intent score recalculation is triggered
- Links matching booking or valuation patterns (e.g.
/book,/valuat,/appoint,/calendly) receive a +30 point intent score weight
Delivery Delayed
When Resend reports a delivery delay, the event is logged. No action is taken — Resend retries automatically.
NurtureHub Email Tags
NurtureHub automatically embeds the following tags in every outgoing email sent via Resend. These tags are used to correlate webhook events back to internal records:
| Tag | Purpose |
|---|---|
nh_tenant_id | Identifies the agency account |
nh_contact_id | Identifies the contact |
nh_scheduled_email_id | Identifies the specific scheduled email |
nh_journey_id | Identifies the nurture journey |
nh_journey_email_id | Identifies the step within the journey |
If a webhook event arrives without NurtureHub tags (e.g. emails sent outside the platform), it is logged and ignored.
Engagement & Opens via Webhook vs. Pixel Tracking
NurtureHub supports two parallel paths for tracking opens and clicks:
- Pixel / redirect tracking — embedded tracking pixel and tracked links in the email body
- Resend webhook — server-side event delivery from Resend, independent of image loading or link-click behaviour
Both paths feed into the same email-engagement-processor Inngest function. The webhook path uses a synthetic token ID (format: resend_open_<messageId>) to identify the source.
Configuration
To enable webhook delivery, configure RESEND_WEBHOOK_SECRET with the signing secret from your Resend webhook settings:
- Go to https://resend.com/webhooks
- Create a new webhook pointing to
https://<your-domain>/api/webhooks/resend - Select all event types
- Copy the signing secret and set it as
RESEND_WEBHOOK_SECRETin your environment
If RESEND_WEBHOOK_SECRET is not set, signature verification is skipped. This is intended for local development only — always configure the secret in staging and production environments.
Signature Verification
NurtureHub verifies every incoming webhook request using SVIX HMAC-SHA256 signature verification:
- The signed content is:
{svix-id}.{svix-timestamp}.{raw-body} - The
svix-signatureheader may contain multiple space-separatedv1,<base64>signatures — the request is accepted if any one of them matches - Requests with a timestamp older than 5 minutes are rejected to prevent replay attacks
- Verification uses the Web Crypto SubtleCrypto API, compatible with Next.js Node.js and Edge runtimes
Relevant HTTP Headers
| Header | Description |
|---|---|
svix-id | Unique message ID for this webhook delivery |
svix-timestamp | Unix timestamp (seconds) of when the message was sent |
svix-signature | Space-separated list of v1,<base64-hmac> signatures |
Idempotency
The delivery confirmation processor is idempotent. If a delivered event is received for an email already in sent or cancelled status, processing is skipped without error. This prevents duplicate status updates if Resend delivers the webhook more than once.