droidlife / PyWhatsapp

Python script to control whatsapp web using terminal
MIT License
18 stars 11 forks source link

Question #1

Open lddd opened 6 years ago

lddd commented 6 years ago

Hey there,

possible to create some more reusable HTTP Rest API approach from this?

I have no experience with browser automation at all. Not sure how fast/stable this would be. Appreciate any suggestions on how to possible realize something like this:

api.com/retrieve_messages.php (to get all messages a number received) api.com/send_message.php (to send a message to a number)

With JSON result objects like:

Retrieved messages

[{ "id": "", "number": "", "from": "]", "to": "", "type": "", "text": "",
"creation_date": "" },

Sent messages

{"success":true,"description":"Message queued","result_code":0}

droidlife commented 6 years ago

Sorry, it won't be possible to create an API based on this since this is using the browser for the tasks. For API you should use https://github.com/tgalal/yowsup

lddd commented 6 years ago

Yowsup is dead and also not secure, you will get blocked by WhatsApp soon or later because it directly communicates with WhatsApp Servers.

Why do you think its not possible to create some API for browser automation logic?. You can do browser automation on a remote server and possible build an API as a middleware between the python code and a clients sending HTTP requests.

Like any other Python web application with some API created for it.