waPy is a module that interfaces Python functions to Whatsapp.
- Because not being able to automate a chat application is sóóóóó 2010.
- Having a chat-api opens up many possibities.
The only automation possibilities Whatsapp has are for businesses (?), and they are quite limited.
You'll need to install a webdriver, which can be controlled by selenium. waPy uses Selenium for browser automation.
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.
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
.