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 group participants list and CSV export functionality

Aldino Kemal736bfc8238b0
diff --git a/src/domains/group/group.go b/src/domains/group/group.go
index 21e23a00..9b3021ae 100644
--- a/src/domains/group/group.go
+++ b/src/domains/group/group.go
@@ -34,6 +34,25 @@ type ParticipantStatus struct {
Message string `json:"message"`
}
+type GetGroupParticipantsRequest struct {
+ GroupID string `json:"group_id" query:"group_id"`
+}
+
+type GroupParticipant struct {
+ JID string `json:"jid"`
+ PhoneNumber string `json:"phone_number"`
+ LID string `json:"lid,omitempty"`
+ DisplayName string `json:"display_name,omitempty"`
+ IsAdmin bool `json:"is_admin"`
+ IsSuperAdmin bool `json:"is_super_admin"`
+}
+
+type GetGroupParticipantsResponse struct {
+ GroupID string `json:"group_id"`
+ Name string `json:"name"`
+ Participants []GroupParticipant `json:"participants"`
+}
+
type GetGroupRequestParticipantsRequest struct {
GroupID string `json:"group_id" query:"group_id"`
}
diff --git a/src/domains/group/interfaces.go b/src/domains/group/interfaces.go
index 45c80224..2ba67f70 100644
--- a/src/domains/group/interfaces.go
+++ b/src/domains/group/interfaces.go
@@ -17,6 +17,7 @@ type IGroupManagement interface {
// IGroupParticipants handles group participant operations
type IGroupParticipants interface {
ManageParticipant(ctx context.Context, request ParticipantRequest) (result []ParticipantStatus, err error)
+ GetGroupParticipants(ctx context.Context, request GetGroupParticipantsRequest) (response GetGroupParticipantsResponse, err error)
GetGroupRequestParticipants(ctx context.Context, request GetGroupRequestParticipantsRequest) (result []GetGroupRequestParticipantsResponse, err error)
ManageGroupRequestParticipants(ctx context.Context, request GroupRequestParticipantsRequest) (result []ParticipantStatus, err error)
}
diff --git a/src/go.mod b/src/go.mod
index 716fe458..1f2c7445 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -12,18 +12,18 @@ require (
github.com/gofiber/websocket/v2 v2.2.1
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
- github.com/mark3labs/mcp-go v0.39.1
+ github.com/mark3labs/mcp-go v0.40.0
github.com/mattn/go-sqlite3 v1.14.32
github.com/sirupsen/logrus v1.9.3
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/cobra v1.10.1
- github.com/spf13/viper v1.20.1
+ github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
- github.com/valyala/fasthttp v1.65.0
+ github.com/valyala/fasthttp v1.66.0
go.mau.fi/libsignal v0.2.0
- go.mau.fi/whatsmeow v0.0.0-20250905121447-8d6da61ecbfa
- golang.org/x/image v0.30.0
- google.golang.org/protobuf v1.36.8
+ go.mau.fi/whatsmeow v0.0.0-20250919124702-c8bdfd36d05e
+ golang.org/x/image v0.31.0
+ google.golang.org/protobuf v1.36.9
)
require (
@@ -45,7 +45,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
- github.com/mailru/easyjson v0.9.0 // 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
github.com/mattn/go-runewidth v0.0.16 // indirect
@@ -54,22 +54,23 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/zerolog v1.34.0 // indirect
- github.com/sagikazarmark/locafero v0.10.0 // indirect
+ github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
- github.com/spf13/afero v1.14.0 // indirect
- github.com/spf13/cast v1.9.2 // indirect
+ github.com/spf13/afero v1.15.0 // indirect
+ github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/vektah/gqlparser/v2 v2.5.30 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
- go.mau.fi/util v0.9.0 // indirect
- golang.org/x/crypto v0.41.0 // indirect
- golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect
- golang.org/x/net v0.43.0 // indirect
- golang.org/x/sys v0.35.0 // indirect
- golang.org/x/text v0.28.0 // indirect
+ go.mau.fi/util v0.9.1 // indirect
+ go.yaml.in/yaml/v3 v3.0.4 // indirect
+ golang.org/x/crypto v0.42.0 // indirect
+ golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
+ golang.org/x/net v0.44.0 // indirect
+ golang.org/x/sys v0.36.0 // indirect
+ golang.org/x/text v0.29.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/src/go.sum b/src/go.sum
index 91c72ac0..ac163d6e 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -70,6 +70,8 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
+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/mark3labs/mcp-go v0.36.0 h1:rIZaijrRYPeSbJG8/qNDe0hWlGrCJ7FWHNMz2SQpTis=
github.com/mark3labs/mcp-go v0.36.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
github.com/mark3labs/mcp-go v0.37.0 h1:BywvZLPRT6Zx6mMG/MJfxLSZQkTGIcJSEGKsvr4DsoQ=
@@ -78,6 +80,8 @@ github.com/mark3labs/mcp-go v0.38.0 h1:E5tmJiIXkhwlV0pLAwAT0O5ZjUZSISE/2Jxg+6vpq
github.com/mark3labs/mcp-go v0.38.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
github.com/mark3labs/mcp-go v0.39.1 h1:2oPxk7aDbQhouakkYyKl2T4hKFU1c6FDaubWyGyVE1k=
github.com/mark3labs/mcp-go v0.39.1/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
+github.com/mark3labs/mcp-go v0.40.0 h1:M0oqK412OHBKut9JwXSsj4KanSmEKpzoW8TcxoPOkAU=
+github.com/mark3labs/mcp-go v0.40.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
@@ -114,6 +118,8 @@ github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.10.0 h1:FM8Cv6j2KqIhM2ZK7HZjm4mpj9NBktLgowT1aN9q5Cc=
github.com/sagikazarmark/locafero v0.10.0/go.mod h1:Ieo3EUsjifvQu4NZwV5sPd4dwvu0OCgEQV7vjc9yDjw=
+github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
+github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 h1:qIQ0tWF9vxGtkJa24bR+2i53WBCz1nW/Pc47oVYauC4=
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
@@ -124,8 +130,12 @@ github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrel
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
+github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
+github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
+github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
+github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
@@ -138,6 +148,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
+github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
+github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -153,6 +165,8 @@ github.com/valyala/fasthttp v1.64.0 h1:QBygLLQmiAyiXuRhthf0tuRkqAFcrC42dckN2S+N3
github.com/valyala/fasthttp v1.64.0/go.mod h1:dGmFxwkWXSK0NbOSJuF7AMVzU+lkHz0wQVvVITv2UQA=
github.com/valyala/fasthttp v1.65.0 h1:j/u3uzFEGFfRxw79iYzJN+TteTJwbYkru9uDp3d0Yf8=
github.com/valyala/fasthttp v1.65.0/go.mod h1:P/93/YkKPMsKSnATEeELUCkG8a7Y+k99uxNHVbKINr4=
+github.com/valyala/fasthttp v1.66.0 h1:M87A0Z7EayeyNaV6pfO3tUTUiYO0dZfEJnRGXTVNuyU=
+github.com/valyala/fasthttp v1.66.0/go.mod h1:Y4eC+zwoocmXSVCB1JmhNbYtS7tZPRI2ztPB72EVObs=
github.com/vektah/gqlparser/v2 v2.5.30 h1:EqLwGAFLIzt1wpx1IPpY67DwUujF1OfzgEyDsLrN6kE=
github.com/vektah/gqlparser/v2 v2.5.30/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
@@ -168,6 +182,8 @@ go.mau.fi/util v0.8.8 h1:OnuEEc/sIJFhnq4kFggiImUpcmnmL/xpvQMRu5Fiy5c=
go.mau.fi/util v0.8.8/go.mod h1:Y/kS3loxTEhy8Vill513EtPXr+CRDdae+Xj2BXXMy/c=
go.mau.fi/util v0.9.0 h1:ya3s3pX+Y8R2fgp0DbE7a0o3FwncoelDX5iyaeVE8ls=
go.mau.fi/util v0.9.0/go.mod h1:pdL3lg2aaeeHIreGXNnPwhJPXkXdc3ZxsI6le8hOWEA=
+go.mau.fi/util v0.9.1 h1:A+XKHRsjKkFi2qOm4RriR1HqY2hoOXNS3WFHaC89r2Y=
+go.mau.fi/util v0.9.1/go.mod h1:M0bM9SyaOWJniaHs9hxEzz91r5ql6gYq6o1q5O1SsjQ=
go.mau.fi/whatsmeow v0.0.0-20250801095850-a23b35dea4be h1:gtveTRdwlG77JuhAWN0yfGXYacR+KkloWvQcLMLlUsQ=
go.mau.fi/whatsmeow v0.0.0-20250801095850-a23b35dea4be/go.mod h1:ltDTXUgOAT7LcFKp11H+5S7UY7+xHBMGzNJcv3dLHGk=
go.mau.fi/whatsmeow v0.0.0-20250807072145-72ce90b82194 h1:/ow/oKzvxxwJEyCJ4bq8U7W2yar2f0HSq89yto+sD9Q=
@@ -176,6 +192,10 @@ go.mau.fi/whatsmeow v0.0.0-20250816112049-1b82e4b52df1 h1:CP2hnvzEr15aBAWimDZCJ/
go.mau.fi/whatsmeow v0.0.0-20250816112049-1b82e4b52df1/go.mod h1:xD0DR3s4T6PDd3BzgQG05AzLWxdKCmnvdCP3UuQvn9w=
go.mau.fi/whatsmeow v0.0.0-20250905121447-8d6da61ecbfa h1:+77BnZUz3DVMHPUil1YFc2spz7dtuqHaEt2nzWVgX0s=
go.mau.fi/whatsmeow v0.0.0-20250905121447-8d6da61ecbfa/go.mod h1:Xn2RtGFtEJPCAr56wsWpauBIQAC0S0+v81iyKmrd708=
+go.mau.fi/whatsmeow v0.0.0-20250919124702-c8bdfd36d05e h1:+o9+K5Qyo/490H4NyPVA0Es+aEzmmjaK37/437hV2LM=
+go.mau.fi/whatsmeow v0.0.0-20250919124702-c8bdfd36d05e/go.mod h1:dvltpCF0rOHbbur25DHbQ3Ovi747z2Pm11S2M7p1T74=
+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=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
@@ -186,17 +206,23 @@ golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
+golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
+golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4=
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc=
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a h1:Y+7uR/b1Mw2iSXZ3G//1haIiSElDQZ8KWh0h+sZPG90=
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a/go.mod h1:rT6SFzZ7oxADUDx58pcaKFTcZ+inxAa9fTrYx/uVYwg=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
+golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
+golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.29.0 h1:HcdsyR4Gsuys/Axh0rDEmlBmB68rW1U9BUdB3UVHsas=
golang.org/x/image v0.29.0/go.mod h1:RVJROnf3SLK8d26OW91j4FrIHGbsJ8QnbEocVTOWQDA=
golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4=
golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c=
+golang.org/x/image v0.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
+golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
@@ -215,6 +241,8 @@ golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
+golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
+golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -240,6 +268,8 @@ golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
+golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
+golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -262,6 +292,8 @@ golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
+golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
+golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
@@ -275,6 +307,8 @@ google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
+google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
+google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/src/ui/rest/group.go b/src/ui/rest/group.go
index 269522a0..bcac3c7c 100644
--- a/src/ui/rest/group.go
+++ b/src/ui/rest/group.go
@@ -1,7 +1,10 @@
package rest
import (
+ "bytes"
+ "encoding/csv"
"fmt"
+ "strings"
"github.com/sirupsen/logrus"
@@ -22,6 +25,8 @@ func InitRestGroup(app fiber.Router, service domainGroup.IGroupUsecase) Group {
app.Get("/group/info-from-link", rest.GetGroupInfoFromLink)
app.Get("/group/info", rest.GroupInfo)
app.Post("/group/leave", rest.LeaveGroup)
+ app.Get("/group/participants", rest.ListParticipants)
+ app.Get("/group/participants/export", rest.ExportParticipants)
app.Post("/group/participants", rest.AddParticipants)
app.Post("/group/participants/remove", rest.DeleteParticipants)
app.Post("/group/participants/promote", rest.PromoteParticipants)
@@ -106,6 +111,86 @@ func (controller *Group) CreateGroup(c *fiber.Ctx) error {
},
})
}
+
+func (controller *Group) ListParticipants(c *fiber.Ctx) error {
+ var request domainGroup.GetGroupParticipantsRequest
+ err := c.QueryParser(&request)
+ utils.PanicIfNeeded(err)
+
+ if request.GroupID == "" {
+ return c.Status(fiber.StatusBadRequest).JSON(utils.ResponseData{
+ Status: 400,
+ Code: "INVALID_GROUP_ID",
+ Message: "Group ID cannot be empty",
+ })
+ }
+
+ utils.SanitizePhone(&request.GroupID)
+
+ result, err := controller.Service.GetGroupParticipants(c.UserContext(), request)
+ utils.PanicIfNeeded(err)
+
+ return c.JSON(utils.ResponseData{
+ Status: 200,
+ Code: "SUCCESS",
+ Message: "Success getting group participants",
+ Results: result,
+ })
+}
+
+func (controller *Group) ExportParticipants(c *fiber.Ctx) error {
+ var request domainGroup.GetGroupParticipantsRequest
+ err := c.QueryParser(&request)
+ utils.PanicIfNeeded(err)
+
+ if request.GroupID == "" {
+ return c.Status(fiber.StatusBadRequest).JSON(utils.ResponseData{
+ Status: 400,
+ Code: "INVALID_GROUP_ID",
+ Message: "Group ID cannot be empty",
+ })
+ }
+
+ utils.SanitizePhone(&request.GroupID)
+
+ result, err := controller.Service.GetGroupParticipants(c.UserContext(), request)
+ utils.PanicIfNeeded(err)
+
+ var buffer bytes.Buffer
+ writer := csv.NewWriter(&buffer)
+
+ utils.PanicIfNeeded(writer.Write([]string{"participant_jid", "phone_number", "lid", "display_name", "role"}))
+
+ for _, participant := range result.Participants {
+ role := "member"
+ if participant.IsSuperAdmin {
+ role = "super_admin"
+ } else if participant.IsAdmin {
+ role = "admin"
+ }
+
+ record := []string{
+ participant.JID,
+ participant.PhoneNumber,
+ participant.LID,
+ participant.DisplayName,
+ role,
+ }
+
+ utils.PanicIfNeeded(writer.Write(record))
+ }
+
+ writer.Flush()
+ utils.PanicIfNeeded(writer.Error())
+
+ fileName := fmt.Sprintf("group-%s-participants.csv", strings.ReplaceAll(result.GroupID, "@", "_"))
+
+ c.Type("text/csv; charset=utf-8")
+ c.Attachment(fileName)
+
+ return c.Send(buffer.Bytes())
+}
+
func (controller *Group) AddParticipants(c *fiber.Ctx) error {
return controller.manageParticipants(c, whatsmeow.ParticipantChangeAdd, "Success add participants")
}
diff --git a/src/usecase/group.go b/src/usecase/group.go
index 79e6cbad..1d55871e 100644
--- a/src/usecase/group.go
+++ b/src/usecase/group.go
@@ -140,6 +140,41 @@ func (service serviceGroup) ManageParticipant(ctx context.Context, request domai
return result, nil
}
+func (service serviceGroup) GetGroupParticipants(ctx context.Context, request domainGroup.GetGroupParticipantsRequest) (response domainGroup.GetGroupParticipantsResponse, err error) {
+ if err = validations.ValidateGetGroupParticipants(ctx, request); err != nil {
+ return response, err
+ }
+
+ groupJID, err := utils.ValidateJidWithLogin(whatsapp.GetClient(), request.GroupID)
+ if err != nil {
+ return response, err
+ }
+
+ groupInfo, err := whatsapp.GetClient().GetGroupInfo(groupJID)
+ if err != nil {
+ return response, err
+ }
+
+ response.GroupID = groupJID.String()
+ if groupInfo != nil {
+ response.Name = groupInfo.GroupName.Name
+ for _, participant := range groupInfo.Participants {
+ participantData := domainGroup.GroupParticipant{
+ JID: participant.JID.String(),
+ PhoneNumber: participant.PhoneNumber.String(),
+ LID: participant.LID.String(),
+ DisplayName: participant.DisplayName,
+ IsAdmin: participant.IsAdmin,
+ IsSuperAdmin: participant.IsSuperAdmin,
+ }
+
+ response.Participants = append(response.Participants, participantData)
+ }
+ }
+
+ return response, nil
+}
+
func (service serviceGroup) GetGroupRequestParticipants(ctx context.Context, request domainGroup.GetGroupRequestParticipantsRequest) (result []domainGroup.GetGroupRequestParticipantsResponse, err error) {
if err = validations.ValidateGetGroupRequestParticipants(ctx, request); err != nil {
return result, err
diff --git a/src/usecase/user.go b/src/usecase/user.go
index 5b995578..caae3840 100644
--- a/src/usecase/user.go
+++ b/src/usecase/user.go
@@ -117,10 +117,10 @@ func (service serviceUser) Avatar(ctx context.Context, request domainUser.Avatar
}
-func (service serviceUser) MyListGroups(_ context.Context) (response domainUser.MyListGroupsResponse, err error) {
+func (service serviceUser) MyListGroups(ctx context.Context) (response domainUser.MyListGroupsResponse, err error) {
utils.MustLogin(whatsapp.GetClient())
- groups, err := whatsapp.GetClient().GetJoinedGroups()
+ groups, err := whatsapp.GetClient().GetJoinedGroups(ctx)
if err != nil {
return
}
diff --git a/src/validations/group_validation.go b/src/validations/group_validation.go
index 9a035610..2f23663e 100644
--- a/src/validations/group_validation.go
+++ b/src/validations/group_validation.go
@@ -73,6 +73,18 @@ func ValidateParticipant(ctx context.Context, request domainGroup.ParticipantReq
return nil
}
+func ValidateGetGroupParticipants(ctx context.Context, request domainGroup.GetGroupParticipantsRequest) error {
+ err := validation.ValidateStructWithContext(ctx, &request,
+ validation.Field(&request.GroupID, validation.Required),
+ )
+
+ if err != nil {
+ return pkgError.ValidationError(err.Error())
+ }
+
+ return nil
+}
+
func ValidateGetGroupRequestParticipants(ctx context.Context, request domainGroup.GetGroupRequestParticipantsRequest) error {
err := validation.ValidateStructWithContext(ctx, &request,
validation.Field(&request.GroupID, validation.Required),
diff --git a/src/views/components/GroupList.js b/src/views/components/GroupList.js
index e37a31f0..87b3426d 100644
--- a/src/views/components/GroupList.js
+++ b/src/views/components/GroupList.js
@@ -1,5 +1,8 @@
+import GroupListParticipants from "./GroupListParticipants.js";
+
export default {
name: 'ListGroup',
+ components: { GroupListParticipants },
props: ['connected'],
data() {
return {
@@ -7,7 +10,7 @@ export default {
selectedGroupId: null,
requestedMembers: [],
loadingRequestedMembers: false,
- processingMember: null
+ processingMember: null,
}
},
computed: {
@@ -111,6 +114,27 @@ export default {
showErrorInfo(errorMessage);
}
},
+ async handleSeeParticipants(group) {
+ if (!group || !group.JID) return;
+
+ this.selectedGroupId = group.JID;
+ $('#modalGroupList').modal('hide');
+
+ try {
+ await this.$refs.participantsModal.open(group);
+ } catch (error) {
+ const errorMessage = error?.message || 'Failed to fetch participants';
+ showErrorInfo(errorMessage);
+ $('#modalGroupList').modal('show');
+ }
+ },
+ handleExportParticipants(group) {
+ if (!group || !group.JID) return;
+
+ const baseURL = (window.http && window.http.defaults && window.http.defaults.baseURL) ? window.http.defaults.baseURL : '';
+ const exportUrl = `${baseURL}/group/participants/export?group_id=${encodeURIComponent(group.JID)}`;
+ window.open(exportUrl, '_blank');
+ },
formatJID(jid) {
return jid ? jid.split('@')[0] : '';
},
@@ -119,6 +143,9 @@ export default {
// open modal again
this.openModal();
},
+ handleParticipantsClosed() {
+ $('#modalGroupList').modal('show');
+ },
async handleProcessRequest(member, action) {
if (!this.selectedGroupId || !member) return;
@@ -188,6 +215,8 @@ export default {
<td>{{ formatDate(g.GroupCreated) }}</td>
<td>
<div style="display: flex; gap: 8px; align-items: center;">
+ <button class="ui blue tiny button" @click="handleSeeParticipants(g)">Participants</button>
+ <button class="ui grey tiny button" @click="handleExportParticipants(g)">Export CSV</button>
<button v-if="isAdmin(g)" class="ui green tiny button" @click="handleSeeRequestedMember(g.JID)">Requested Members</button>
<button class="ui red tiny button" @click="handleLeaveGroup(g.JID)">Leave</button>
</div>
@@ -197,7 +226,9 @@ export default {
</table>
</div>
</div>
-
+
+ <group-list-participants ref="participantsModal" @closed="handleParticipantsClosed"></group-list-participants>
+
<!-- Requested Members Modal -->
<div class="ui modal" id="modalRequestedMembers">
<i class="close icon"></i>
diff --git a/src/views/components/GroupListParticipants.js b/src/views/components/GroupListParticipants.js
new file mode 100644
index 00000000..6d281fb9
--- /dev/null
+++ b/src/views/components/GroupListParticipants.js
@@ -0,0 +1,144 @@
+export default {
+ name: 'GroupListParticipants',
+ emits: ['closed'],
+ data() {
+ return {
+ selectedGroup: null,
+ loading: false,
+ participants: [],
+ };
+ },
+ methods: {
+ async open(group) {
+ if (!group || !group.JID) {
+ throw new Error('Invalid group data');
+ }
+
+ this.selectedGroup = {
+ id: group.JID,
+ name: group.Name || this.formatJID(group.JID),
+ };
+ this.loading = true;
+ this.participants = [];
+
+ try {
+ const response = await window.http.get(`/group/participants?group_id=${encodeURIComponent(group.JID)}`);
+ const results = response.data.results || {};
+ this.participants = results.participants || [];
+ if (results.name) {
+ this.selectedGroup.name = results.name;
+ }
+ this.loading = false;
+ this.showModal();
+ } catch (error) {
+ this.loading = false;
+ this.selectedGroup = null;
+
+ if (error.response && error.response.data && error.response.data.message) {
+ throw new Error(error.response.data.message);
+ }
+ throw new Error(error.message || 'Failed to fetch participants');
+ }
+ },
+ close() {
+ this.hideModal();
+ },
+ showModal() {
+ if (!this.$refs.modal) return;
+ $(this.$refs.modal).modal('show');
+ },
+ hideModal() {
+ if (!this.$refs.modal) return;
+ $(this.$refs.modal).modal('hide');
+ },
+ handleHidden() {
+ this.selectedGroup = null;
+ this.participants = [];
+ this.$emit('closed');
+ },
+ formatJID(jid) {
+ if (!jid) return '';
+ return jid.split('@')[0];
+ },
+ formatParticipantPhone(participant) {
+ if (!participant) return '';
+ if (participant.phone_number) {
+ return this.formatJID(participant.phone_number);
+ }
+ return this.formatJID(participant.jid);
+ },
+ getParticipantRole(participant) {
+ if (!participant) return 'Member';
+ if (participant.is_super_admin) return 'Super Admin';
+ if (participant.is_admin) return 'Admin';
+ return 'Member';
+ },
+ getParticipantRoleColor(participant) {
+ if (!participant) return 'grey';
+ if (participant.is_super_admin) return 'red';
+ if (participant.is_admin) return 'orange';
+ return 'teal';
+ },
+ },
+ mounted() {
+ if (!this.$refs.modal) return;
+ $(this.$refs.modal).modal({
+ autofocus: false,
+ observeChanges: true,
+ onHidden: () => {
+ this.handleHidden();
+ },
+ });
+ },
+ template: `
+ <div class="ui modal" ref="modal">
+ <i class="close icon"></i>
+ <div class="header">
+ Group Participants
+ <div class="sub header" v-if="selectedGroup && selectedGroup.name">{{ selectedGroup.name }}</div>
+ </div>
+ <div class="content">
+ <div v-if="loading" class="ui active centered inline loader"></div>
+
+ <div v-else-if="!participants.length" class="ui info message">
+ <div class="header">No Participants Found</div>
+ <p>Unable to retrieve participants for this group.</p>
+ </div>
+
+ <table v-else class="ui celled table">
+ <thead>
+ <tr>
+ <th>Participant</th>
+ <th>Phone Number</th>
+ <th>LID</th>
+ <th>Role</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr v-for="participant in participants" :key="participant.jid">
+ <td>
+ <div class="header">{{ formatJID(participant.jid) }}</div>
+ <div v-if="participant.display_name" class="description">{{ participant.display_name }}</div>
+ </td>
+ <td>
+ {{ formatParticipantPhone(participant) }}
+ </td>
+ <td>
+ <span v-if="participant.lid">{{ formatJID(participant.lid) }}</span>
+ <span v-else>-</span>
+ </td>
+ <td>
+ <div class="ui tiny label" :class="getParticipantRoleColor(participant)">
+ {{ getParticipantRole(participant) }}
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="actions">
+ <div class="ui button" @click="close">Close</div>
+ </div>
+ </div>
+ `,
+};