Kalebu / alright

Python wrapper for WhatsApp web-based on selenium
https://www.youtube.com/watch?v=yitQTt-NukM
MIT License
355 stars 109 forks source link

Simultaneous messaging to multiple contacts #85

Closed AtomicNess123 closed 1 year ago

AtomicNess123 commented 1 year ago

Excellent code. Is it possible to send a message to multiple contacts simultaneously?

Kalebu commented 1 year ago

Hi @AtomicNess123

Since Alright works by controlling the browser and not API integration, you can only send one message at a time but not concurrently, If you're sending to multiple contacts, the current best approach is to do it with a for-loop as shown below;

>>> from alright import WhatsApp
>>> messenger = WhatsApp()
>>> numbers = ['2557xxxxxx', '2557xxxxxx', '....']
>>> for number in numbers:
        messenger.find_user(number)
        messenger.send_message("I wish you a Merry X-mass and Happy new year ")

Hope that answers your question

AtomicNess123 commented 1 year ago

Thanks, of course, with a loop! Thanks!

Kalebu commented 1 year ago

You're welcome @AtomicNess123