Skip to content

Comments

fix: getChatById when sending @ number.#1919

Open
Saifallak wants to merge 10 commits intowppconnect-team:mainfrom
Saifallak:patch-1
Open

fix: getChatById when sending @ number.#1919
Saifallak wants to merge 10 commits intowppconnect-team:mainfrom
Saifallak:patch-1

Conversation

@Saifallak
Copy link
Contributor

No description provided.

@Saifallak
Copy link
Contributor Author

@icleitoncosta can you check this?

@icleitoncosta
Copy link
Collaborator

Hey @Saifallak , do you can fix lint errors?

@Saifallak
Copy link
Contributor Author

Hey @Saifallak , do you can fix lint errors?

just now noticed your comment, fixed lints, and updated the code to the latest main.

@Saifallak
Copy link
Contributor Author

can you check why build is failing? @icleitoncosta any ideas?

@Saifallak Saifallak closed this May 1, 2025
@Saifallak Saifallak deleted the patch-1 branch May 1, 2025 16:06
@Saifallak Saifallak restored the patch-1 branch May 1, 2025 16:06
@Saifallak Saifallak reopened this May 1, 2025
@manfe
Copy link
Contributor

manfe commented Nov 11, 2025

This change is a breaking change, current implementation that do not send @c.us or @g.us, will have issue.

The best way to do it is just split on @ and keep first portion of it.

That way we can support current numbers and also @c.us and @g.us

Copy link
Contributor

@manfe manfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my suggestion to keep backwards compatibility, while supporting @c.us or @g.us

*/
const { phone } = req.params;
const { isGroup } = req.query;
const { isGroup = false } = req.query;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { isGroup = false } = req.query;
const normalizedPN = phone?.split('@')?.[0]
const { isGroup = false } = req.query;

Comment on lines +391 to +392
for (const contato of contactToArray(phone as string, isGroup as boolean)) {
result = await req.client.getChatById(contato);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const contato of contactToArray(phone as string, isGroup as boolean)) {
result = await req.client.getChatById(contato);
if (isGroup) {
result = await req.client.getChatById(`${normalizedPN}@g.us`);
} else {
result = await req.client.getChatById(`${normalizedPN}@c.us`);

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.

3 participants