Skip to content
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: ID type definition of Contact model #2285

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

gekkedev
Copy link
Contributor

From what I observed, this is a string (serialized format, user@server). If there are exceptions where it is actually a WID object, let me know and I'll adapt this PR.

@icleitoncosta icleitoncosta merged commit 12ddccd into wppconnect-team:master Aug 5, 2024
5 checks passed
Copy link

Pull Request Summary by devActivity

Metrics

Cycle Time: 14d 1h 42m

Achievements

@gekkedev gekkedev deleted the patch-3 branch September 28, 2024 15:42
@gekkedev
Copy link
Contributor Author

I might have been wrong on this:
client.getMessages(chatId) returns messages where the sender attribute is a Contact object. The attribute id is a WID, not a serialized string. In wa-js this is also defined as WID: https://github.com/wppconnect-team/wa-js/blob/4df7fee17ed071b461e2da28d8e6c9e7592c9739/src/whatsapp/models/ContactModel.ts#L28
However, I'm pretty sure I had a use case where it was a serialized string (need to find out when exactly for reproduction).
It could be, that the type of id depends on which methods we use to get a Contact object. 🤔

@icleitoncosta what is the desired state here?

  1. A union type for both possibilities? string | WID
  2. wa-js deserializing if necessary to always provide a WID
  3. wa-js serializing if necessary to always provide a string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants