danielcardeenas / whatsapp-framework

⚗️Whatsapp python api
1.16k stars 362 forks source link

Yowsup have update v3, please update this framework #265

Open Sharissa90 opened 5 years ago

Sharissa90 commented 5 years ago

Hi, I notice that yowsup have update their library to v3, this version use noise protocol so it fix some problem that raised lately. please update this framework, I tried just update yowsup v3 only, but many errors raised, I believe yowsup made some changes in their function so this framework need little adjustment to make it work..

Thank you for your great jobs make this framework easier to implemented yowsup

itsVKT commented 5 years ago

Yes please update the framework

x-frst commented 5 years ago

@danielcardeenas yes we need you to reply on this thread ASAP! Because even though Yowsup is updated we can't use this framework due to protocol changes...

devalexanderdaza commented 5 years ago

Because we did not help @danielcardeenas , and together we started to mount the compatibility of the library again?

jhonarodriguez commented 5 years ago

I already managed to solve so that the bot receives messages again, and sends them.

As I saw it, in run.py touch comment the line:

# except AuthError as e:
         # print ("Auth Error, reason% s"% e)

Because the AuthError library no longer exists in from yowsup.layers.auth

The

sudo ./setup.sh

of this repository should not be used since it will be installing the old version of yowsup that Daniel Cardenas has.

Therefore, you must first run the command

pip3 install yowsup

then install the library

pip3 install pycrypto

and

pip3 install blinker

Then when registering the number with the command

Replace CC with your country code (See https://countrycode.org)

yowsup-cli registration --requestcode sms --phone CCXXXXXXXX --cc CC -E Android

After getting the sms code (in this example: 123456)

yowsup-cli registration --register 123456 --phone CCXXXXXXXX --cc CC -E Android

the password does not exist anymore, now there is one called

client_static_keypair

which would be the new password, which is what you must add to the config.py.

I will continue reviewing possible problems. I will be updating this issue

jhonarodriguez commented 5 years ago

TypeError: pushDefaultLayers() takes 1 positional argument but 2 were given

Remove parameter in line 24 of run.py

OLD

.pushDefaultLayers(encryption)\

NEW

.pushDefaultLayers()\

Sharissa90 commented 5 years ago

Thank you @elchory96 I can running this framework again, but can you solve how to send image? I tried but always failed to send image

jhonarodriguez commented 5 years ago

What error do you get?

x-frst commented 5 years ago

Yes @elchory96 media sending is not working I mean I didn't try it on this framework I tried on terminal yowsup demos /image send <number> <location> and I got yowsup.demos.cli.layer - Request upload for file /path/to/pic.png for 91XXXXXXXXXX@s.whatsapp.net failed

x-frst commented 5 years ago

Also I tried all things step by step but getting error after starting Mac

[Whatsapp] Mac started

W 2019-04-24 00:11:54,612 yowsup.layers.protocol_ib.layer - ignoring edge_routing ib node for now
Traceback (most recent call last):
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/network/dispatcher/dispatcher_socket.py", line 42, in connectAndLoop
    self.connectionCallbacks.onRecvData(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/network/layer.py", line 82, in onRecvData
    self.receive(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/network/layer.py", line 85, in receive
    self.toUpper(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/noise/layer_noise_segments.py", line 39, in receive
    self.toUpper(bytes(data))
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/noise/layer.py", line 149, in receive
    self._flush_incoming_buffer()
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/noise/layer.py", line 137, in _flush_incoming_buffer
    self.toUpper(self._wa_noiseprotocol.receive())
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/coder/layer.py", line 19, in receive
    node = self.reader.getProtocolTreeNode(bytearray(data))
  File "/home/amitgamingking/.local/lib/python3.6/site-packages/yowsup/layers/coder/decoder.py", line 11, in getProtocolTreeNode
    raise ValueError("deflate payloads are not supported")
ValueError: deflate payloads are not supported
E 2019-04-24 00:11:55,288 yowsup.layers.network.dispatcher.dispatcher_socket - deflate payloads are not supported
Sharissa90 commented 5 years ago

bot will crash if receiving media file, any idea how ignore this type of message temporary before yowsup update their code?

x-frst commented 5 years ago

@Sharissa90 are you able to run bot normally for receiving and sending text messages?

jesusvalverde commented 5 years ago

@Sharissa90 are you able to run bot normally for receiving and sending text messages?

Able to send and recived....

jesusvalverde commented 5 years ago

bot will crash if receiving media file, any idea how ignore this type of message temporary before yowsup update their code?

Error on reciving one image

AttributeError: 'ImageDownloadableMediaMessageProtocolEntity' object has no attribute 'getMediaKey' E 2019-04-24 14:30:31,109 yowsup.layers.network.dispatcher.dispatcher_socket - 'ImageDownloadableMediaMessageProtocolEntity' object has no attribute 'getMediaKey'

jesusvalverde commented 5 years ago

Not able to send Images....seems to be a thing from youwsup 3

Sharissa90 commented 5 years ago

@Sharissa90 are you able to run bot normally for receiving and sending text messages?

@AmitGamingKing yes, but not stable like yowsup2. sometimes it crashing, I think yowsup V3 still buggy

Sharissa90 commented 5 years ago

I have trick to solve bot crashing on receiving media file, edit file app/layer.py find @ProtocolEntityCallback("message") and edit like this

`@ProtocolEntityCallback("message") def on_message(self, message_entity): mac.receive_message(self, message_entity) if message_entity.getType() == 'text': message = Message(message_entity) if message.valid: signals.message_received.send(message) if helper.is_command(message.message): signals.command_received.send(message) elif message_entity.getType() == 'media': pass

if message_entity.getMediaType() == "location":

        # message = Message(message_entity)
        # if message.valid:
        #     signals.message_received.send(message)
        # if hasattr(message_entity, 'getMediaType'):
        #     self.onMediaMessage(message_entity)
    mac.disconnect(self)`
gabrieru commented 5 years ago

sword, which is what you must add to the config.py.

I will continue reviewing possible problems. I will be updating this iss

hello, i am newbie on this, i ran the commands of library into whatsapp framework but it wont taking my phone number, just giving me errors, first when i try to register with: yowsup-cli registration --requestcode sms --phone CCXXXXXXXX --cc CC -E Android

it says invalid argument 'Android' choose from "android" without uppercase, but when i run it this gives me many errors

x-frst commented 5 years ago

Still waiting for update no response for @danielcardeenas :(

devalexanderdaza commented 5 years ago

Hello, seeing that @danielcardeenas has not appeared, I decided to start a new hybrid project between yowsup3 and whatsapp-framework. Although the installation of yowsup3 does not generate errors, and the first connection with whatsapp is established correctly, there are errors that I think the community can help solve.

The repository link is: https://github.com/devalexanderdaza/yowsapp-framework

Sharissa90 commented 5 years ago

@devalexanderdaza do you able send image?

devalexanderdaza commented 5 years ago

@devalexanderdaza puedes enviar la imagen?

In a while I will create an incidence in the repository to manage the support of the community. Follow the instructions contained in the repository so that you can reach the error and between all of us we can solve it and use the library again

jesusvalverde commented 5 years ago

Update yowsup-cli v3.2.0 yowsup v3.2.3

Made the modificacion on top and .... got this error

Traceback (most recent call last): File "run.py", line 9, in from app.layer import MacLayer File "/home/ubuntu/whatsapp-framework/app/init.py", line 1, in import modules File "/home/ubuntu/whatsapp-framework/modules/init.py", line 1, in from modules import start File "/home/ubuntu/whatsapp-framework/modules/start.py", line 2, in from app.mac import mac, signals File "/home/ubuntu/whatsapp-framework/app/mac/mac.py", line 14, in from yowsup.common.optionalmodules import PILOptionalModule, AxolotlOptionalModule ImportError: cannot import name 'AxolotlOptionalModule'

used to work with yowsup v3.0

jesusvalverde commented 5 years ago

nano app/mac/mac.py

delete 'AxolotlOptionalModule' from yowsup.common.optionalmodules import PILOptionalModule

nano app/utils/downloader.py comment

from yowsup.layers.protocol_media.mediadownloader import MediaDownloader

return MediaDownloader().download(url.decode('ASCII'))

sudo app/layer.py

comment

from yowsup.layers.protocol_media.mediadownloader import MediaDownloader

sudo ./clean.sh

./start.sh

but Errors

line 63, in on_auth assert type(local_static) is KeyPair

yowsup-cli v3.2.0 yowsup v3.2.3

navasonline2015 commented 5 years ago

@Gabrieru, U need to provide your country code in place of CC.

wisrovi commented 5 years ago

Hi,

I installed the next packages in my raspberry with pip3: -python-axolotl -protobuf -six -argparse -readline -pillow -tqdm -requests -yowsup -pycrypto -blinker

next, I download your repository (today is 2019-May-17), I live in Colombian, so I intent send the registration with: yowsup-cli registration --requestcode sms --phone 57317509xxx --cc 57 -E android

but the console print a error:

Traceback (most recent call last): File "/usr/local/bin/yowsup-cli", line 4, in import('pkg_resources').run_script('yowsup2==2.5.2', 'yowsup-cli') File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 739, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1494, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 368, in if not parser.process(): File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 189, in process self.handleRequestCode(self.args["requestcode"], config) File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 198, in handleRequestCode from yowsup.registration import WACodeRequest File "/usr/local/lib/python3.5/dist-packages/yowsup/registration/init.py", line 1, in from .coderequest import WACodeRequest File "/usr/local/lib/python3.5/dist-packages/yowsup/registration/coderequest.py", line 1, in from yowsup.common.http.warequest import WARequest File "/usr/local/lib/python3.5/dist-packages/yowsup/common/http/init.py", line 2, in from .warequest import WARequest File "/usr/local/lib/python3.5/dist-packages/yowsup/common/http/warequest.py", line 8, in from yowsup.common.tools import WATools File "/usr/local/lib/python3.5/dist-packages/yowsup/common/tools.py", line 10, in from consonance.structs.keypair import KeyPair File "/usr/local/lib/python3.5/dist-packages/consonance/structs/keypair.py", line 4, in from dissononce.dh.x25519.x25519 import X25519DH File "/usr/local/lib/python3.5/dist-packages/dissononce/dh/x25519/x25519.py", line 1, in from cryptography.hazmat.primitives.asymmetric import x25519 ImportError: cannot import name 'x25519'

The Version is: yowsup-cli v2.0.15 Using yowsup v3.2.3

could help me, please?

Sharissa90 commented 5 years ago

yowsup-cli registration --requestcode sms --phone 57317509xxx --cc 57 -E android

@wisrovi just type yowsup-cli registration --requestcode sms --config-phone 57317509xxx --cc 57

wisrovi commented 5 years ago

ok, I executed this: yowsup-cli registration --requestcode sms --config-phone 57317509xxx --cc 57

But the console printed: usage: registration [-h] [-v] [-d] [--help-config] [-c CONFIG] [-E {android}] [-m MCC] [-n MNC] [-p PHONE] [-C CC] [-r (sms|voice) | -R code] registration: error: unrecognized arguments: --config-phone 57317509xxxx

The version for youwsup version -v is: yowsup-cli v2.0.15 Using yowsup v3.2.3

gabrieru commented 5 years ago

someone got it working? i can pay for that if can help me to fix

Sharissa90 commented 5 years ago

ok, I executed this: yowsup-cli registration --requestcode sms --config-phone 57317509xxx --cc 57

But the console printed: usage: registration [-h] [-v] [-d] [--help-config] [-c CONFIG] [-E {android}] [-m MCC] [-n MNC] [-p PHONE] [-C CC] [-r (sms|voice) | -R code] registration: error: unrecognized arguments: --config-phone 57317509xxxx

The version for youwsup version -v is: yowsup-cli v2.0.15 Using yowsup v3.2.3

my mistake use --config-cc not just --cc

yowsup-cli registration --requestcode sms --config-phone 57317509xxx --config-cc 57

wisrovi commented 5 years ago

I tried this: yowsup-cli registration --requestcode sms --config-phone 57317509xxxx --config-cc 57

but, The console: error: unrecognized arguments: --config-phone 573175098360 --config-cc 57

could could help me, please?

Thanks a lot

Sharissa90 commented 5 years ago

I tried this: yowsup-cli registration --requestcode sms --config-phone 57317509xxxx --config-cc 57

but, The console: error: unrecognized arguments: --config-phone 573175098360 --config-cc 57

could could help me, please?

Thanks a lot

dont using latest yowsup from master, this master using profile.. using yowsup release instead

devalexanderdaza commented 5 years ago

Hi guys... I have released the first stable version of the fully functional Yowsapp Framework. I invite you to help the community grow and do not forget to give a star to the repository

Yowsapp Framework