WhatsApp Automator. A Guide For Abecedarian Programmers.

Posted by : Ali Khundmiri Last Updated : June 18, 2017, 11:56 p.m.

Hello,

So you saw this whatsapp automator and wanted to use it for yourself?
Great please do.
wait? what was that? You don't know how!. Hey don't worry, I got your back.

Please pardon my inner narrative impulse, It cant be controller.

Lets get right into the how to Guide.

Installing Python 3

First of all, you will need to have python on your computer system. IF you have a Mac machine or a Linux, your system came preinstalled with python. Just make sure you have python 3.

Installing Python is fairly a simple process and there are lots of guides available on internet. I will be posting a link here.

How to Download and Install Python 3.6 on Windows 10 - Youtube

Installing the file

Now that we have installed python, we can move on and download, the project file from Github from this link here
or visit
https://github.com/alikhundmiri/chat-Remainder

here, you need to download the file.
click button "Clone or download" > "Download ZIP"

You can choose the location of download, I suggest choosing desktop, for the sake of easy navigation in terminal. This should download the necessary files after you Unzip it.

Taking care of Text Files

In the download file, You have two folders
1. List
2. Chat_templates

Each folder (a.k.a. Directory) has three text files. We have to edit all of them.

List
In this directory you will find files named,
1. family.txt
2. friends_n.txt
3. friends_nm.txt

family.txt : This file must have names of your relatives you wish to be in contact with. Each name should be in a new line.
friends_n.txt : This file must contain names of your friends who you wish to be in contact with.
friends_nm.txt : This file must contain names of your friends who you wish to be in contact with.

chat_templates
In this directory you will find files named,
1. chats_1.txt
2. chats_2.txt
3. chats_3.txt

Each of these file will contain some salutations in English and Hindi/Urdu. I apologise if you don't speak those languages, you are free to change to your oneliners.

Message Pattern

Now if you are asking who do i have 3 files for contacts and messages? well be


  1. People in List/family.txt will get messages from chat_templates/chats_1.txt with Salutation

  2. People in List/friend_n.txt will get messages from chat_templates/chats_2.txt with Salutation

  3. People in List/friends_nm.txt will get messages from chat_templates/chats_3.txt without Salutation.

    NOTE : please make sure the names you right in here, are exactly the names you wrote in your phone's contact list.


Installing Libraries

Now we have to install certain libraries, named selenium version 3.0.2

For this, first of all open Terminal.
Since this is just a single library, we can type in
pip install selenium==3.0.2

BUT WAIT.

The Usual convention is to install everything placed in the requirements.txt file.
For this type,
pip install -r requirements.txt
This will install all the libraries inside requirements.txt file.

What is selenium any ways!
Selenium is a web browser automator library. It can be used to automate any process which is repetitive on a website.
The script I wrote here uses Chrome as default browser. so... we need to download chromedriver.
A much detailed study here on use of chromedriver.

Guide for installing Chromedriver, for Mac

Configure Chromedriver for Selenium webdriver on MAC and Window

Guide for installing Chromedriver, for PC

Install Chrome Driver for Windows

Running The Program

Open the terminal in the file location, i.e. desktop in our case.
and type

python whatsapp_automater.py

This should start the script, and in a few seconds, a new chrome browser will open up. This will be a new chrome browser, i.e. it will not have your saved files and passwords.
follow along with the details it shows on terminal, and when it prompts, respond how wish to work today.
It should automatically open up web.whatsapp.com, and ask you to scan the barcode.

Now open your whatsapp in phone
Click on the three dots in whatsapp main screen and select "Whatsapp Web"
on the top right, click on the + sign
and scan the bar code.

We are now working!!! This script will keep messaging people on your list, and you can carry on with chatting with them when they respond.

NO THIS IS NOT A CHATTING BOT. IT WILL ONLY INITIATE CHATS.

If you have any doubts, please comment here on quora