You can automate WhatsApp messages with only two lines of python code. PyWhatKit is a Python library for Sending WhatsApp message at certain time, it has several other features too.
This library can be installed by the pip command, open your command prompt and type in the following command...
pip install pywhatkit
- Install the PyWhatKit library using terminal by the pip command given below.
pip install pywhatkit
-
Open new project in your preferred Python IDE
-
Import pywhatkit library
import pywhatkit
- Call sendwhatmsg function and enther the parameters
pywhatkit.sendwhatmsg('+911234567890', 'Sample Message', 8, 23)
phone_num
(required) - Phone number of target with country code
message
(required) - Message that you want to sendwhatmsg
time_hour
(required) - Hours at which you want to send message in 24 hour format
time_min
(required) - Minutes at which you want to send message
wait_time
(optional, val=20) - Seconds after which the message will be sent after opening the web
print_waitTime
(optional, val=True) - Will print the remaining time if set to true
CountryCodeException
- Check if the phone number passed into the parameter has country code
Message not getting delivered
- Check internet speed and increase wait_time to 30 or above
CallTimeException
- The web takes some time to load so some delay is required, make sure the seconds left is greater than the wait_time
SyntaxError
- Make sure the first two parameters are string and the rest are int
Made with 💜.