Yo! Use WhatsApp from the command line.
Chat everywhere you couldn't before... like at your desk. Hah 🐸
You can send and receive text messages.
- Send and receive messages to and from any contact/group in your WhatsApp from command line.
- Switch between different chats from command line.
- You can only send/receive text messages. Emoji, image, audio, video or anything else is not supported right now. Yeah, it sucks, I know. But.. but it's command-line.
- Python 3 Tested with 3.7.9 Python 2 will not work
- selenium Tested with 3.141.0
- ChromeDriver Tested with 86.0.4240.22
- Chrome Web Browser compatible with the ChromeDriver version you downloaded. (Eg. ChromeDriver 86.0.4240.22 supports Chrome v86). You can get this info from the ChromeDriver download page.
- Clone this repository.
$ git clone https://github.com/zvovov/whatsapp-web.git - Install selenium.
$ sudo pip install selenium - Download and extract ChromeDriver.zip
- Put path to ChromeDriver executable in the line
'chromedriver_path': '/path/to/chromedriver'inchat.pyfile of this repository.
$ python chat.py <name>
- Replace
<name>with the name of a contact or a group in your WhatsApp. Even partial names will work. - Scan the QR code displayed on screen from the WhatsApp mobile app.
- Press
yin console after WhatsApp Web is done loading. - Chat. Chat. Chat.
sendto <name>
- Type it while
chat.pyis running. - Replace
<name>with the name of the contact/group you want to chat with now. Again, partial names will work. - You can switch between chats as many times you want. Unread messages will be displayed to you every time.
stopsending
- Type it while
chat.pyis running. - This will allow you to only see incoming messages. Your messages won't be sent. To send messages again, restart the script.
In chat.py file:
config = {
'chromedriver_path': '/path/to/chromedriver',
'get_msg_interval': 5, # Time (seconds). Recommended value: 5
'colors': True, # True/False. True prints colorful msgs in console
...
}
| Parameter | Use |
|---|---|
'chromedriver_path' |
Path to the chromedriver executable on your system |
'get_msg_interval' |
Time in seconds between each check for new incoming messages. Eg. 'get_msg_interval': 5 would check the active chat for any new messages every 5 seconds. |
'colors' |
Boolean flag for coloured console output. If you want colorful messages in console, different colors for incoming and outgoing messages, set this to True. Otherwise, if you're seeing weird symbols like [92m, [0m around each message, set this to False. |
Press Ctrl+C two times.
Not affiliated with WhatsApp.