Skip to content

Webhooks, Tracking & Deliverability

Deliverability requires both clean outbound authentication (SPF, DKIM, DMARC, RFC 8058 headers) and closed-loop inbound feedback from your email service provider (ESP). Campaign handles tracking, public compliance pages, webhook verification, and global suppression enforcement natively.

All public routes share the public_route_prefix setting (default /_campaign) and are registered lazily through ProcessWire URL hooks by PublicHttpService:

Method & Route Purpose Security & Privacy Controls
GET /_campaign/o/{token}.gif Open tracking pixel (1x1 transparent GIF) HMAC-signed recipient token; respects track_opens and anonymize_ip.
GET /_campaign/c/{token} Click tracking redirect Validates signed token and target URL against campaign_links before issuing 302 redirect.
GET /_campaign/view/{token} Web archive (“View in Browser”) Sends X-Robots-Tag: noindex, nofollow and Content-Security-Policy: sandbox headers to isolate rendered email HTML.
GET|POST /_campaign/confirm/{token} Double Opt-In confirmation Validates signed token, activates subscription, fires Campaign::afterSubscribe.
GET|POST /_campaign/unsubscribe/{token} RFC 8058 one-click unsubscribe Accepts POST with List-Unsubscribe=One-Click directly; renders confirmation page on GET.
GET|POST /_campaign/preferences/{token} Subscriber preference center Allows toggling is_public mailing lists or global opt-out without a site login.
POST /_campaign/subscribe Public subscription form handler Enforces $session->CSRF, honeypot field, signed timestamp dwell check, and CampaignRateLimiter.
POST /_campaign/webhook/{provider} Inbound ESP webhook receiver Enforces 2 MiB raw body cap, provider signature/token verification, and transactional campaign_events.dedupe_hash deduplication.

Configure your provider’s webhook destination to https://your-domain.example/_campaign/webhook/{provider} and enter the matching secret under Setup > Campaigns > Settings > Provider Webhooks:

Provider Key Email Service Provider Verification Mechanism
ses Amazon SES (via SNS) X-Campaign-Secret, X-SES-Token, or Authorization: Bearer token (plus SNS subscription confirmation handling).
postmark Postmark X-Postmark-Token, X-Campaign-Secret, or Authorization: Bearer token.
mailgun Mailgun HMAC-SHA256 verification over timestamp + token with a 15-minute replay window.
sendgrid SendGrid ECDSA / HMAC signature or shared secret header validation.
resend Resend Standard Svix-style svix-id, svix-timestamp, and svix-signature HMAC verification.
brevo Brevo Shared secret header (X-Campaign-Secret / Authorization: Bearer) validation.
mailersend MailerSend Signature HMAC-SHA256 payload digest verification.
generic Generic / Custom X-Campaign-Signature HMAC-SHA256 over the raw request body using webhook_secret_generic.

Inbound Event Normalization & Deduplication

Section titled “Inbound Event Normalization & Deduplication”

WebhookService normalizes provider-specific payloads into canonical event types (delivered, opened, clicked, soft_bounce, hard_bounce, complaint, unsubscribed, deferred). Before inserting into campaign_events, it computes a deterministic dedupe_hash inside a database transaction so retried webhook deliveries from your ESP never double-count opens, clicks, or soft bounces.

After processing, Campaign::forwardWebhook fires so custom modules can mirror verified events to external analytics or CRM systems.

Global Suppression List & Bounce Thresholds

Section titled “Global Suppression List & Bounce Thresholds”

Open Setup > Campaigns > Suppressions to review blocked addresses, inspect soft-bounce counters, manually block an email address, or remove an accidental suppression.

The Global Suppression List blocks hard bounces, spam complaints, and manual blocks across every mailing list and sendout.

SuppressionService enforces four suppression reasons (Totoglu\Campaign\Domain\SuppressionReason):

  • hard_bounce: Permanent delivery failure (invalid mailbox, non-existent domain). Suppresses the address immediately on the first occurrence.
  • soft_bounce: Temporary failure (mailbox full, server unavailable). Increments soft_bounce_count; once the counter reaches soft_bounce_threshold (default 3), the address is promoted to global suppression.
  • complaint: Recipient marked a message as spam via an ESP feedback loop. Suppresses immediately and marks all list subscriptions complained.
  • manual: Added explicitly by an administrator in the workspace or via $campaign->suppressions()->suppress(...).

Campaign is built to operate under strict privacy regulations:

  • IP Anonymization: Enabling anonymize_ip masks the last octet of IPv4 addresses and the host suffix of IPv6 addresses before storing tracking events.
  • Consent Proof: Every Double Opt-In confirmation records confirmed_at, confirmation source, and masked IP in campaign_subscriptions.
  • Automated Retention Pruning: PruneCampaignDataTask removes tracking rows older than event_retention_days.
  • On-Demand Anonymization: Run php vendor/bin/wire campaign:anonymize --contact=<uuid> --force --json (or trigger anonymization through the Contacts module) to scrub PII from campaign_subscriptions, campaign_sendout_recipients, campaign_events, and campaign_suppressions while preserving aggregate campaign metrics.

Next steps