-
Notifications
You must be signed in to change notification settings - Fork 26
fix: handle extended text message type of incoming message upsert #9
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
fix: handle extended text message type of incoming message upsert #9
Conversation
WalkthroughThe changes update the message handling logic in the WhatsApp incoming message service. The service now checks for text in both the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant S as IncomingMessageBaileysService
C->>S: Send raw message payload
S->>S: Execute message_type()
alt Message contains 'conversation' or 'extendedTextMessage' text
S->>S: Recognize as text message
S->>S: Call create_text_message() to extract content
S->>C: Return created text message
else
S->>C: Process as non-text message
end
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 RuboCop (1.73)spec/services/whatsapp/incoming_message_baileys_service_spec.rbError: 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Pull Request Overview
This PR fixes the handling of extended text messages by updating the service logic and adding corresponding tests.
- Added a new test context to verify that extendedTextMessage payloads are processed correctly.
- Updated the message type detection to include extendedTextMessage and refactored message content extraction accordingly.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
spec/services/whatsapp/incoming_message_baileys_service_spec.rb | Added new test contexts for messages having a conversation key and extendedTextMessage with text. |
app/services/whatsapp/incoming_message_baileys_service.rb | Modified message_type and create_text_message methods to correctly handle extended text messages. |
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.
-(review needed) +(approved for merge) +(questions/changes requested)
Reviewed 2 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @CayoPOliveira)
spec/services/whatsapp/incoming_message_baileys_service_spec.rb
line 273 at r2 (raw file):
pushName: 'John Doe' } end
Avoid this syntax (string as hash key). Rubocop won't complain (it's valid in some contexts), but we should avoid it.
Suggestion:
let(:raw_message) do
{
key: { id: 'msg_123', remoteJid: '5511912345678@s.whatsapp.net', fromMe: false },
message: { extendedTextMessage: { text: 'Hello from Baileys' } },
pushName: 'John Doe'
}
end
3fa895f
to
a70b858
Compare
* feat: add Resend email delivery method and configuration * chore: simplify ResendProvider initialization by removing settings parameter * test: update ResendProvider initialization in tests by removing unnecessary settings parameter * chore: improvements
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.
Reviewable status: 2 of 19 files reviewed, 1 unresolved discussion (waiting on @gabrieljablonski)
spec/services/whatsapp/incoming_message_baileys_service_spec.rb
line 273 at r2 (raw file):
Previously, gabrieljablonski (Gabriel Jablonski) wrote…
Avoid this syntax (string as hash key). Rubocop won't complain (it's valid in some contexts), but we should avoid it.
Done.
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.
Reviewed 1 of 17 files at r3.
Reviewable status: 3 of 19 files reviewed, 1 unresolved discussion (waiting on @gabrieljablonski)
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.
-(questions/changes requested) +(review needed)
Reviewable status: 3 of 19 files reviewed, 1 unresolved discussion (waiting on @gabrieljablonski)
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.
Address pending comment and good to merge. No re-review needed.
-(review needed) +question +(approved for merge)
Reviewed 1 of 17 files at r3, 16 of 16 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @CayoPOliveira)
spec/services/whatsapp/incoming_message_baileys_service_spec.rb
line 273 at r2 (raw file):
Previously, CayoPOliveira (Cayo P. R. Oliveira) wrote…
Done.
Still not fixed.
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @CayoPOliveira)
* feat: support extended text messages in WhatsApp incoming message service * fix: correct isEditorHotKeyEnabled's spec * ci: add baileys-api service to docker-compose configuration * feat!: update validate_provider_config? endpoint * feat: add Resend email delivery method and configuration (#11) * feat: add Resend email delivery method and configuration * chore: simplify ResendProvider initialization by removing settings parameter * test: update ResendProvider initialization in tests by removing unnecessary settings parameter * chore: improvements * chore: add support for external frontend URL in environment configuration * chore: ensure trailing slash * ci: updated docker compose * feat: update Resend email delivery method to use headers for sender and recipient * feat: update email templates to use user's name instead of email * fix: simplify extended text message structure in Baileys service spec --------- Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com> Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>
This change is
Summary by CodeRabbit