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.

fix: handle quoted DB_URI and skip senderless group history messages

Aldino Kemald14e997191c7
diff --git a/src/.env.example b/src/.env.example
index e744f089..935aaa1d 100644
--- a/src/.env.example
+++ b/src/.env.example
@@ -8,8 +8,8 @@ APP_BASE_PATH=
APP_TRUSTED_PROXIES=0.0.0.0/0
# Database Settings
-DB_URI="file:storages/whatsapp.db?_foreign_keys=on"
-DB_KEYS_URI="file::memory:?cache=shared&_foreign_keys=on"
+DB_URI=file:storages/whatsapp.db?_foreign_keys=on
+DB_KEYS_URI=file::memory:?cache=shared&_foreign_keys=on
# WhatsApp Settings
WHATSAPP_AUTO_REPLY="Auto reply message"
diff --git a/src/config/settings.go b/src/config/settings.go
index 206cad8b..c15f432f 100644
--- a/src/config/settings.go
+++ b/src/config/settings.go
@@ -5,7 +5,7 @@ import (
)
var (
- AppVersion = "v8.3.1"
+ AppVersion = "v8.3.3"
AppPort = "3000"
AppHost = "0.0.0.0"
AppDebug = false
diff --git a/src/go.mod b/src/go.mod
index 5087e5ea..6a90432e 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -46,7 +46,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/klauspost/compress v1.18.4 // indirect
- github.com/mailru/easyjson v0.9.1 // indirect
+ github.com/mailru/easyjson v0.9.2 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.21 // indirect
@@ -70,7 +70,7 @@ require (
go.mau.fi/util v0.9.6 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.49.0 // indirect
- golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
+ golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
diff --git a/src/go.sum b/src/go.sum
index c656a70f..88680451 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -80,6 +80,8 @@ github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs=
github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
+github.com/mailru/easyjson v0.9.2 h1:dX8U45hQsZpxd80nLvDGihsQ/OxlvTkVUXH2r/8cb2M=
+github.com/mailru/easyjson v0.9.2/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mark3labs/mcp-go v0.45.0 h1:s0S8qR/9fWaQ3pHxz7pm1uQ0DrswoSnRIxKIjbiQtkc=
github.com/mark3labs/mcp-go v0.45.0/go.mod h1:YnJfOL382MIWDx1kMY+2zsRHU/q78dBg9aFb8W6Thdw=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
@@ -165,6 +167,8 @@ golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
+golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA=
+golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.37.0 h1:ZiRjArKI8GwxZOoEtUfhrBtaCN+4b/7709dlT6SSnQA=
golang.org/x/image v0.37.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
diff --git a/src/infrastructure/whatsapp/database.go b/src/infrastructure/whatsapp/database.go
index 77063c78..33b094ac 100644
--- a/src/infrastructure/whatsapp/database.go
+++ b/src/infrastructure/whatsapp/database.go
@@ -27,6 +27,9 @@ func InitWaDB(ctx context.Context, DBURI string) *sqlstore.Container {
// initDatabase creates and returns a database store container based on the configured URI
func initDatabase(ctx context.Context, dbLog waLog.Logger, DBURI string) (*sqlstore.Container, error) {
+ // Strip surrounding quotes that may come from .env file parsing
+ DBURI = strings.Trim(DBURI, `"'`)
+
if strings.HasPrefix(DBURI, "file:") {
return sqlstore.New(ctx, "sqlite3", DBURI, dbLog)
} else if strings.HasPrefix(DBURI, "postgres:") {
diff --git a/src/infrastructure/whatsapp/history_sync.go b/src/infrastructure/whatsapp/history_sync.go
index 1cb1cc6a..f185f7b6 100644
--- a/src/infrastructure/whatsapp/history_sync.go
+++ b/src/infrastructure/whatsapp/history_sync.go
@@ -187,6 +187,13 @@ func processConversationMessages(ctx context.Context, data *waHistorySync.Histor
}
}
} else {
+ // Check if this is a group chat — group messages must have a participant
+ // to identify the actual sender. Without it, we'd incorrectly store the
+ // group JID as the sender (see GitHub issue #609).
+ if jid.Server == "g.us" {
+ log.Warnf("Skipping group message %s in chat %s: no participant info available", messageID, chatJID)
+ continue
+ }
// For individual chats, use the chat JID as sender with full format
sender = jid.String() // Use full JID format for consistency
}