Repository navigation
Add comprehensive WhatsApp Groups Manager - #77
Conversation
…ate go.mod and go.sum dependencies to latest versions - Fix function calls in handlers.go and wmiau.go to include context parameter - Resolve compilation errors due to whatsmeow API changes - Maintain compatibility with Go 1.23.1 and latest whatsmeow version
…Group: Create new WhatsApp groups with participants - SetGroupLocked: Configure group as locked (admin-only modifications) - SetDisappearingTimer: Set ephemeral messages (24h, 7d, 90d, off) - RemoveGroupPhoto: Remove group photos - Added 4 new handlers in handlers.go with proper validation - Added corresponding routes in routes.go - Updated API.md, OpenAPI spec.yml and Postman collection - All endpoints validated and ready for production
- Add complete groups.js (2233 lines) with full group management functionality: * Group listing with search, filters, and type detection (Community/Normal) * Group creation with participant selection and photo upload * Detailed group view with participant management (add/remove/promote/demote) * Group settings (name, description, photo, announce mode, locked mode) * Advanced features (ephemeral messages, invite links, leave group) * Contact integration and caching for participant selection - Update dashboard interface with new groups section: * Add groups cards and navigation in index.html * Extend CSS with responsive group management styles * Integrate groups functionality into main app.js - Enhance API documentation and endpoints: * Update handlers.go with improved group operations * Refresh API spec.yml and API.md documentation * Update Postman collection with latest group endpoints Features include community detection, admin permission handling, real-time updates, error handling, and full integration with existing WuzAPI group
There was a problem hiding this comment.
Hello @guilhermejansen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Gemini here, providing a summary for this pull request. This PR introduces a comprehensive WhatsApp Groups Manager feature to the dashboard, along with the necessary backend API endpoints and documentation updates. The goal is to provide users with a full suite of tools to manage their WhatsApp groups directly through the WuzAPI dashboard and API.
Highlights
- New Dashboard Groups Manager: A complete new section has been added to the dashboard UI (
static/dashboard/index.html,static/dashboard/js/groups.js,static/dashboard/css/app.css) allowing users to list, create, join, view details, edit info, manage participants (add, remove, promote, demote), configure settings (announce, locked, disappearing messages), manage group photos, and reset/copy invite links for their WhatsApp groups. - New Group Management API Endpoints: Several new API endpoints have been added to the backend (
handlers.go,routes.go) to support the new group management features, including/group/create,/group/locked,/group/ephemeral, and/group/photo/remove. Existing endpoints like/group/updateparticipantshave been enhanced. - API Documentation Updates: The OpenAPI specification (
static/api/spec.yml) and theAPI.mddocumentation have been updated to include the new group management endpoints, their parameters, and examples. The/group/photodocumentation now explicitly mentions the JPEG format requirement. - Dependency Updates: Several Go dependencies, including
whatsmeow,gorilla/websocket,go.mau.fi/libsignal,go.mau.fi/util,golang.org/x/crypto,golang.org/x/net,golang.org/x/sys, and others, have been updated ingo.modandgo.sum. - Backend Context Handling: Added
context.Background()to variouswhatsmeowclient andsqlstorecalls inhandlers.go,main.go, andwmiau.gofor better context propagation. - Improved Group Photo Handling: The
/group/photoendpoint handler (handlers.go) now includes stricter validation for the input image data format, specifically checking for thedata:image/prefix and validating that the image is in JPEG format, as required by WhatsApp. - Frontend Contact Loading for Groups: The frontend JavaScript (
static/dashboard/js/groups.js) now includes logic to load user contacts via the/user/contactsAPI endpoint to populate dropdowns for selecting participants when creating or managing groups.
Changelog
Click here to see the changelog
- .env
- Removed the .env file.
- .gitignore
- Added new entries for logs, node_modules, editor files (.idea, .vscode, etc.), OS files (.DS_Store), and various task/script files.
- API.md
- Corrected a markdown typo from `````` to ````` (L737).
- Added detailed notes and parameters for the
/group/photoendpoint, specifying JPEG format requirement and image processing details (L876-890). - Added documentation for the new
/group/createendpoint (L939-976). - Added documentation for the new
/group/lockedendpoint (L980-1002). - Added documentation for the new
/group/ephemeralendpoint, including valid duration values (L1007-1034). - Added documentation for the new
/group/photo/removeendpoint (L1039-1060).
- go.mod
- Updated
go.mau.fi/whatsmeowdependency fromv0.0.0-20250501130609-4c93ee4e6efatov0.0.0-20250521125706-91ac75c2f61a(L14). - Updated
github.com/petermattis/goiddependency (L29). - Updated
golang.org/x/expdependency (L32). - Added
golang.org/x/textdependency (L33). - Updated
github.com/gorilla/websocketdependency fromv1.5.0tov1.5.3(L43). - Updated
go.mau.fi/libsignaldependency fromv0.1.2tov0.2.0(L48). - Updated
go.mau.fi/utildependency fromv0.8.6tov0.8.7(L49). - Updated
golang.org/x/cryptodependency fromv0.37.0tov0.38.0(L50). - Updated
golang.org/x/netdependency fromv0.39.0tov0.40.0(L51). - Updated
golang.org/x/sysdependency fromv0.32.0tov0.33.0(L52).
- Updated
- go.sum
- Added checksums for
github.com/gorilla/websocket v1.5.3(L25-26). - Added checksum for
github.com/mattn/go-sqlite3 v1.14.28(L47). - Added checksums for
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb(L59-60). - Added checksums for
go.mau.fi/libsignal v0.2.0(L79-80). - Added checksums for
go.mau.fi/util v0.8.7(L83-84). - Added checksums for
go.mau.fi/whatsmeow v0.0.0-20250521125706-91ac75c2f61a(L87-88). - Added checksums for
golang.org/x/crypto v0.38.0(L94-95). - Added checksums for
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6(L98-99). - Added checksums for
golang.org/x/net v0.40.0(L112-113). - Added checksum for
golang.org/x/sync v0.14.0(L119). - Added checksums for
golang.org/x/sys v0.33.0(L134-135). - Added checksums for
golang.org/x/text v0.25.0(L147-148). - Added checksum for
golang.org/x/tools v0.33.0(L158).
- Added checksums for
- handlers.go
- Added
context.Background()toclient.Logout()call (L513). - Added
context.Background()toclient.PairPhone()call (L583). - Removed empty line (L1500).
- Removed empty line (L2225).
- Added comment
// Sets global presence status(L2359). - Added
context.Background()toclient.Store.Contacts.GetAllContacts()call (L2495). - Added
context.Background()toclient.Download()call for image (L2628). - Added
context.Background()toclient.Download()call for document (L2707). - Added
context.Background()toclient.Download()call for video (L2786). - Added
context.Background()toclient.Download()call for audio (L2865). - Added new handler function
CreateGroupfor/group/createendpoint (L3241-3310). - Added new handler function
SetGroupLockedfor/group/lockedendpoint (L3314-3363). - Added new handler function
SetDisappearingTimerfor/group/ephemeralendpoint (L3367-3436). - Added new handler function
RemoveGroupPhotofor/group/photo/removeendpoint (L3440-3489). - Modified
SetGroupPhotohandler to check fordata:image/prefix instead ofdata:image/jp(L3671). - Added validation in
SetGroupPhototo ensure image data is present and is in JPEG format (L3684-3694). - Added comment
// Leave group(L3834). - Added comment
// Add user(L4081). - Added comment
// Delete user(L4208). - Added comment
// Delete user complete(L4255). - Added
context.Background()toclient.Logout()call (L4307). - Added comment
// Respond to client(L4356). - Added comment
// Validate message fields(L4387). - Added comment
// Set proxy(L4410).
- Added
- main.go
- Added
context.Background()tosqlstore.Newcalls for both postgres and sqlite (L178, L181).
- Added
- routes.go
- Added route for
/group/create(L117). - Added route for
/group/photo/remove(L122). - Added routes for
/group/lockedand/group/ephemeral(L127-128).
- Added route for
- static/api/spec.yml
- Updated openapi version from '3.0' to '3.0.0' (L5).
- Added
serverssection (L10-12). - Fixed
$refpaths from#definitions/...to#/definitions/...in various places (e.g., L230, L298, L378, L401, L424, L452, L490, L512, L534, L556, L645, L667, L689, L711, L733, L755, L777, L799, L821, L842, L864, L886, L908, L1080). - Added new path
/group/createwith summary, description, security, request body schema (#/definitions/CreateGroup), and response example (L917-937). - Added new path
/group/lockedwith summary, description, security, request body schema (#/definitions/GroupLocked), and response example (L938-958). - Added new path
/group/ephemeralwith summary, description, security, request body schema (#/definitions/GroupEphemeral), and response example (L959-979). - Added new path
/group/photo/removewith summary, description, security, request body schema (#/definitions/RemoveGroupPhoto), and response example (L980-1000). - Added description to
Imageproperty inGroupPhotodefinition (L1275). - Changed required property name from
groupJIDtoGroupJIDinGroupLeavedefinition (L1770). - Changed required property names from
groupJID,nametoGroupJID,NameinGroupNamedefinition (L1780-1781). - Changed required property names from
groupJID,topictoGroupJID,TopicinGroupTopicdefinition (L1795-1796). - Changed required property names from
groupJID,announcetoGroupJID,AnnounceinGroupAnnouncedefinition (L1810-1811). - Changed required property name from
inviteCodetoCodeinGroupJoindefinition (L1825). - Changed required property name from
inviteCodetoCodeinGroupInviteInfodefinition (L1835). - Changed required property names from
groupJID,action,participantstoGroupJID,Action,PhoneinUpdateGroupParticipantsdefinition (L1845-1847). - Updated
Actionenum inUpdateGroupParticipantsto includepromoteanddemote(L1856). - Updated description and example for
Phoneproperty inUpdateGroupParticipantsto clarify phone number format (L1862-1863). - Added new definition
CreateGroupfor creating groups (L1865-1880). - Added new definition
GroupLockedfor setting group locked status (L1882-1895). - Added new definition
GroupEphemeralfor setting disappearing timer (L1897-1911). - Added new definition
RemoveGroupPhotofor removing group photo (L1913-1921).
- static/dashboard/css/app.css
- Added extensive CSS styles for the new groups manager UI, including styles for group cards, participants, badges, modals, and responsiveness (L284-1054).
- static/dashboard/index.html
- Added
id="mainDashboard"to the main dashboard container div (L120). - Added a new 'Groups' section to the dashboard with cards for 'List Groups', 'Create Group', and 'Join Group' (L161-181).
- Added a new main container div
groupsMainContainerfor the groups manager page, including header, search/filter section, loading indicator, groups list container, and 'no groups' message (L186-261). - Added several new modal structures for Group Details (
modalGroupDetails), Create Group (modalCreateGroup), Join Group (modalJoinGroup), Edit Group (modalEditGroup), Group Settings (modalGroupSettings), Manage Participants (modalManageParticipants), Confirmation (confirmationModal), Edit Group Info (modalEditGroupInfo), and Group Invite Link (modalGroupInviteLink) (L440-874). - Included the new
js/groups.jsscript (L879).
- Added
- static/dashboard/js/app.js
- Modified
handleRegularLoginfunction to store the user's JID in local storage andwindow.currentUserJIDupon successful login (L320-324). - Modified
updateUserfunction to store the user's JID in local storage andwindow.currentUserJIDwhen updating user status (L346-350).
- Modified
- static/dashboard/js/groups.js
- Added a new JavaScript file (
groups.js) containing all the frontend logic for the comprehensive WhatsApp Groups Manager. This includes functions for initializing events and modals, showing/hiding the manager, loading and displaying groups, filtering groups, showing group details, handling modal interactions (create, join, edit, settings, participants, invite link), loading contacts, performing group actions via API calls (create, join, update name/topic/announce/locked/ephemeral/participants/photo/invite link, leave), and utility functions for JID parsing, admin checks, text truncation, base64 conversion for photos, and error/success messages (L1-2233).
- Added a new JavaScript file (
- wmiau.go
- Added
context.Background()tocontainer.GetDevice()calls (L135, L169). - Added
context.Background()tomycli.WAClient.Download()calls for image, audio, document, and video messages (L410, L463, L522, L586).
- Added
- wuzapi_postman.json
- Added new Postman requests for 'Create Group', 'Set Group Locked', 'Set Disappearing Timer', and 'Remove Group Photo' under the 'Group' folder (L844-927).
- Updated the 'Set Group Photo' request body example (L1044).
- Updated the 'Update Group Participants' request body key from
ParticipantstoPhoneand updated the description to include 'promote' and 'demote' actions (L1149, L1156).
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Groups gather 'round,
API calls abound,
Manage with ease,
Across the seas,
New features now are found.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive WhatsApp Groups Manager, a significant and well-implemented feature. The changes span the backend API, frontend UI, and documentation, demonstrating a well-rounded feature implementation.
Summary of Findings
- API Specification Typo: A typo was found in
static/api/spec.ymlwhereprometeshould likely bepromotein an enum definition. - Postman Collection Inconsistency: The Postman collection (
wuzapi_postman.json) has a description and example request body forUpdateGroupParticipantsthat are slightly out of sync with the updated API definition (action types and field namePhonevsParticipants). - JPEG Validation in Backend: The backend JPEG validation in
handlers.gofor group photos is a good robustness measure. - Context Propagation: Multiple
whatsmeowlibrary calls acrosshandlers.goandwmiau.gohave been updated to includecontext.Background(). This is a necessary change due to library updates and ensures correct context propagation. (Not an issue, positive observation) - Frontend Group Management Logic: The new
static/dashboard/js/groups.jsfile provides extensive client-side logic for the new group features, including API interactions, DOM manipulation, and image processing. The implementation appears comprehensive. (Not an issue, positive observation)
Merge Readiness
This pull request is in good shape and introduces significant new functionality. The core logic for group management on both backend and frontend seems solid.
I recommend addressing the medium-severity issues identified in static/api/spec.yml and wuzapi_postman.json to ensure API consistency and ease of use for developers and testers. The JPEG validation in handlers.go is good as is.
Once these minor refinements are made, the PR should be ready for merging after further review and approval by other team members. I am not authorized to approve pull requests.
| description: Action to perform ("add" to add participants, "remove" to remove participants) | ||
| enum: [add, remove] | ||
| description: Action to perform ("add" to add participants, "remove" to remove participants, "promote" to promote participants, "demote" to demote participants.) | ||
| enum: [add, remove, promete, demote] |
| "raw": "{\n \"GroupJID\": \"[email protected]\",\n \"Action\": \"add\",\n \"Phone\": [\"[email protected]\", \"[email protected]\"]\n}" | ||
| }, | ||
| "url": { | ||
| "raw": "{{baseUrl}}/group/updateparticipants", | ||
| "host": ["{{baseUrl}}"], | ||
| "path": ["group", "updateparticipants"] | ||
| }, | ||
| "description": "Add or remove participants from a group. Action can be 'add' or 'remove'." | ||
| "description": "Add, remove, promote or demote participants from a group. Action can be 'add', 'remove', 'promote','demote'." |
There was a problem hiding this comment.
The description for the UpdateGroupParticipants endpoint (line 1156) mentions actions 'add' or 'remove', but the API now supports 'promote' and 'demote' as well, as indicated in spec.yml.
Additionally, the example request body (line 1149) uses "Participants" as the key for the list of phone numbers, but the spec.yml (and likely the backend implementation) now uses "Phone" for this field (as seen in UpdateGroupParticipants definition in spec.yml lines 1847 and 1858).
Could we update the description to include all supported actions and change "Participants" to "Phone" in the example body for consistency with the API definition?
"raw": "{\n \"GroupJID\": \"[email protected]\",\n \"Action\": \"add\",\n \"Phone\": [\"[email protected]\", \"[email protected]\"]\n}",
"url": {
"raw": "{{baseUrl}}/group/updateparticipants",
"host": ["{{baseUrl}}"],
"path": ["group", "updateparticipants"]
},
"description": "Add, remove, promote or demote participants from a group. Action can be 'add', 'remove', 'promote', 'demote'."
…compatible) and webhook JSON format option (no breaking changes) - Introduce S3Manager for generic S3 operations (upload, public URL, retention) - Add per-user S3 configuration fields (enabled, endpoint, region, bucket, keys, path style, public URL, delivery mode, retention days) via DB migration - Implement API endpoints for S3 config management (POST/GET/DELETE/test) - Update event handlers to upload incoming media to S3 and include public preview URL in webhook payload, according to user config (base64, S3 URL, or both) - Update outgoing media (SendDocument, SendImage, SendAudio, SendVideo, etc.) to also upload to S3 if enabled - Ensure all S3 logic is opt-in and does not affect users without S3 enabled (full backward compatibility) - Media is stored in S3 by user, type, contact, and date for structured organization - Retention period for media in S3 is user-configurable at integration setup - Add support for WEBHOOK_FORMAT=json, allowing webhook payloads to be sent as JSON - Update documentation (API.md, README.md, spec.yml, Postman collection) to reflect new S3 and webhook format features - Add and update Go module dependencies as needed This implementation is production-ready, scalable for multiple WhatsApp instances, and avoids unnecessary complexity. All changes are fully backward compatible: no breaking changes, and existing users and integrations continue to work as before.
…on in docker-compose - Remove wuzapi_dbdata and wuzapi_files volumes from docker-compose - Add WEBHOOK_FORMAT=json environment variable to service configuration
…webhooks and complete event support Major Features Added: - S3-compatible storage integration for media files with configurable retention - Proxy support for WhatsApp connections with SOCKS5 protocol - Global webhook system with support for ALL whatsmeow library events - Complete event type coverage including calls, newsletters, presence, and identity changes - Enhanced webhook system with comprehensive event type validation and "All" event subscription - Improved dashboard UI with configuration management panels - Comprehensive API documentation updates Core Improvements: - Added constants.go with complete event type definitions and validation for 50+ WhatsApp events - Implemented global webhook support with "All" event type for comprehensive monitoring - Added support for advanced events: calls, newsletters, presence, identity changes, app state sync - Implemented S3Manager with upload, download, and lifecycle management - Added proxy configuration endpoints and connection handling - Enhanced user creation with optional S3 and proxy configurations - Improved error handling and validation across all endpoints - Complete whatsmeow library event coverage including Facebook bridge and CAT refresh errors Dashboard Enhancements: - New configuration panels for S3, proxy, and webhook settings - Improved user interface with better navigation and visual feedback - Enhanced admin panel with instance management capabilities - Better responsive design and user experience improvements API Documentation: - Updated OpenAPI specification with new endpoints - Enhanced README with configuration examples - Added comprehensive endpoint documentation - Updated Postman collection with new API calls Technical Improvements: - Better code organization with separated constants - Enhanced error handling and logging - Improved database migrations for new features - Better security and validation throughout the application Breaking Changes: None - all changes are backward compatible
Add comprehensive WhatsApp Groups Manager
🚀 New Feature: Complete WhatsApp Groups Manager
What's Added:
Files Changed:
static/dashboard/js/groups.js- New complete groups managerstatic/dashboard/index.html- Added groups sectionstatic/dashboard/css/app.css- Groups stylingstatic/dashboard/js/app.js- Integrationhandlers.go- API improvementsstatic/api/spec.yml- Updated documentationAPI.md- Documentation updateswuzapi_postman.json- Updated collectionTechnical Details:
Testing:
✅ All group operations tested
✅ Responsive design verified
✅ Community/Normal groups working
✅ Permission levels properly handled
Ready for review and merge! 🎉