Bounce & Complaint Webhooks
OM_BounceWebhook exposes endpoints for inbound delivery status notifications from ESP providers.
Webhook URLs
| Provider | URL |
|---|---|
| Mailgun | https://yoursite.com/wp-json/omailer/v1/webhooks/mailgun |
| SendGrid | https://yoursite.com/wp-json/omailer/v1/webhooks/sendgrid |
| Postmark | https://yoursite.com/wp-json/omailer/v1/webhooks/postmark |
What Happens on Bounce
- Hard bounce → subscriber status set to
bounced; email added to suppression list with reasonbounce - Soft bounce → logged in
om_events; subscriber not changed on first occurrence - Complaint (spam report) → subscriber unsubscribed; email added to suppression list with reason
complaint
Custom Webhook Handler
php// Register a custom provider
add_filter( 'om_bounce_providers', function( array $providers ): array {
$providers['mymailprovider'] = [
'endpoint' => 'mymailprovider',
'handler' => 'my_webhook_handler',
];
return $providers;
});
function my_webhook_handler( WP_REST_Request $request ): void {
$body = $request->get_json_params();
if ( $body['event'] === 'bounce' ) {
OM_BounceWebhook::process_bounce( $body['email'], 'hard' );
}
}