DEV Community

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

Posted on • Updated on

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

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.



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


Just Chrome Browser and Chrome Driver.


Just go to You will get all details.


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 or Suggestions?

If you have any questions, or if you want to discuss something with the community, please come to the wappdriver Discussion Forum.

Top comments (20)

sankalpsriva profile image
sankalpsriva • Edited

I added the wrong path how and then keep getting the error of "Chromedriver not loaded"
How do I change the path so it can work again?
EDIT: I found the GitHub discussion of changing your set PATH but now I am getting an error about unicode truncation after I made it into a raw string I get a permisson error.

aahnik profile image
Aahnik Daw
chepi_deleon profile image
José Alfredo de León

I'm gettting the error: "ChromeDriver not loaded". Could you provide any help?

aahnik profile image
Aahnik Daw

Please post the details in the discussion forum.

Please provide additional details.

have you installed chrome driver ? the correct matching verison ?
have you entered the correct path when prompted ?

anuradha profile image
Anuradha Fernando

Hi José,
Set the ChromeDriver path when you call the webdriver.Chrome.
browser = webdriver.Chrome('/home/user/Python/ChromeDriver/chromedriver')

tranvytdt profile image

anyone have this error like me
Traceback (most recent call last):
File "", line 1, in
from wappdriver import WhatsApp
File "/home/username/.local/lib/python3.8/site-packages/wappdriver/", line 24, in
from .local import set_chrome_driver_path, update_selectors
File "/home/username/.local/lib/python3.8/site-packages/wappdriver/", line 11, in
from verlat import latest
ImportError: cannot import name 'latest' from 'verlat' (/home/username/.local/lib/python3.8/site-packages/verlat/

ag422 profile image

Can we also send messages to groups or only to people?

aahnik profile image
Aahnik Daw

you can send messages to groups also. just put the name of group, in the to parameter

aahnik profile image
Aahnik Daw • Edited

You can send messages to Groups also. Just use the name of the group in the recipient's name.

daksh777 profile image
Daksh P. Jain

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)?

aahnik profile image
Aahnik Daw • Edited

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

daksh777 profile image
Daksh P. Jain

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

Thread Thread
aahnik profile image
Aahnik Daw

exactly same as saved. Number must be saved

lcheuk profile image

It doesn't support if the name contains space.

aahnik profile image
Aahnik Daw

can you show a screen recording ? or terminal output ?
it is expected to work

pooriabt profile image

hii aahnik
i check your githubs link (full documentation), but it links to same page, im looking for a way to send some pdf files to some different people.

amaboula profile image

Hello I have this error

cannot import name 'WhatsApp' from partially initialized module 'wappdriver' (most likely due to a circular import)

aahnik profile image
Aahnik Daw

did you name your file ? Dont do that. Learn more about imports.

And by the way, wappdriver is not more maintained. See the github repo for notice.

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more