Skip to content

Conversation

@redbullpeter
Copy link

This PR adds support for private (1-to-1) chats in the WhatsApp multi-device bridge. Previously, the bridge only supported group chats, but this enhancement allows users to bridge private messages with other platforms.

Changes

Added validation for private chat JIDs (ending with @s.whatsapp.net) in the JoinChannel function
Added a new helper function isPrivateJid() to identify private chat JIDs
Implemented appropriate validation and logging for private chats

Usage
To use this feature, configure a gateway with a private chat JID as the channel:

[[gateway.inout]]
account="whatsapp.bridge"
channel="[email protected]"

The JID format is the WhatsApp phone number followed by @s.whatsapp.net.

Testing
The changes have been tested in an actively used system with multiple group and private chats and both function correctly.

Notes

If the contact isn't in the user's contacts list, a warning is logged but the bridge will still attempt to connect
All message types (text, media, etc.) work with private chats without additional changes since the underlying protocol handles them similarly to group messages

redbullpeter and others added 13 commits March 20, 2025 19:41
Updated whatsmeow from commit 0b502af to ad7a618, which includes
breaking API changes requiring context.Context parameters.

Changes:
- Updated GetJoinedGroups() to include context.Background()
- Updated RevokeMessage() to include context.Background()
- Updated GetProfilePictureInfo() to include context.Background()
- Upgraded whatsmeow and related dependencies
- Added support for coder/websocket library migration

This update includes improvements to device cache management,
better error handling, and enhanced connection stability.
Changes:
- Use golang:1.24-alpine base image (required by updated whatsmeow)
- Remove -mod vendor flag to download fresh dependencies
- Remove 'go' package installation (included in golang image)

This fixes build errors caused by vendored dependencies being
out of sync with the updated go.mod after whatsmeow upgrade.
This Dockerfile demonstrates how to build matterbridge by cloning
directly from the GitHub branch, useful for CI/CD or remote builds.
Add -mod=mod flag to go build command in both Dockerfiles to
explicitly tell Go to ignore the vendor directory and download
fresh dependencies from go.mod.

This resolves the "inconsistent vendoring" error that occurs
because the cloned repository includes an outdated vendor
directory that doesn't match the updated go.mod dependencies.

Changes:
- Dockerfile_whatsappmulti: Added -mod=mod flag
- Dockerfile.updated: Added -mod=mod flag
Updated whatsmeow from ad7a618ba42f to 720bd0b4a715 to include:
- Proto update to v1029399661 (AI features, model metadata)
- History sync receipts fix
- Pre-key upload optimization (812 prekeys)
- Connection event handler improvements
- Client payload default updates
- Initial history bootstrap inline payload support

No code changes required - all updates are backward compatible
with existing matterbridge functionality.

Commits included:
- 720bd0b proto: update to v1029399661
- 6cfa7f7 message: add support for initialHistBootstrapInlinePayload
- a8a4c7e connectionevents: add stub handler for dirty event
- ac4867a store/clientpayload: update default values
- a2f58c9 message: fix history sync receipts
- 1e8afd5 prekeys: upload 812 prekeys in initial bundle
…dates-011CUrxG4Yn1RABuSVSa1E1g

Claude/integrate whatsmeow updates 011 c urx g4 yn1 ra bu sv sa1 e1g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants