Skip to content

The repository for waPy, a Python module that interfaces functions to Whatsapp Web.

License

Notifications You must be signed in to change notification settings

Braitenberg/waPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

waPy

waPy is a module that interfaces Python functions to Whatsapp.

Why waPy?

  1. Because not being able to automate a chat application is sóóóóó 2010.
  2. Having a chat-api opens up many possibities.

The only automation possibilities Whatsapp has are for businesses (?), and they are quite limited.

Getting Started

You'll need to install a webdriver, which can be controlled by selenium. waPy uses Selenium for browser automation.

Webdriver

Right now, the only available webdriver is the Chrome webdriver. This is because it allows session data to be saved in such a way that the user does not constantly have to re-activate their Watsapp web, which is quite a hassle.

To install the chrome webdriver, follow these steps:

  1. Downloaded the webdriver from here.
  2. Add the webdriver to your Path-variable like so.

Example

from waPy import client

wappy = client(client_name='example-bot')  # Create a client

# Define some custom-made functions....
def helloworld(name):
    return f"Hello, {name}"


def getmoney(name, valuta):
    return f"Yes, {name} is a millionaire in {valuta}'s."


# Add these functions to the client as commands
wappy.initialize_commands([helloworld, getmoney])

wappy.run()  # Open the browser, open whatsapp and listen for commands

In whatsapp, when somebody sends /helloworld Karen, the client will reply with Hello, Karen.

About

The repository for waPy, a Python module that interfaces functions to Whatsapp Web.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages