Code Monkey home page Code Monkey logo

pywhapbot's Introduction

whapbot_logo PyPI version

WhatsApp Web API Wrapper for Chrome, Firefox, Opera, Brave and Edge.

Installation

pip install pywhapbot

Features

  • Automate the download of Selenium drivers
  • Send messages by phone number
  • Store WhatsApp Web sessions in all the browsers. (Edge only available on Windows)

Simple Usage

from whapbot import WhapBot

from autoselenium import Driver

with WhapBot('chrome', root='drivers') as bot:
    bot.set_window_position(420, 420)
    bot.send("+34123456789", "Hello world!")
    bot.refresh()

More advanced example

import time
from pywhapbot import WhapBot

whapbot = WhapBot(
    browser="firefox",
    driver_path="drivers/geckodriver.exe",
    profile_path="profiles/firefox-profile",
    proxy="169.210.345.10:4567",
    kiosk=True  # kiosk mode (not supported on opera)
)
whapmsgs = [("+34696969420", "Open!"),
            ("+34696942069", "Source!")]

with whapbot as bot:

    for idx, (phone, message) in enumerate(whapmsgs):
        bot.send(phone, message, timeout=15, retries=5)  # forces log
        bot.screenshot(f"whapbot-{idx}.png")
        print(f"{idx + 1}/{len(whapmsgs)} messages sent")

    time.sleep(120)

    for phone, message in whapmsgs:
        bot.open_chat_by_phone(phone)
        if bot.get_last_message_status() not in ["Read", "Leído"]:
            bot.send(message)

Contribute

Would you like to contribute to this project? Here are a few starters:

  • Improve documentation
  • Add Testing examples
  • Bug hunts and refactor
  • Additional features/ More integrations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.