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

feat : Check if the given number is a whatsapp number #54

Merged
merged 5 commits into from
Feb 17, 2020

Conversation

sahalMoidu
Copy link
Contributor

  • Avoids sending message to non whatsapp number (as it may lead to blocking by whatsapp)
  • Gets the id of the user from whatsapp server rather than generating on client

Implemented changes mentioned in SimiPrambos PR#28 (pedroslopez#52)
- Avoids sending message to non whatsapp number
- Gets the id of the user from whatsapp server rather than generating on client
src/util/Injected.js Outdated Show resolved Hide resolved
src/util/Injected.js Outdated Show resolved Hide resolved
Copy link
Owner

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

This seems to work fine, but error handling could be improved. Right now 404 is returned from within the browser, which isn't ideal.

Please throw the error on the nodejs side and/or make the error message clearer.

@sahalMoidu
Copy link
Contributor Author

404 meaning the not found. Its the same message whatsapp sends back

This is the first time I'm working with Puppeteer and I don't know the best way to pass the error to the nodejs side.

Could you recommend one.

@pedroslopez
Copy link
Owner

It’s fine, you could still throw it on the chrome side but make it more descriptive. The 404 doesn’t really say what’s wrong, maybe something like “The number provided is not a registered WhatsApp user.”

@sahalMoidu
Copy link
Contributor Author

Have updated the error message.

I too wanted to push the error directly to the node side so the user can better handle it. I think using emitting the error through events would be a better paradigm.

@pedroslopez
Copy link
Owner

Yeah we could do an event. We can address that in another pr or issue though.

@pedroslopez pedroslopez merged commit 1840826 into pedroslopez:master Feb 17, 2020
Belfio pushed a commit to Belfio/whatsapp-web.js that referenced this pull request Jan 9, 2024
* feat : Check if the given number is a whatsapp number

- Avoids sending message to non whatsapp number
- Gets the id of the user from whatsapp server rather than generating on client
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.

None yet

2 participants