untested: improved webhook event handling
This commit is contained in:
parent
66b14baee8
commit
b8bc00b68d
|
@ -44,20 +44,20 @@ public class WebhookController(ILogger<WebhookController> logger, ApplicationDbC
|
||||||
subscriber.UnsubscribeReason = webhookEvent.Response;
|
subscriber.UnsubscribeReason = webhookEvent.Response;
|
||||||
break;
|
break;
|
||||||
case WebhookEventType.Suspension:
|
case WebhookEventType.Suspension:
|
||||||
subscriber.Unsubscribed = true;
|
logger.LogWarning("Received Suspension event, you may have send from an unverifyied domain or exceeded your hourly rate.");
|
||||||
subscriber.UnsubscribeReason ??= "unknown";
|
return Ok();
|
||||||
break;
|
break;
|
||||||
case WebhookEventType.Unsubscribe:
|
case WebhookEventType.Unsubscribe:
|
||||||
subscriber.Unsubscribed = true;
|
subscriber.Unsubscribed = true;
|
||||||
subscriber.UnsubscribeReason ??= "User Unsubscribed";
|
subscriber.UnsubscribeReason = "User Unsubscribed";
|
||||||
break;
|
break;
|
||||||
case WebhookEventType.SpamComplaint:
|
case WebhookEventType.SpamComplaint:
|
||||||
subscriber.Unsubscribed = true;
|
subscriber.Unsubscribed = true;
|
||||||
subscriber.UnsubscribeReason ??= "User reported as Spam";
|
subscriber.UnsubscribeReason = "User reported as Spam";
|
||||||
break;
|
break;
|
||||||
case WebhookEventType.Reject:
|
case WebhookEventType.Reject:
|
||||||
subscriber.Unsubscribed = true;
|
subscriber.Unsubscribed = true;
|
||||||
subscriber.UnsubscribeReason ??= webhookEvent.Reason?.Humanize().Titleize() ?? "Rejected";
|
subscriber.UnsubscribeReason = webhookEvent.Reason?.Humanize().Titleize() ?? "Rejected";
|
||||||
break;
|
break;
|
||||||
case WebhookEventType.SoftBounce:
|
case WebhookEventType.SoftBounce:
|
||||||
case WebhookEventType.Click:
|
case WebhookEventType.Click:
|
||||||
|
|
Loading…
Reference in a new issue