-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add functionality to mark conversations as read in Chatwoot #1436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add WAHAMessageReadConsumer to process MESSAGE_ACK events - Filter to process only read confirmations (ack === 3) - Integration with Chatwoot API using update_last_seen endpoint - Webhook filter to avoid infinite loops (ignores status: 'read') - Full support for contact and conversation mapping New Files: - src/apps/chatwoot/consumers/waha/message.read.ts - Consumer for read events Modified Files: - src/apps/chatwoot/chatwoot.module.ts - Registration of new queue and consumer - src/apps/chatwoot/client/ConversationService.ts - markAsRead() method - src/apps/chatwoot/client/ContactConversationService.ts - markConversationAsRead() and getSourceIdByChatId() methods - src/apps/chatwoot/consumers/waha/base.ts - Added MESSAGE_ACK to events - src/apps/chatwoot/services/ChatWootWAHAQueueService.ts - Routing to new queue - src/apps/chatwoot/api/chatwoot.webhook.controller.ts - Webhook filter - src/apps/chatwoot/consumers/QueueName.ts - Added WAHA_MESSAGE_READ enum Features: Γ’Εβ¦ Real-time read status between WhatsApp and Chatwoot Γ’Εβ¦ Improved user experience with read confirmations Γ’Εβ¦ Robust integration using official Chatwoot APIs Γ’Εβ¦ Infinite loop prevention with smart filters Γ’Εβ¦ Detailed logging for debugging and monitoring Resolves the need to mark conversations as read in the Chatwoot integration Improves the user experience with real-time read status
1 similar comment
|
+1 |
devlikepro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires a bit of changes, but overall it's gooooood π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use event in consumer name - so it'd be message.ack.ts because it process message.ack event.
β¦convention - Rename file to reflect the MESSAGE_ACK event it processes - Update import reference in chatwoot.module.ts - Maintains same functionality while improving code clarity
| } | ||
|
|
||
| // Ignore messages with status "read" (from update_last_seen endpoint) | ||
| if (body.status === 'read') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no such field :(
The only message_updated we need - when agent clicks on "Retry" button in CHatWoot message.
Found a bit weird way to identify it, hopefully it'll work π€
π Description
This PR adds the ability to mark conversations as "read" in the WAHA-Chatwoot integration.
β¨ Features
WAHAMessageReadConsumerconsumer to processMESSAGE_ACKeventsack === 3)update_last_seenendpointstatus: "read")π§ Technical Changes
New Files:
src/apps/chatwoot/consumers/waha/message.ack.ts- Consumer for read eventsModified Files:
src/apps/chatwoot/chatwoot.module.ts- Registration of the new queue and consumersrc/apps/chatwoot/client/ConversationService.ts-markAsRead()methodsrc/apps/chatwoot/client/ContactConversationService.ts-markConversationAsRead()methodsrc/apps/chatwoot/consumers/waha/base.ts- AddedMESSAGE_ACKto eventssrc/apps/chatwoot/services/ChatWootWAHAQueueService.ts- Routing to new queuesrc/apps/chatwoot/api/chatwoot.webhook.controller.ts- Webhook filtersrc/structures/enums.dto.ts- AddedMESSAGE_READenumπ§ͺ How to Test
π Notes
MESSAGE_ACKinstead ofMESSAGE_READ(which is not generated by WAHA)/public/api/v1/inboxes/{inbox_identifier}/contacts/{source_id}/conversations/{conversation_id}/update_last_seeninboxIdentifieras a tokenπ Related
Related to #1319