feat(chat): add markMessageAsPlayed endpoint (audio receipt)#2519
Open
rafavasconcelost wants to merge 1 commit intoEvolutionAPI:mainfrom
Open
feat(chat): add markMessageAsPlayed endpoint (audio receipt)#2519rafavasconcelost wants to merge 1 commit intoEvolutionAPI:mainfrom
rafavasconcelost wants to merge 1 commit intoEvolutionAPI:mainfrom
Conversation
Adds POST /chat/markMessageAsPlayed/{instance} for marking received audio
messages as played (blue microphone in WhatsApp), mirroring the existing
markMessageAsRead pattern.
Baileys natively supports sock.sendReceipts(keys, 'played') but Evolution
only exposed the 'read' type via /chat/markMessageAsRead. CRMs that play
back voice notes received from contacts had no way to send the played
ack — this endpoint fills the gap with the same DTO/schema shape (key
shape: id, fromMe, remoteJid) under a 'playedMessages' array.
Mirrors:
- DTO: MarkMessageAsPlayedDto extends Key array (mirrors ReadMessageDto)
- Schema: markMessageAsPlayedSchema (JSONSchema7, mirrors readMessageSchema)
- Service: markMessageAsPlayed -> client.sendReceipts(keys, 'played')
- Controller: markMessageAsPlayed -> waMonitor delegation
- Router: POST routerPath('markMessageAsPlayed')
Use case: agent CRMs (Chatwoot-like) that present audio messages with a
play button and need to send the played receipt back to the contact when
the agent plays the audio in the dashboard.
Contributor
There was a problem hiding this comment.
Sorry @rafavasconcelost, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
Adds
POST /chat/markMessageAsPlayed/{instance}for marking received audio messages as played (the blue microphone indicator in WhatsApp), mirroring the existingmarkMessageAsReadpattern.Baileys natively exposes
sock.sendReceipts(keys, 'played'), but Evolution currently only exposes the'read'receipt type via/chat/markMessageAsRead. CRMs and dashboards that play back voice notes received from contacts have no way to send the played ack — this endpoint fills that gap with the same DTO/schema shape (key:id,fromMe,remoteJid) under aplayedMessagesarray.The implementation is fully symmetric to
markMessageAsRead:MarkMessageAsPlayedDtowithplayedMessages: Key[](mirrorsReadMessageDto)markMessageAsPlayedSchema(JSONSchema7, mirrorsreadMessageSchema)markMessageAsPlayed→client.sendReceipts(keys, 'played')markMessageAsPlayed→waMonitordelegationPOST routerPath('markMessageAsPlayed')🔗 Related Issue
N/A — this is a new endpoint extension. Happy to open a tracking issue if maintainers prefer.
🧪 Type of Change
🧪 Testing
Smoke test against a running instance (Baileys, WhatsApp Web):
POST /chat/markMessageAsPlayed/{instance}with a valid{ playedMessages: [{ id, fromMe: false, remoteJid }] }body returns201 { message: "Played messages", played: "success" }. The blue microphone indicator appears on the contact's WhatsApp client (verified on Android and iOS).Without a valid API key it returns
401, matching the behavior ofmarkMessageAsRead(confirms the route is registered and guarded correctly).📝 Additional Notes
Use case: agent CRMs / customer support platforms (e.g. Chatwoot-like dashboards) that present audio messages from contacts with a play button. When the agent plays back the audio in the dashboard, the played receipt is forwarded to the contact's WhatsApp — same UX they get from a real WhatsApp client.
We've been running this in production on a self-hosted Coolify deployment for ~24h and confirmed it works end-to-end with no observed issues. Happy to address any review feedback.
✅ Checklist
dataValidate, JSONSchema7 validation, Service Object pattern)sendReceiptssemantics)