How to install a WhatsApp bot based on Python

First, we need to download the yowsup code:

git clone https://github.com/tgalal/yowsup.git
cd yowsup
sudo python setup.py install
python yowsup-cli registration -p 569xxxxxxxx -C 56 -r sms

Where 56 is the country code (Chile in my case)
You will receive a code in your phone to register the account

python yowsup-cli registration -p 569xxxxxxxx -C 56 --register 201-124

Now, create a file called mydetails with the following information and the password that yowsup-cli prints:

cc=56
phone=569xxxxxxxx
password=PUT_THE_PASSWORD_HERE

To send a whatsapp message, you only need write the following sentence:

yowsup-cli demos -c mydetails -s 569xxxxxxxx "hello world"

If you prefer the CLI, you need to do the following:

yowsup-cli demos --yowsup --config mydetails 
/L
/message send 569xxxxxxxx "hello world"

Enjoy it!

Comments

  1. hi my friend. when i try this ...
    python yowsup-cli registration -p 5598981818780 -C 55 -r sms

    the centos 7 show me
    INFO:yowsup.common.http.warequest:{"login":"559881818780","status":"fail","reason":"old_version"}

    status: fail
    reason: old_version
    login: 559881818780

    my wattsup version is 2.17.223

    please my friend help!!

    thanks a lot.
    you are great!!

    ReplyDelete
    Replies
    1. Hey Tad, had the same issue myself. All you need to do is cd into the /env directory and edit (vim, nano, whatever) the env.py and env_s40.py as follows:

      1. In env.py - change/ensure the default environment is "s40":
      i.e. DEFAULT = "s40"; and

      2. In env_s40.py - change/ensure the MD5 classes and version details are as follows:
      MD5_CLASSES = "1I2weuZmVg+uL50+HXeSJw=="
      VERSION = "2.16.328"

      Even though s40 is set as default environment per our changes to the env.py file (as above), make sure to use the --env s40 switch/option in your yousup-cli registration command just to be sure it uses the right env file/settings.

      There is more info/help about this issue here - https://github.com/tgalal/yowsup/issues/1861

      Good luck buddy.

      Delete
  2. Hola compa, tiempo atrƔs pude configurar sin problemas esto, hoy nuevamente necesitaba de esto pero ya no me funciona, no se si aun estas disponible para ayudarme ... sludos

    ReplyDelete
  3. You can use REST API https://api-messenger.com/
    Message sending limits are very large. Free demo access for 3 days

    ReplyDelete
  4. python yowsup-cli registration -p 569xxxxxxxx -C 56 -r sms

    INFO:yowsup.common.http.warequest:{"login":"559881818780","status":"fail","reason":"old_version"}

    status: fail
    reason: old_version
    login: 559881818780

    my wattsup version is 2.17.223

    ReplyDelete

Post a Comment

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

v4l2: open /dev/video0: Permission denied