Tuesday, August 12, 2014

Using Yowsup to send pictures to a group

So, I intended to send pictures to my whatsapp group...these are the steps I took.

1. Buy a cheap SIM card, take note of that number
2. Edit the config file, use yowsup-cli to register using that phone number and input the subsequent verification code

Register a Whatsapp account using phone number


3. Extend the ListenerClient to listen for group messages, ask one of my groupmates to send the group a test message. This allows me to obtain the JID of the group.

Listen for group messages to obtain JID of the group

4. Extend CmdClient.py and fix it, and add in my own additions to yowsup-cli to be able to send

Sending images to group chat


Here are all my files at the end:

Examples\GroupListenerClient.py
Examples\UploaderClient.py
Examples\CmdClient.py
yowsup-cli


References:

Using the yowsup-cli, registering a new account
http://hacktracking.blogspot.sg/2013/02/yowsup-cli-send-whatsapp-messages-from.html

Getting JID of the group
https://github.com/tgalal/yowsup/issues/162

Sending images by SamsonBox
https://github.com/tgalal/yowsup/issues/178

Creating preview images
https://github.com/tgalal/yowsup/issues/35#issuecomment-41364453



19 comments:

  1. Nice post! Something I can work with ;)

    One request though,;)

    Could you post the adjusted samsonbox Cmdclient.py with the rest on your site?

    Copy pasting gives me python error.

    Would greatly appreciate it!

    Thx and keep up the good work!

    ReplyDelete
  2. ow and the extend of the ListenerClient maybe ?

    Just a rar of the modified files compared to the original yowsup files would be great!!

    ReplyDelete
  3. AND back again....Sir Poot : Found your github and also found the adjusted files. Thx!

    But, when using it gives me the error: "No module named GetAllGroupsClient"

    Where is this dependency, or should I comment it out ? /-:

    ReplyDelete
  4. btw, don't forget to install PIL right?

    ReplyDelete
  5. Sorry for the long delay Henk, never thought anyone would visit my blog =P

    Yeah GetAllGroupsClient is not supposed to be there...just comment it out and it should work ;)

    ReplyDelete
  6. CmdClient.py - https://gist.github.com/sirpoot/0d025bbdd1fcda20a14d

    ReplyDelete
  7. LOL , was great help for me, couldnt find anything better ;)

    https://github.com/tgalal/yowsup/issues/178

    Interactive chatting in a group doesn't work for me, does it for you?

    ReplyDelete
  8. Hi, i always got "Disconnected because closed" when trying to send image. how to solve this ? thx

    ReplyDelete
  9. Hello Sir Poot, first of all would like to thank for send_image code. its working perfectly fine.

    would be great if you can help us for send_video and send_audio code as well. Thanks in advance since i am sure u will extend ur best possible support.

    ReplyDelete
    Replies
    1. http://sirpoot.blogspot.sg/2014/11/using-yowsup-to-send-audio-and-video.html

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. WHATSAPP BLOCKS THIS NOW!
    https://github.com/tgalal/yowsup/issues/337

    ReplyDelete
  12. Hello Sir Poot! You still can send images using the same code? I did it all as you sugested, the output is the same as you get in the prompt, but the image do not reach the number or group.
    Thanks for sharing!

    ReplyDelete
  13. Hi Sir Poot.

    I'm getting the error below when trying to send a image.

    Request Fail: hash: ...................................................=
    MediaReceipt print timedout!

    Have you any suggestions to fix this?

    Tks!

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hola,
    thank you for adapting CmdClient.py to send pictures.

    Everything works fine with the upload and the sending using CmdClient.py

    However, on my phone's whatsapp no image is shown! I even see that the phone has sent and ACK back when I turn on debugging, still no image.

    Why could that be, do images have to be of a certain kind to be displayed by the whatsapp client on the phone?

    I'm a bit puzzled as everything seems to work except for that the image simple doesn't appear

    Regards,
    Sören

    ReplyDelete
  16. [root@srv-002 yowsup]# ./yowsup-cli --sendImage 555184222008 /home/alessandro.daudt/yowsup/foto.jpg --wait --config config.example -a
    Authed 555196641335
    Sending picture /home/alessandro.daudt/yowsup/foto.jpg of size 17948 with name foto.jpg
    Sending media_requestUpload
    555184222008@s.whatsapp.net [09-01-2015 09:05]:Sairrr
    Enter Message or command: (/available, /lastseen, /unavailable)
    555184222008@s.whatsapp.net [09-01-2015 10:06]:Droga
    Enter Message or command: (/available, /lastseen, /unavailable)
    Request Succ: hash: Pn+rha69KxPDwLC1hbNvwQmY9agTlVgGKmDBxaFc6L4= url: https://mmi212.whatsapp.net/u/EIsuotSncyj4F13Skz4zre-vUPsABQw3B0EU_Q/Al2ksAP_UTR7AsERErtlSjEnLIT2TDAS-k2msJMzSL0m resume: 0
    Error occured at transfer write() argument 1 must be string or read-only buffer, not bytearray

    Upload Fail:
    Got request MediaReceipt

    ReplyDelete
  17. Sir how to get the jid of the group

    ReplyDelete