This website collects cookies to deliver better user experience
Automating WhatsApp with python!
Automating WhatsApp with python!
Hello there!
Today we'll be talking about this awesome Python package that lets you Automate WhatsApp.
Package intro
Installation: pip3 install pywhatkit
Apart from being a WhatsApp API kinda package it also has a lot of other features, it is also a very light weight package and ideal for production usage.
Some important functions we'll be seeing in this review blog are:
Send automated messages in WhatsApp.
Send automated images in WhatsApp.
Play a video on YouTube using PyWhatkit.
Convert text to handwritten texts.
Sending messages using Pywhatkit
import pywhatkit as pw
pw.sendwhatmsg("+XXxxxxxxxxxx","Your message here",'hour','min')
Explanation:
The first argument("+XXxxxxxxxxxx") is the phone number of the recipient, the second parameter("Your message here") is the message parameter where you enter the content of the text.
The 3rd parameter('hour') is the hour at which the message is to be sent, and the 4th('min') one is the minute of the hour at which it should be sent.
Note that the hour should be in the 24 hour format.
Sending images using PyWhatkit
import pywhatkit as pw
pw.sendwhats_image(phone_no="enter phone number with country code", img_path="C:/Users/user/desktop/image.jpg", caption="Example image sent!")
Explanation:
The first parameter is the phone number of the recipient(phone_no="phone number with country code").
The second parameter is the path of the image that is to be sent(img_path="C:/Users/user/desktop/image.jpg").
The third parameter is the caption text for the image that is to be sent (caption="Example image sent!").
Playing a video on YouTube
import pywhatkit as pw
pw.playonyt("Your topic or video here")
Explanation:
The top most video related to that topic will play on YouTube.
Convert Text to Handwritten Text in Image format
import pywhatkit as pw
pw.text_to_handwriting("Your text here!")
Explanation:
The only parameter here is the text parameter, the given input is then converted into handwritten text.
This it for this tutorial!
Misc links related to PyWhatkit
Hope this tutorial helped you gain some insight on WhatsApp automation using Python! Stay tuned for more awesome tutorials and packages.