Pywhatkit : Python Library to Automate Emails, WhatsApp Messages and much more!

Amal
2 min readMar 16, 2022

Introduction :

A simple easy to use library that helps you to automate Emails, play Youtube videos, send Whatsapp messages with just one command. Isn’t that cool? 😀

Features

At the time of this articles, these are currently the features :

  • Sending Message to a WhatsApp Group or Contact
  • Sending Image to a WhatsApp Group or Contact
  • Converting an Image to ASCII Art
  • Converting a String to Handwriting
  • Playing YouTube Videos
  • Sending Mails with HTML Code

Installation

pip install pywhatkit

Clone Repository

git clone https://github.com/Ankit404butfound/PyWhatKit.git
cd PyWhatKit

Automate Email

import pywahtkitpywhatkit.start_server()# note : password is the app password you should generate from emailpywhatkit.send_mail(email_sender, password, subject, message, email_receiver

Have doubts on creating app password? Follow this link.

Send HTML contents on email by :

# pywhatkit uses smtplib on backend to send email# this function is inside pywhatkit folder mail.py, call this function and pass necessary arguments.send_hmail(email_sender, password, subject, html_code, email_receiver)

Automate Whatsapp Message

# Send a WhatsApp Message to a Contact at 1:30 PM
pywhatkit.sendwhatmsg("+910123456789", "Hi", 13, 30)

# to Close the Tab in 2 Seconds after Sending the Message
pywhatkit.sendwhatmsg("+910123456789", "Hi", 13, 30, 15, True, 2)

# Send an Image to a Group with the Caption as Hello
pywhatkit.sendwhats_image("AB123CDEFGHijklmn", "Images/Hello.png", "Hello")

# Send an Image to a Contact with the no Caption
pywhatkit.sendwhats_image("+910123456789", "Images/Hello.png")

# Send a WhatsApp Message to a Group at 12:00 AM
pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "Hey All!", 0, 0)

# Send a WhatsApp Message to a Group instantly
pywhatkit.sendwhatmsg_to_group_instantly("AB123CDEFGHijklmn", "Hey All!")

Play Video on Youtube

# Plays Lovely by billie ellish on youtube
pywhatkit.playonyt("lovely by billie")

Python package : https://pypi.org/project/pywhatkit/

Github : https://github.com/Ankit404butfound/PyWhatKit

Hope you learned something new today, Happy Learning!

--

--