-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Alteração no whatsapp.baileys.service.ts para preservar o contextInfo completo no prepareMessage #1818
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
Closed
Conversation
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
Alteração realizada para preservar todos os metadados recebidos no contextInfo (incluindo ctwa_clid, ctwaPayload, conversionData e entryPointConversion*), unificando dados vindos de: - message.message[contentType].contextInfo - message.message.contextInfo - message.messageContextInfo Essa mudança evita a perda de informações enviadas pela Meta em diferentes níveis da estrutura da mensagem, garantindo que esses campos sejam repassados integralmente para o webhook, permitindo integrações completas com a API de Conversões.
Contributor
Reviewer's GuideEnhance prepareMessage to aggregate all contextInfo metadata from various message layers, ensuring no metadata is lost when forwarding messages to the webhook. Class diagram for prepareMessage contextInfo aggregationclassDiagram
class BaileysStartupService {
+prepareMessage(message: proto.IWebMessageInfo): any
}
class proto.IWebMessageInfo {
+key
+pushName
+status
+message
+messageContextInfo
+messageTimestamp
+participant
}
BaileysStartupService --> proto.IWebMessageInfo : uses
class MessageRaw {
+key
+pushName
+status
+message
+contextInfo
+messageType
+messageTimestamp
+instanceId
+source
}
BaileysStartupService ..> MessageRaw : returns
class ContextInfo {
+ctwa_clid
+ctwaPayload
+conversionData
+entryPointConversion*
+...otherMeta
}
MessageRaw o-- ContextInfo : contextInfo
Flow diagram for contextInfo merging in prepareMessageflowchart TD
A[Start prepareMessage] --> B{Extract contentType}
B --> C[Get contentMsg]
C --> D[Extract contentMsg.contextInfo]
C --> E[Extract message.message.contextInfo]
C --> F[Extract message.messageContextInfo]
D --> G[Merge all contextInfo sources]
E --> G
F --> G
G --> H{Any contextInfo present?}
H -- Yes --> I[Set contextInfo in messageRaw]
H -- No --> J[contextInfo undefined]
I --> K[Return messageRaw]
J --> K
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
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 @MailoncBerni - I've reviewed your changes - here's some feedback:
- The variable
contentMsgis no longer used in the merging logic and can be removed to clean up the code. - Consider renaming the
mmvariable to something more descriptive (e.g.messagePayloadorcontentMap) to improve readability. - If
contextInfomay contain nested objects, you might want to use a deep-merge utility instead of a shallow merge to avoid inadvertently overwriting nested fields.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The variable `contentMsg` is no longer used in the merging logic and can be removed to clean up the code.
- Consider renaming the `mm` variable to something more descriptive (e.g. `messagePayload` or `contentMap`) to improve readability.
- If `contextInfo` may contain nested objects, you might want to use a deep-merge utility instead of a shallow merge to avoid inadvertently overwriting nested fields.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
retirada do const contentMsg = message?.message[contentType] as any; pois Não utiliza mais
Closed
1 task
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.
Alteração realizada para preservar todos os metadados recebidos no contextInfo (incluindo ctwa_clid, ctwaPayload, conversionData e entryPointConversion*), unificando dados vindos de:
Essa mudança evita a perda de informações enviadas pela Meta em diferentes níveis da estrutura da mensagem, garantindo que esses campos sejam repassados integralmente para o webhook, permitindo integrações completas com a API de Conversões.
Summary by Sourcery
Enhancements: