loading...
Cover image for How to send WhatsApp messages for free and reliably with only 3 lines of code? Python

How to send WhatsApp messages for free and reliably with only 3 lines of code? Python

aahnik profile image Aahnik Daw ・1 min read

Wondering how to send WhatsApp messages using Python using only 3 lines of code? You have come to the right place!

You can do so by using a simple tool wappdriver.

Look!

Installation?

Its hassle-free.

Just pip install wappdriver

Why wappdriver?

  • fast and reliable
  • WhatsApp's website structure may change, the selectors can be updated over the internet dynamically, without changing code.
  • chrome Driver path setting is hassle-free
  • actively maintained
  • fast support, if you need help
  • send messages with bold, italics, or strikethrough
  • send emojis smiley
  • send images, videos, and gifs
  • send documents and files
  • can set a custom timeout, so that runs properly on old computers or with a slow internet connection
  • more features to be added

Know more

Requirements

Just Chrome Browser and Chrome Driver.

Documentation

Just go to https://aahnik.github.io/wappdriver. You will get all details.

Note

This code is in no way affiliated with, authorized, maintained, sponsored, or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software.

This project is distributed under the MIT License.

Questions ?

If you have any questions, you can write it in the comments below, or create an issue in GitHub repo of wappdriver.

Posted on by:

aahnik profile

Aahnik Daw

@aahnik

love coding, physics, and math...

Discussion

pic
Editor guide
 

Do we need to be logged in WhatsApp web for it to work? I didn't quite understand how it sends the message. Also, what about contacts saved as numbers only (no name but only phone number)?

 

Hi ! Thanks for asking. When you run the code shown, chrome will open whatsapp web. For the first time you need to scan QR code to login to whatsapp.

You can send only to saved contacts.

Otherwise whatsapp may block you for spamming.

For contacts saved only as phone number, it will work. Just put the phone number instead of name , in the to parameter of the send method

 

Amazing! Do we need to include the full number (with country code) like +1123456789 or only 123456789 will work?

exactly same as saved. Number must be saved