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
package whatsapp
import (
domainChatStorage "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/chatstorage"
"go.mau.fi/whatsmeow"
"go.mau.fi/whatsmeow/store/sqlstore"
)
// GetClient returns the current global client instance (alias for GetGlobalClient)
func GetClient() *whatsmeow.Client {
globalStateMu.RLock()
defer globalStateMu.RUnlock()
return cli
}
func getStoreContainers() (*sqlstore.Container, *sqlstore.Container) {
globalStateMu.RLock()
defer globalStateMu.RUnlock()
return db, keysDB
}
// InitializeDeviceManager creates the global DeviceManager if it doesn't exist.
func InitializeDeviceManager(storeContainer, keysStoreContainer *sqlstore.Container, chatStorageRepo domainChatStorage.IChatStorageRepository) *DeviceManager {
globalStateMu.Lock()
defer globalStateMu.Unlock()
if deviceManager == nil {
deviceManager = NewDeviceManager(storeContainer, keysStoreContainer, chatStorageRepo)
}
return deviceManager
}
// GetDeviceManager returns the global DeviceManager.
func GetDeviceManager() *DeviceManager {
globalStateMu.RLock()
defer globalStateMu.RUnlock()
return deviceManager
}