Skip to content

GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.

chore: update dependencies and bump app version to v7.10.1

Aldino Kemalcac76e0dd426
diff --git a/src/config/settings.go b/src/config/settings.go
index ce51dcdc..d323d414 100644
--- a/src/config/settings.go
+++ b/src/config/settings.go
@@ -5,7 +5,7 @@ import (
)
var (
- AppVersion = "v7.10.0"
+ AppVersion = "v7.10.1"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"
diff --git a/src/go.mod b/src/go.mod
index 492ee62d..b89b115e 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -21,7 +21,7 @@ require (
github.com/stretchr/testify v1.11.1
github.com/valyala/fasthttp v1.68.0
go.mau.fi/libsignal v0.2.1
- go.mau.fi/whatsmeow v0.0.0-20251127132918-b9ac3d51d746
+ go.mau.fi/whatsmeow v0.0.0-20251203212742-364369929a75
golang.org/x/image v0.33.0
google.golang.org/protobuf v1.36.10
)
@@ -46,7 +46,7 @@ require (
github.com/gofiber/utils v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
- github.com/klauspost/compress v1.18.1 // indirect
+ github.com/klauspost/compress v1.18.2 // indirect
github.com/mailru/easyjson v0.9.1 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
diff --git a/src/go.sum b/src/go.sum
index e1a1a27d..ab0bce28 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -71,6 +71,8 @@ github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcI
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
+github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
+github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
@@ -156,6 +158,8 @@ go.mau.fi/util v0.9.3 h1:aqNF8KDIN8bFpFbybSk+mEBil7IHeBwlujfyTnvP0uU=
go.mau.fi/util v0.9.3/go.mod h1:krWWfBM1jWTb5f8NCa2TLqWMQuM81X7TGQjhMjBeXmQ=
go.mau.fi/whatsmeow v0.0.0-20251127132918-b9ac3d51d746 h1:51hAK0a+KA4BD7MgqfVd6dbJd5cJBhotOlhWUybYCn0=
go.mau.fi/whatsmeow v0.0.0-20251127132918-b9ac3d51d746/go.mod h1:5aYaEa3FF5e5XWsA8Xa80ttUXZvb6HyaBGgo2SfzUkE=
+go.mau.fi/whatsmeow v0.0.0-20251203212742-364369929a75 h1:SqZYh7ssKBuBtC6g9Mvj5i0roB34WpUWzLNXtQ9azUI=
+go.mau.fi/whatsmeow v0.0.0-20251203212742-364369929a75/go.mod h1:5aYaEa3FF5e5XWsA8Xa80ttUXZvb6HyaBGgo2SfzUkE=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
diff --git a/src/infrastructure/chatstorage/sqlite_repository.go b/src/infrastructure/chatstorage/sqlite_repository.go
index da143577..1f91629d 100644
--- a/src/infrastructure/chatstorage/sqlite_repository.go
+++ b/src/infrastructure/chatstorage/sqlite_repository.go
@@ -8,8 +8,10 @@ import (
"time"
domainChatStorage "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/chatstorage"
+ "github.com/aldinokemal/go-whatsapp-web-multidevice/infrastructure/whatsapp"
"github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/utils"
"github.com/sirupsen/logrus"
+ "go.mau.fi/whatsmeow"
"go.mau.fi/whatsmeow/types"
"go.mau.fi/whatsmeow/types/events"
)
@@ -24,6 +26,37 @@ func NewStorageRepository(db *sql.DB) domainChatStorage.IChatStorageRepository {
return &SQLiteRepository{db: db}
}
+// normalizeJIDFromLID converts @lid JIDs to their corresponding @s.whatsapp.net JIDs
+// Returns the original JID if it's not an @lid or if LID lookup fails
+func normalizeJIDFromLID(ctx context.Context, jid types.JID, client *whatsmeow.Client) types.JID {
+ // Only process @lid JIDs
+ if jid.Server != "lid" {
+ return jid
+ }
+
+ // Safety check
+ if client == nil || client.Store == nil || client.Store.LIDs == nil {
+ logrus.Warnf("Cannot resolve LID %s: client not available", jid.String())
+ return jid
+ }
+
+ // Attempt to get the phone number for this LID
+ pn, err := client.Store.LIDs.GetPNForLID(ctx, jid)
+ if err != nil {
+ logrus.Debugf("Failed to resolve LID %s to phone number: %v", jid.String(), err)
+ return jid
+ }
+
+ // If we got a valid phone number, use it
+ if !pn.IsEmpty() {
+ logrus.Debugf("Resolved LID %s to phone number %s", jid.String(), pn.String())
+ return pn
+ }
+
+ // Fallback to original JID
+ return jid
+}
+
// StoreChat creates or updates a chat
func (r *SQLiteRepository) StoreChat(chat *domainChatStorage.Chat) error {
now := time.Now()
@@ -511,13 +544,19 @@ func (r *SQLiteRepository) CreateMessage(ctx context.Context, evt *events.Messag
return nil
}
- // Extract chat and sender information
- chatJID := evt.Info.Chat.String()
+ // Get WhatsApp client for LID resolution
+ client := whatsapp.GetClient()
+
+ // Normalize chat and sender JIDs (convert @lid to @s.whatsapp.net)
+ normalizedChatJID := normalizeJIDFromLID(ctx, evt.Info.Chat, client)
+ normalizedSender := normalizeJIDFromLID(ctx, evt.Info.Sender, client)
+
+ chatJID := normalizedChatJID.String()
// Store the full sender JID (user@server) to ensure consistency between received and sent messages
- sender := evt.Info.Sender.String()
+ sender := normalizedSender.String()
// Get appropriate chat name using pushname if available
- chatName := r.GetChatNameWithPushName(evt.Info.Chat, chatJID, evt.Info.Sender.User, evt.Info.PushName)
+ chatName := r.GetChatNameWithPushName(normalizedChatJID, chatJID, normalizedSender.User, evt.Info.PushName)
// Get existing chat to preserve ephemeral_expiration if needed
existingChat, err := r.GetChat(chatJID)
@@ -642,10 +681,15 @@ func (r *SQLiteRepository) StoreSentMessageWithContext(ctx context.Context, mess
return fmt.Errorf("invalid JID format: %w", err)
}
- chatJID := jid.String()
+ // Get WhatsApp client for LID resolution
+ client := whatsapp.GetClient()
+
+ // Normalize recipient JID (convert @lid to @s.whatsapp.net)
+ normalizedJID := normalizeJIDFromLID(ctx, jid, client)
+ chatJID := normalizedJID.String()
// Get chat name (no pushname available for sent messages)
- chatName := r.GetChatNameWithPushName(jid, chatJID, jid.User, "")
+ chatName := r.GetChatNameWithPushName(normalizedJID, chatJID, normalizedJID.User, "")
// Check context again before database operations
select {