GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
Go botgogolanggolang-whatsappgolang-whatsapp-apirestrest-apiwhatsappwhatsapp-apiwhatsapp-api-gowhatsapp-multi-devicewhatsapp-web-multi-device
fix: log undecryptable messages instead of dropping them silently
Aldino Kemale3b6aa4f7ae7
diff --git a/src/infrastructure/whatsapp/event_handler.go b/src/infrastructure/whatsapp/event_handler.goindex 7f047860..06c7480d 100644--- a/src/infrastructure/whatsapp/event_handler.go+++ b/src/infrastructure/whatsapp/event_handler.go@@ -53,6 +53,8 @@ func handler(ctx context.Context, instance *DeviceInstance, rawEvt any) {handleStreamReplaced(ctx)case *events.Message:handleMessage(ctx, evt, chatStorageRepo, client)+ case *events.UndecryptableMessage:+ handleUndecryptableMessage(evt)case *events.Receipt:handleReceipt(ctx, evt, instance.JID(), client)case *events.Archive:@@ -84,6 +86,20 @@ func handler(ctx context.Context, instance *DeviceInstance, rawEvt any) {instance.UpdateStateFromClient()}+// handleUndecryptableMessage surfaces messages that arrived but could not be+// decrypted. They carry no plaintext, so there is nothing to store or forward,+// but dropping them without a trace makes the common "messages from this+// contact never arrive" report impossible to diagnose.+func handleUndecryptableMessage(evt *events.UndecryptableMessage) {+ log.Warnf("Undecryptable message %s from %s (unavailable: %v, type: %q, fail mode: %q). No webhook or storage entry is produced for it.",+ evt.Info.ID,+ evt.Info.SourceString(),+ evt.IsUnavailable,+ evt.UnavailableType,+ evt.DecryptFailMode,+ )+}+func handleDeleteForMe(ctx context.Context, evt *events.DeleteForMe, chatStorageRepo domainChatStorage.IChatStorageRepository, deviceID string, client *whatsmeow.Client) {log.Infof("Deleted message %s for %s", evt.MessageID, evt.SenderJID.String())