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: set device id as string

Aldino Kemalc0672d93f996
diff --git a/services/user_service_impl.go b/services/user_service_impl.go
index 253add1c..ea38bb81 100644
--- a/services/user_service_impl.go
+++ b/services/user_service_impl.go
@@ -41,7 +41,7 @@ func (service UserServiceImpl) UserInfo(_ *fiber.Ctx, request structs.UserInfoRe
device = append(device, structs.UserInfoResponseDataDevice{
User: j.User,
Agent: j.Agent,
- Device: j.Device,
+ Device: utils.GetPlatformName(int(j.Device)),
Server: j.Server,
AD: j.AD,
})
diff --git a/structs/send_struct.go b/structs/send_struct.go
index 23298c87..50df8bef 100644
--- a/structs/send_struct.go
+++ b/structs/send_struct.go
@@ -14,7 +14,7 @@ type UserInfoRequest struct {
type UserInfoResponseDataDevice struct {
User string
Agent uint8
- Device uint8
+ Device string
Server string
AD bool
}
diff --git a/utils/whatsapp.go b/utils/whatsapp.go
index 5d4b924f..ce1824f7 100644
--- a/utils/whatsapp.go
+++ b/utils/whatsapp.go
@@ -29,6 +29,35 @@ var (
const logLevel = "DEBUG"
+func GetPlatformName(deviceID int) string {
+ switch deviceID {
+ case 2:
+ return "UNKNOWN"
+ case 3:
+ return "CHROME"
+ case 4:
+ return "FIREFOX"
+ case 5:
+ return "IE"
+ case 6:
+ return "OPERA"
+ case 7:
+ return "SAFARI"
+ case 8:
+ return "EDGE"
+ case 9:
+ return "DESKTOP"
+ case 10:
+ return "IPAD"
+ case 11:
+ return "ANDROID_TABLET"
+ case 12:
+ return "OHANA"
+ default:
+ return "UNKNOWN"
+ }
+}
+
func ParseJID(arg string) (types.JID, bool) {
if arg[0] == '+' {
arg = arg[1:]