-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(evolutionbot): Fixing the correct message sending method so that messages are split. #1986
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
base: develop
Are you sure you want to change the base?
Conversation
- Replace instance.textMessage() with sendMessageWhatsApp() method - Enable message splitting by double line breaks (\n\n) - Add proper delay and typing indicators between split messages - Fix linkPreview parameter passing to base class methods - Support linkPreview: false/true from webhook response - Remove unnecessary debug logs for cleaner output Fixes: EvolutionBot was not respecting splitMessages and linkPreview configurations
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors EvolutionBot’s WhatsApp messaging flow to use the unified sendMessageWhatsApp method (enabling proper splitting on double line breaks with delays and typing indicators), ensures linkPreview is parsed and passed correctly, and removes unnecessary debug logs. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 message handling in the EvolutionBot by switching from direct instance.textMessage() calls to the base class sendMessageWhatsApp() method, enabling proper message splitting functionality and linkPreview parameter handling.
- Replace direct textMessage() calls with base class method to enable message splitting
- Add linkPreview parameter support throughout the message sending chain
- Remove unnecessary debug logging for cleaner output
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/api/integrations/chatbot/evolutionBot/services/evolutionBot.service.ts | Replaced direct textMessage() call with base class sendMessageWhatsApp() method and removed debug logs |
src/api/integrations/chatbot/base-chatbot.service.ts | Added linkPreview parameter to sendMessageWhatsApp() and sendFormattedText() methods |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Hey there - I've reviewed your changes - here's some feedback:
- Centralize the double-line-break message splitting logic into a dedicated helper to keep sendMessageWhatsApp focused and make the split behavior easier to unit-test.
- Since most debug logs were removed, add back targeted, log-level-gated statements around key events (like before/after splitting and sending messages) to retain observability without clutter.
- Ensure the new linkPreview parameter is reflected in all type definitions, mocks, and any callers of sendMessageWhatsApp, so the default-true behavior is consistently enforced.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Centralize the double-line-break message splitting logic into a dedicated helper to keep sendMessageWhatsApp focused and make the split behavior easier to unit-test.
- Since most debug logs were removed, add back targeted, log-level-gated statements around key events (like before/after splitting and sending messages) to retain observability without clutter.
- Ensure the new linkPreview parameter is reflected in all type definitions, mocks, and any callers of sendMessageWhatsApp, so the default-true behavior is consistently enforced.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…istency - Centralize double-line-break message splitting logic into dedicated helper methods - Add targeted debug logs for better observability without clutter - Ensure linkPreview parameter is consistently passed across all chatbot services - Extract splitMessageByDoubleLineBreaks() and sendSingleMessage() helpers - Update all chatbot services to explicitly pass linkPreview: true - Improve code testability and maintainability Services updated: - BaseChatbotService: Refactored split logic and added debug logs - TypebotService: Added linkPreview parameter to all sendMessageWhatsApp calls - OpenAIService: Added linkPreview parameter to all sendMessageWhatsApp calls - N8nService: Added linkPreview parameter to sendMessageWhatsApp call - FlowiseService: Added linkPreview parameter to sendMessageWhatsApp call - EvoaiService: Added linkPreview parameter to sendMessageWhatsApp call - DifyService: Added linkPreview parameter to all sendMessageWhatsApp calls
Desculpe @DavidsonGomes, acabei esquecendo de selecionar o branch develop :( |
Fixes: EvolutionBot was not respecting splitMessages and linkPreview configurations
📋 Description
After adding linkpreview: false, messages were no longer being split correctly. Now it has been fixed, messages are being split, debouce time tested, linkpreview tested with true and false and working.
Summary by Sourcery
Improve messaging reliability by switching to the proper sendMessageWhatsApp method, re-enabling message splitting with delays and typing indicators, and fixing linkPreview support while cleaning up debug logging
New Features:
Bug Fixes:
Enhancements: