Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 2.88 KB

README.md

File metadata and controls

81 lines (62 loc) · 2.88 KB

whatsapp_bot

Automation whatsapp DON'T use it for spam

Setup

$ git clone https://github.com/emichester/whatsapp_bot.git
$ cd whatsapp_bot
$ mkdir config && touch config/data.py
$ mkdir -p config/session && touch config/session/session.ini
$ touch messages.py
$ echo "
[SESSION]
session_id = ''
executor_url = ''
" > config/session/session.ini
$ 
$ chmod +x bot_whatsapp_firefox_init.py
$ chmod +x bot_whatsapp_firefox_instance.py

Go to your favorite web browser and find the user data folder, here you have the firefox default directory. Once you have it:

$ echo "USER_DATA_PATH = 'path/to/your/user/data/folder'" > config/data.py

If you use Firefox

Download "geckodriver" from here. Then:

$ tar -xvzf geckodriver*
$ chmod +x geckodriver
$ sudo mv geckodriver /usr/bin/

Usage

Define the messages you want to be sent by oppening messages.py, look at the following example.

messages = {
    'contact 1' : """
The message for the contact 1.
The last line will be sent alone as it has a \\n at the end of the line.
""",
    'contact 2' : """This message will be sent all together because it doesn't have a endline character. This one also.""",
}

Open a bash (main bash) in the folder, install the requirements.txt and do the following.

$ ./bot_whatsapp_firefox_init.py

Scan the QR code (I couldn't automate this step), and in another bash.

$ ./bot_whatsapp_firefox_instance.py

Modify the instance for the purpose you want to use it.

IMPORTANT: to close the webdriver just press enter in the main bash, this will automatically close the webdriver. Or you can call the close_father_webdriver(drive) method to it.

Extra

See more about selenium here. And for the options: Firefox, Chrome, ...