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.

feat: add account validation flag

Aldino Kemal9e8c3fd8eab8
diff --git a/src/cmd/root.go b/src/cmd/root.go
index 1fcc79bb..27fe6508 100644
--- a/src/cmd/root.go
+++ b/src/cmd/root.go
@@ -47,6 +47,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&config.AppBasicAuthCredential, "basic-auth", "b", config.AppBasicAuthCredential, "basic auth credential | -b=yourUsername:yourPassword")
rootCmd.PersistentFlags().StringVarP(&config.WhatsappAutoReplyMessage, "autoreply", "", config.WhatsappAutoReplyMessage, `auto reply when received message --autoreply <string> | example: --autoreply="Don't reply this message"`)
rootCmd.PersistentFlags().StringVarP(&config.WhatsappWebhook, "webhook", "w", config.WhatsappWebhook, `forward event to webhook --webhook <string> | example: --webhook="https://yourcallback.com/callback"`)
+ rootCmd.PersistentFlags().BoolVarP(&config.WhatsappAccountValidation, "account-validation", "", config.WhatsappAccountValidation, `enable or disable account validation --account-validation <true/false> | example: --account-validation=true`)
}
func runRest(_ *cobra.Command, _ []string) {
diff --git a/src/config/settings.go b/src/config/settings.go
index 136cbe4f..08f5e665 100644
--- a/src/config/settings.go
+++ b/src/config/settings.go
@@ -5,7 +5,7 @@ import (
)
var (
- AppVersion = "v4.16.0"
+ AppVersion = "v4.17.0"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"
@@ -26,4 +26,5 @@ var (
WhatsappSettingMaxVideoSize int64 = 100000000 // 100MB
WhatsappTypeUser = "@s.whatsapp.net"
WhatsappTypeGroup = "@g.us"
+ WhatsappAccountValidation = true
)
diff --git a/src/pkg/whatsapp/whatsapp.go b/src/pkg/whatsapp/whatsapp.go
index 5fc2fcdc..7570d70b 100644
--- a/src/pkg/whatsapp/whatsapp.go
+++ b/src/pkg/whatsapp/whatsapp.go
@@ -137,7 +137,7 @@ func IsOnWhatsapp(waCli *whatsmeow.Client, jid string) bool {
func ValidateJidWithLogin(waCli *whatsmeow.Client, jid string) (types.JID, error) {
MustLogin(waCli)
- if !IsOnWhatsapp(waCli, jid) {
+ if config.WhatsappAccountValidation && !IsOnWhatsapp(waCli, jid) {
return types.JID{}, pkgError.InvalidJID(fmt.Sprintf("Phone %s is not on whatsapp", jid))
}