Automate WhatsApp messages with python

Automate WhatsApp messages with python

Published at - Oct 18, 2021

You can automate your WhatsApp message with just two lines of python code, and also you can schedule to send messages at midnight while you'll be sleeping. To automate your WhatsApp you to python installed in your system and any text editor or IDE (Integrated Development Kit).

Sometimes we need to schedule and send messages at a particular time. Hence WhatsApp not providing this feature to schedule and message so, I think to provide the tutorial to solve this problem. This is very simple so let's get started.

Click here to read

Install required packages

To automate WhatsApp you need to install pywhatkit package. This package is providing many awesome features with WhatsApp you can checkout here. So to install pywhatkit open your terminal and run the following command:

pip install pywhatkit

Now you are ready to go.

Send message with scheduling


To send a WhatsApp message with the schedule you have used the built-in method sendwhatmsg(...).

The parameters are

  • phone_num (required) - Phone number of the target with country code
  • message (required) - Message that you want to sendwhatmsg
  • time_hour (required) - Hours at which you want to send a message in 24-hour format
  • time_min (required) - Minutes at which you want to send a message
  • wait_time (optional, val = 20) - Seconds after which the message will be sent after opening the web
  • print_wait_time (optional, val = True) - Will print the remaining time if set to true
  • tab_close (optional, val = False) - True if you want to close the tab after sending the message


import pywhatkit as pwk

pwk.sendwhatmsg("+911212121212","This is test message", 12,14)

Send image with caption

To send an image, Gif, or video with a caption we have to use sendwhats_image(...) method.

The parameters are

  • phone_no (required) - Phone number of the target with country code
  • img_path (required) - Path to image or gif or video
  • caption (required) - The text that should appear below images
  • wait_time (optional, val = 15) - Seconds after which the message will be sent after opening the web


import pywhatkit as pwk

pwk.sendwhats_image(phone_no="+911212121212",img_path="path_to_image",caption="This is test message")


The pywhatkit is a very useful package especially when you want to automate WhatsApp messages this provides an easy way to solve your difficult problem and reduce code. This package also provides some other cool stuff like playonyt(...) play video on youtube, search(...) to search on google, info(...) to fetch information about any topic, image_to_ascii_art(...) to convert any image to ASCII art, text_to_handwriting(...) to convert text to handwriting format you can refer to this link to read everything in more details.

I hope you love this quick tutorial to "How you can automate WhatsApp message with python?". If you like this article please clap, and provide your response. Please follow me to get more tutorials like this.

You can also check out some cool articles here -

How to create a screen and webcam recorder using python

Make Your Own Chrome Browser with Python PyQt5

Create a Python-based Internet Speed Test GUI App: A Guide

Face Recognition in Under 25 Lines of Python Code

Python GUI Desktop App to Download YouTube Video — Python Coding

Github Url

About author

Harendra Kanojiya

Hello, I am Harendra Kumar Kanojiya - Owner of this website and a Fullstack web developer. I have expertise in full-stack web development using Angular, PHP, Node JS, Python, Laravel, Codeigniter and, Other web technologies. I also love to write blogs on the latest web technology to keep me and others updated. Thank you for reading the articles.

Related Posts -

Make Your Own Chrome Browser with Python PyQt5
Make Your Own Chrome Browse ...

In this step-by-step Python coding tutorial, I will show you how to create ...

Follow Us

Follow us on facebook Click Here

Facebook QR
Scan from mobile
Join our telegram channel Click Here
Telegram QR
Scan from mobile