| 95 | } |
| 96 | |
| 97 | func senderIdentityEventFirer(pub webhookpub.Publisher) senderidentity.EventFirer { |
| 98 | return func(ctx context.Context, domain, userID string, status senderidentity.Status, errMsg string) { |
| 99 | eventType := webhookpub.EventDomainSendingVerified |
| 100 | data := map[string]any{"domain": domain, "sending_status": string(status)} |
| 101 | if status == senderidentity.StatusFailed { |
| 102 | eventType = webhookpub.EventDomainSendingFailed |
| 103 | if errMsg != "" { |
| 104 | data["error"] = errMsg |
| 105 | } |
| 106 | } |
| 107 | pub.Publish(ctx, webhookpub.NewEvent(eventType, userID, data)) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func main() { |
| 112 | // Load .env file if present (development convenience, not required) |