Automate WhatsApp Messages with Python:
|We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.|
(1) Open the PyCharm code editor and create a new project in it. We named the project message_automation.py. To build a Whatsapp Message Automation program in Python, we need to install the package. For this open the terminal in PyCharm and install one package i.e. pywhatkit. You install this package by simply typing in the terminal following command i.e. pip install pywhatkit and then press enter as shown below.
Note: If the package shows an error while using in the code, you can simply install the package by clicking on the red bulb which appears below the error and you can directly install the package from here as shown below.
(2) Now login into your WhatsApp in the browser. After login, you can close the browser and write the below code. Your WhatsApp automatically opens and sends the message to the phone number which is mentioned in the code.
import pywhatkit as pw pw.sendwhatmsg('+91914907','Hello GK Scientist',11,29)