fernandoepm1 / zapbot

A Python and Selenium bot to send memes and good morning messages to your family group.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zapbot

Description

A very simple and generic bot developed using Python and Selenium. He can be used as a starting point for some more complex operations depending on what's needed to be done.

What can it do?

  • Open a specific chat given the contact or group name
  • Send a message to the contact or group that was selected previously (depends on the previous method)
  • Send a media supported file by WhatsApp and optionally use a caption (if the file is an image), it also depends on previously opening a chat

Requirements

  • You need to have Git installed
  • You need to have Python installed
  • You need to have Selenium installed (you can install it via Pip)
  • You need to have a chosen webdriver installed

Dependencies

Install Git

You can find it here.

Install Python

You can find it here.

Install Pip (Ubuntu)

  1. If you're using Python 3.x

    $ sudo apt-get update
    
    $ sudo apt-get install python3-pip

    Check installed version

    $ pip3 --version

    Should return something like this

    #=> Output
    pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
  2. If you're using Python 2.x

    $ sudo apt-get update
    $ sudo apt-get install python-pip

    Check installed version

    $ pip --version

    Should return something like this

    #=> Output
    pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Install Selenium

  • If you're using Python 3.x and Pip3

    pip3 install selenium
  • If you're using Python 2.x and Pip

    pip install selenium

You can find the documentation here.

Install webdriver

In this project I'm using chromedriver (can be found and downloaded here, you just need to check your current Chromium/Chrome version before downloading).

If you want to use another webdriver, Firefox's for instance, you can find more details and links here.

Running bot locally

Clone this repo

git clone git@github.com:fernandoepm1/zapbot.git

Choose webdriver

  • Check your current Chromium/Chrome version and download the appropriate chromedriver (if you're using version Chromium 80 and linux64, the chromedriver in this project is already the right one)
  • If you don't want to use Chrome, then download the appropriate webdriver and change the code to instanciate the selected browser

Run script

  • Using Python 3.x

    python3 zapbot.py
  • Using Python 2.x

    python zapbot.py

Important: After the first time the script is run, it will create the profile folder to save your current session, WhatsApp will request the QRcode, but just for the first time (as long as the profile folder is there). It's possible the first time does not work because of the QRcode request, but after that it should work properly.

About

A Python and Selenium bot to send memes and good morning messages to your family group.

License:MIT License


Languages

Language:Python 100.0%