All Projects → jctissier → Whatsapp Assistant Bot

jctissier / Whatsapp Assistant Bot

Licence: mit
A personal WhatsApp assistant bot that will help you search anything on the web (Google, Images, Google Maps)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Whatsapp Assistant Bot

Whatsappbot
Send messages to any person in any time how much you want.
Stars: ✭ 104 (-47.47%)
Mutual labels:  bot, whatsapp, selenium
whatabomb
A whatsapp bombing GUI Script
Stars: ✭ 84 (-57.58%)
Mutual labels:  selenium, chromedriver, whatsapp
Webwhatsappbot
Core to automatize whatsapp - working 11/2018
Stars: ✭ 59 (-70.2%)
Mutual labels:  bot, whatsapp, selenium
Instagram Profilecrawl
💻 Quickly crawl the information (e.g. followers, tags, etc...) of an instagram profile. No login required!
Stars: ✭ 110 (-44.44%)
Mutual labels:  selenium, chromedriver
Wa Automate Nodejs
💬 🤖 The most advanced NodeJS WhatsApp library for chatbots with advanced features. Be sure to 🌟 this repository for updates!
Stars: ✭ 1,326 (+569.7%)
Mutual labels:  bot, whatsapp
Sillynium
Automate the creation of Python Selenium Scripts by drawing coloured boxes on webpage elements
Stars: ✭ 100 (-49.49%)
Mutual labels:  selenium, chromedriver
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-60.1%)
Mutual labels:  bot, selenium
Whaticket
A very simple Ticket System based on WhatsApp messages, that allow multi-users in same WhatsApp account.
Stars: ✭ 120 (-39.39%)
Mutual labels:  bot, whatsapp
Whatsapp Api
Rest API to send messages through whatsapp
Stars: ✭ 112 (-43.43%)
Mutual labels:  bot, whatsapp
Nightwatch
End-to-end testing framework written in Node.js and using the Webdriver API
Stars: ✭ 10,912 (+5411.11%)
Mutual labels:  selenium, chromedriver
Magento Chatbot
Magento Chatbot Integration with Telegram, Messenger, Whatsapp, WeChat, Skype and wit.ai.
Stars: ✭ 149 (-24.75%)
Mutual labels:  bot, whatsapp
Wasapbot
[abandoned ❗] Simple WhatsApp bot written in PHP, respond to private & group messages. Uses Chat-API
Stars: ✭ 89 (-55.05%)
Mutual labels:  bot, whatsapp
Glastoselenium
A bot for booking Glastonbury tickets using selenium
Stars: ✭ 89 (-55.05%)
Mutual labels:  bot, selenium
Zillow
Zillow Scraper for Python using Selenium
Stars: ✭ 141 (-28.79%)
Mutual labels:  selenium, chromedriver
Code for fun
Some of my scripts to automate the boring stuff around me
Stars: ✭ 167 (-15.66%)
Mutual labels:  whatsapp, selenium
Whatsapp Node Api
A Simple NodeJS API Wrapper for WhatsApp
Stars: ✭ 81 (-59.09%)
Mutual labels:  bot, whatsapp
Webdrivermanager
WebDriverManager (Copyright © 2015-2021) is a project created and maintained by Boni Garcia and licensed under the terms of the Apache 2.0 License.
Stars: ✭ 1,808 (+813.13%)
Mutual labels:  selenium, chromedriver
Wappbot
Automatic answering of incoming messages by means of javascript and using Whatsapp Web
Stars: ✭ 55 (-72.22%)
Mutual labels:  bot, whatsapp
Whatsapp Bot
BOT - WhatsApp Web in TypeScript
Stars: ✭ 170 (-14.14%)
Mutual labels:  bot, whatsapp
Instagram Bot
An Instagram bot developed using the Selenium Framework
Stars: ✭ 138 (-30.3%)
Mutual labels:  bot, selenium

WhatsApp Assistant Bot

Demo

A personal WhatsApp assistant bot that will help you search anything on the web:
script is automated with selenium, the bot will check the chat and reply on valid commands

  • Search Google
  • Search Google Images
  • Directions from Google Maps
    • User can set {origin}, {destination} and {travelmode}

If bot fails when you first run it, please check and update if the class attribute for Line 13 has changed:

MESSAGE_BUBBLE_CLASS_NAME = "_13mgZ"

1) Inspect the Whatsapp text bubble element
2) Extract the class attribute and update Line 13

TODOs

Features

  • [x] Bot can poll 1 conversation
  • [ ] Bot can poll multiple assigned conversations
  • [x] Search Google
  • [x] Search Google Images
  • [x] Search Google Maps
  • [ ] Google Maps directions from user's location

Down the road

  • [ ] Remotely access the QR code
  • [ ] Image to text analysis w/ Pytesseract
  • [ ] Flask server running headless Chrome

Step by Step Guide

I have been receiving a lot of requests about what to do when the bot starts running. Here is a step by step example:

  1. Once the bot is running, it should automatically open chrome and display the whatsapp web QR code. Once you scan it, you should be able to see a list of your conversations, choose the one you want to test with. QR Code Scan

  2. Line 293 of whatsapp_assistant_bot.py can be changed to read incoming messages (other person in conversation) vs outgoing messages (your own messages)

text_bubbles = driver.find_elements_by_class_name("message-out")  # message-in = incoming, message-out = outgoing

Incoming vs Outgoing

  1. Example of sending commands and the bot scanning for outgoing messages (my messages) Test outgoing

  2. Example of asking the bot to google something. Since the bot is running on your computer, chrome will be automated by selenium and you will see a chrome page open, a screenshot will be taken and attached to the chat. Test Google

What You'll Need

  1. Install Chromedriver and make sure the Setup is completed (add the path to the chromedriver executable)

Chromedriver

  1. Install Selenium from your command line Selenium
$ pip3 install selenium

How to Run

Clone the repo

$ git clone https://github.com/jctissier/whatsapp-assistant-bot.git
$ cd whatsapp-assistant-bot
$ python3 whatsapp_assistant_bot.py

If you get an error at this stage, it's most likely due to Chromedriver not being installed properly. Repeat the first step.

Script is running properly if you see "Bot is active, scan your QR code from your phone's WhatsApp"

  • Scan your QR Code QR Code
  • Select a chat and start sending commands

Valid Commands

The bot will always send back screenshots of the Chrome browser

/google {query}              # Search google text
/images {query}              # Search google images
/maps                        # Directions with Google Maps
    /origin {from where}     # Sub-menus from /maps
    /dest {to where}
    /mode {driving, walking, transit, bicycling}

How Selenium Automates the Bot

I was able to scan incoming/outgoing messages by inspecting the HTML and using selenium to access on class names and xpath Scan Messages

Testing

You can either create a bot account (as mentioned below) or you can use your own account to test it.

  • In the function chat_history(), set the first line of the function to "message-out"
    • This allows the bot to only scan for messages sent by yourself
    • You can send commands to yourself and the bot will respond (no need for a spare account)
  • "message-in" forces to bot to scan for incoming messages from the other person

Flowchart for Main Features Flow Chart

How I Use It

I run the script from my home computer in Canada and I have a separate WhatsApp account running 24/7.

You can create a free WhatsApp account if you have a spare/old smartphone.

  • Charge the device 24/7, have it on Wifi and download WhatsApp on it (SIM card is not needed)
  • When they ask you to verify your WhatsApp and need a number to text
    • Download one of the many apps on app store which allows you to get a temporary phone number
      • For example, I use textPlus - FREE
      • Generate a free number and use it to verify your bot account
    • For the verification, ask for a call, answer the call and set the password
    • Account should now be created, you can now message the bot to that particular number that was generated with the app

There is plenty more that can be done with this bot, but I only needed basic googling.

Comments

Author: Jean-Claude Tissier
MIT License

I created this bot for when I travel since I have unlimited WhatsApp everywhere in the world but no data plan. I needed a way to be able to find directions, search for touristy attractions and general googling necessities in a new city without having data.

Feel free to grab the code and let me know if you have questions.

PS: This bot is not meant for spamming and is only meant for personal use.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].