Skip to content

Bridge pinned messages between WhatsApp and Matrix#905

Open
kalix127 wants to merge 2 commits intomautrix:mainfrom
kalix127:feat/pin-messages
Open

Bridge pinned messages between WhatsApp and Matrix#905
kalix127 wants to merge 2 commits intomautrix:mainfrom
kalix127:feat/pin-messages

Conversation

@kalix127
Copy link
Copy Markdown

@kalix127 kalix127 commented Mar 28, 2026

Summary

This PR adds support for bridging pinned messages between WhatsApp and Matrix in both directions.

WhatsApp to Matrix

When a message is pinned or unpinned on WhatsApp, the bridge updates the room's m.room.pinned_events state event in Matrix instead of sending a text notice. The target message's Matrix event ID is looked up from the bridge database. If the message is not found in the database (e.g. predates the bridge), the pin is silently ignored.

Matrix to WhatsApp

When a user pins or unpins a message from a Matrix client, the bridge diffs the old and new pinned event lists and sends the corresponding PinInChatMessage to WhatsApp. Room power levels for m.room.pinned_events are set when creating new portal rooms so users can pin from Matrix clients.

This direction depends on two upstream changes:

Files changed

pkg/connector/wamsgtype.go: Added PinInChatMessage message type detection
pkg/connector/handlewhatsapp.go: Added handleWAPinInChat() for WhatsApp to Matrix pin state updates
pkg/connector/handlematrix.go: Added HandleMatrixPinChange() and sendPinInChat() for Matrix to WhatsApp
pkg/connector/capabilities.go: Added StatePinnedEvents to room state features
pkg/connector/chatinfo.go: Added StatePinnedEvents power levels for DM and group rooms

Closes #731

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to pin messages

1 participant