Over the years, python has emerged as one of the most effectively vast programming languages and everyday people use it to do cool things like Automation, A.I and also to build our various applications and websites.
Thus, I've decided to be adventurous and play around with little things which include making a digital clock, Email-Automation as well as automating my WhatsApp messages with python.
In this article, I'd be sharing with you guys how I've been able to automate my WhatsApp messages with just two lines of python code.
A lo largo de los a帽os, Python se ha convertido en uno de los lenguajes de programaci贸n m谩s amplios y efectivos y la gente com煤n lo usa para hacer cosas geniales como automatizaci贸n, IA y tambi茅n para crear nuestras diversas aplicaciones y sitios web.
Por lo tanto, he decidido ser aventurero y jugar con peque帽as cosas que incluyen hacer un reloj digital, Automatizaci贸n de correo electr贸nico y automatizar mis mensajes de WhatsApp con python.
En este art铆culo, compartir茅 con ustedes c贸mo he podido automatizar mis mensajes de WhatsApp con solo dos l铆neas de c贸digo python.
https://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png
WHATSAPP AUTOMATIONhttps://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png
Automating WhatsApp comes with lots of advantages even though we have several applications that can automate our WhatsApp messages. There's a slight difference between automating WhatsApp messages with an external application or via WhatsApp itself and automating WhatsApp with python.
Automating your WhatsApp with python gives you the room to target your desired contact and a specific message you want them to receive as well as the time in which the message should be sent to them.
However, automating your WhatsApp with an external app most times would require a message from the group or contact itself upfront before sending a specified message to them and this isn't the contact targeted, for it sends the message to any group or contact that gives the required message.
So without further ado, let's get right into the tools needed for making WhatsApp automation via python code.
Tools for WhatsApp automation
- A laptop
- Installation of python if you haven't
- A code editor (preferably an IDE)
- Python module (Pywhatkit)
- An Internet connection
- A web browser (chrome, firefox, brave e.t.c..)
- And of course a WhatsApp account
Automatizar WhatsApp tiene muchas ventajas, aunque tenemos varias aplicaciones que pueden automatizar nuestros mensajes de WhatsApp. Hay una ligera diferencia entre automatizar los mensajes de WhatsApp con una aplicaci贸n externa o a trav茅s de WhatsApp y automatizar WhatsApp con python.
La automatizaci贸n de su WhatsApp con python le brinda la posibilidad de dirigirse a su contacto deseado y un mensaje espec铆fico que desea que reciban, as铆 como el momento en que se les debe enviar el mensaje.
Sin embargo, automatizar su WhatsApp con una aplicaci贸n externa la mayor铆a de las veces requerir铆a un mensaje del grupo o un contacto por adelantado antes de enviarles un mensaje espec铆fico y este no es el contacto objetivo, ya que env铆a el mensaje a cualquier grupo o contacto que da el mensaje requerido.
Entonces, sin m谩s pre谩mbulos, entremos directamente en las herramientas necesarias para hacer la automatizaci贸n de WhatsApp a trav茅s del c贸digo python.
Herramientas para la automatizaci贸n de WhatsApp
- Un ordenador port谩til
- Instalaci贸n de python si no lo has hecho
- Un editor de c贸digo (preferiblemente un IDE)
- M贸dulo Python (Pywhatkit)
- Una conexi贸n a Internet
- Un navegador web (Chrome, Firefox, Brave, etc.)
- Y por supuesto una cuenta de WhatsApp
https://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png
STEPS TO AUTOMATEhttps://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png
-
Installation of python comes first before you can be able to run python code on your machine for this would serve as an interpreter on your editors when your python codes need to be executed. That being said, it is advised to install python 3.8, 3.9 and above on your machine to be able to access some features that might not be in the lower versions.
-
Download a text editor. I prefer using pycharm in executing my python codes because it's one of the best IDEs for running python code.
Open your pycharm or your preferred editor and create a python project
-
La instalaci贸n de python es lo primero antes de que pueda ejecutar el c贸digo python en su m谩quina, ya que esto servir铆a como int茅rprete en sus editores cuando sea necesario ejecutar sus c贸digos python. Dicho esto, se recomienda instalar Python 3.8, 3.9 y superior en su m谩quina para poder acceder a algunas funciones que podr铆an no estar en las versiones anteriores.
-
Descarga un editor de texto. Prefiero usar pycharm para ejecutar mis c贸digos python porque es uno de los mejores IDE para ejecutar c贸digo python.
Abra su pycharm o su editor preferido y cree un proyecto de python
My project is named "Whatspyth". However, Ensure to select your project interpreter as your installed python version if you're just making the installation as shown in the image above.
After creating your project, you get a working space to write your python code.
- The next step is to install the module that allows us to make use of WhatsApp automation.
Pywhatkit is one of the beautiful libraries with several features on python that allows us to automate our WhatsApp with just a few codes.
Thus, to install Pywhatkit ensure that your machine is connected to the internet. Go to Google and type "Pywhatkit" in the search box.
Mi proyecto se llama "Whatspyth". Sin embargo, aseg煤rese de seleccionar su int茅rprete de proyecto como su versi贸n de python instalada si solo est谩 realizando la instalaci贸n como se muestra en la imagen de arriba.
Despu茅s de crear su proyecto, obtiene un espacio de trabajo para escribir su c贸digo python.
- El siguiente paso es instalar el m贸dulo que nos permite hacer uso de la automatizaci贸n de WhatsApp.
Pywhatkit es una de las hermosas bibliotecas con varias funciones en python que nos permite automatizar nuestro WhatsApp con solo unos pocos c贸digos.
Por lo tanto, para instalar Pywhatkit, aseg煤rese de que su m谩quina est茅 conectada a Internet. Vaya a Google y escriba "Pywhatkit" en el cuadro de b煤squeda.
You then click on the first link which brings you to the page shown in the image below
Luego hace clic en el primer enlace que lo lleva a la p谩gina que se muestra en la imagen a continuaci贸n.
Copy the text "pip install pywhatkit"
- Go back to your working space on your code editor and navigate to your terminal. paste the copied text to the terminal and click on Enter.
Copie el texto "pip install pywhatkit"
- Regrese a su espacio de trabajo en su editor de c贸digo y navegue a su terminal. pegue el texto copiado en la terminal y haga clic en Entrar.
Then the module starts to download
Entonces el m贸dulo comienza a descargarse
This may take a few minutes depending on how strong your internet connection is.
You then get a successfully installed message which stipulates that our WhatsApp automation module is fully ready to be imported.
However, you may encounter a few bugs while trying to install your pywhatkit, here are a few tips you might wanna try to fix the installation errors;
Use "pip install pipwin" if this doesn't work too, try "pipwin install pywhatkit" if this doesn't work too then try "pip install pywhatkit --upgrade"
If any of the methods above still doesn't work, then you might wanna try upgrading your python.
However, if you were able to download the module successfully but feel adventurous trying to figure out where the module is being located on your machine, follow the steps in the image below.
Esto puede demorar unos minutos dependiendo de qu茅 tan fuerte sea su conexi贸n a Internet.
Luego recibe un mensaje de instalaci贸n exitosa que estipula que nuestro m贸dulo de automatizaci贸n de WhatsApp est谩 completamente listo para ser importado.
Sin embargo, es posible que encuentre algunos errores al intentar instalar su pywhatkit, aqu铆 hay algunos consejos que puede intentar corregir los errores de instalaci贸n;
Use "pip install pipwin" si esto tampoco funciona, intente "pipwin install pywhatkit" si esto tampoco funciona, intente "pip install pywhatkit --upgrade"
Si alguno de los m茅todos anteriores a煤n no funciona, es posible que desee intentar actualizar su python.
Sin embargo, si pudo descargar el m贸dulo con 茅xito pero se siente aventurero tratando de averiguar d贸nde se encuentra el m贸dulo en su m谩quina, siga los pasos en la imagen a continuaci贸n.
Also, ensure to link your WhatsApp to your browser via WhatsApp web if you haven't done that before now.
- The next step is to import the installed module to start the automation as shown below.
You import the module by typing "import pywhatkit" and then press Enter key to move to the next line.
You then type the code below to initiate the WhatsApp automation. Note that this is case sensitive which means your modules have to be typed in lower case.
pywhatkit.sendwhatsmsg("phone number", "message to be sent", hour, minutes)
Ensure your country code is well-typed before adding the phone number for there might be an error regarding the country code.
Also, the hour and minutes indicate the time in which you want the message to be sent to the receiver
In my own WhatsApp automation, I chose to send my message to my favourite hive mentor @starstrings01 for those of you who know him.
After you must have written the code correctly, go ahead and run the program.
Adem谩s, aseg煤rese de vincular su WhatsApp a su navegador a trav茅s de la web de WhatsApp si no lo ha hecho antes.
- El siguiente paso es importar el m贸dulo instalado para iniciar la automatizaci贸n como se muestra a continuaci贸n.
Importa el m贸dulo escribiendo "importar pywhatkit" y luego presiona la tecla Intro para pasar a la siguiente l铆nea.
Luego escriba el c贸digo a continuaci贸n para iniciar la automatizaci贸n de WhatsApp. Tenga en cuenta que esto distingue entre may煤sculas y min煤sculas, lo que significa que sus m贸dulos deben escribirse en min煤sculas.
pywhatkit.sendwhatsmsg("n煤mero de tel茅fono", "mensaje a enviar", hora, minutos)
Aseg煤rese de que el c贸digo de su pa铆s est茅 bien escrito antes de agregar el n煤mero de tel茅fono, ya que podr铆a haber un error con respecto al c贸digo de pa铆s.
Adem谩s, la hora y los minutos indican la hora en la que desea que se env铆e el mensaje al receptor.
En mi propia automatizaci贸n de WhatsApp, eleg铆 enviar mi mensaje a mi mentor de colmena favorito @starstrings01 para aquellos de ustedes que lo conocen.
Despu茅s de haber escrito el c贸digo correctamente, contin煤e y ejecute el programa.
-
Once your machine time gets to the time on your code, your browser will be opened and the message will be sent to your receiver.
-
Una vez que el tiempo de su m谩quina llegue a los tiempos de su c贸digo, su navegador se abrir谩 y el mensaje se enviar谩 a su receptor.
Hence, If you have been dying to try something like this out, you might wanna get your hands on it and try it out as this doesn't need a professionalism. You can send a birthday greetings message or other lovely greetings just with this cool technique.
IF YOU'VE GOT VALUE FROM THIS POST, KINDLY GIVE YOUR LOVELY COMMENTS. ALSO, UPVOTES AND REBLOGS WOULD BE MUCH APPRICIATED.
THANKS FOR READING 馃ぉ馃ぉ
Por lo tanto, si te has estado muriendo por probar algo como esto, es posible que quieras tenerlo en tus manos y probarlo, ya que esto no necesita profesionalismo. Puede enviar un mensaje de felicitaci贸n de cumplea帽os u otros saludos encantadores solo con esta t茅cnica genial.
SI USTED TIENE VALOR DE ESTA PUBLICACI脫N, POR FAVOR DAR SUS ENCANTADORES COMENTARIOS. TAMBI脡N, LOS UPVOTES Y REBLOGS SER脥AN MUY AGRADECIDOS.
GRACIAS POR LEER 馃ぉ馃ぉ