WhatsApp on Raspberry Pi





Introduction: WhatsApp on Raspberry Pi

In this tutorial we will see how to use WhatsApp with Raspberry Pi.
We will use the Yowsup library we had already used in these tutorials: WhatsApp message from Phidgets SBC , Phidgets WhatsApp - ask the status of your sensors.

These days the library has been completely rewritten and improved, so we will see how to install it and use it.

Yowsup is a python library that allows you to login and use the WhatsApp service and provides you with all capabilities of an official WhatsApp client, allowing you to create a full-fledged custom WhatsApp client.

You need:

a Raspberry Pi B or B+, with the latest version of Raspbian, or our MIcroSD Card 8GB Class 10 Raspbian preinstalled.

Step 1: Installation

Update the packages with

sudo apt-get update
sudo apt-get upgrade

Update firmware

sudo rpi-update

Prepare the system with the necessary components to Yowsup

sudo apt-get install python-dateutil
sudo apt-get install python-setuptools
sudo apt-get install python-dev
sudo apt-get install libevent-dev
sudo apt-get install ncurses-dev

Download the library with the command

git clone git://github.com/tgalal/yowsup.git

navigate to the folder

cd yowsup

and install the library with the command

sudo python setup.py install

Step 2: Registration

After installing the library we have to register the device to use WhatsApp. Yowsup comes with a cross platform command-line frontend called yowsup-cli. It provides you with the options of registration, and provides a few demos such as a command line client.

WhatsApp registration involves 2 steps. First you need to request a registration code. And then you resume the registration with code you got.

Request a code with command

python yowsup-cli registration --requestcode sms --phone 39xxxxxxxxxx --cc 39 --mcc 222 --mnc 10

Replace with your data ,

cc is your country code in this example 39 is for Italy,

mcc is Mobile Country Code check your here

mnc is Mobile Network Code check your here

You should receive on your phone a sms message with a code like xxx-xxx

Send a message to request registration with this command, (replace xxx-xxx with code you received)

python yowsup-cli registration --register xxx-xxx --phone 39xxxxxxxxxx --cc 39

If all goes well, we should get a message like this

status: ok
  kind: free
  pw: xxxxxxxxxxxxxxxxxx=
  price: € 0,89
  price_expiration: 1416553637
  currency: EUR
  cost: 0.89
  expiration: 1445241022
  login: 39xxxxxxxxxxx
  type: existing


WhatsApp requires the registration of a number, and with that number you can use WhatsApp on only one device at a time, so it is preferable to use a new number.

WhatsApp can be used on one device at a time and if you will make many attempts to register the number, it could be banned. We recommend you using Telegram, see our tutorial

Step 3: Utilization

Create a file to save your credentials

sudo nano /home/pi/yowsup/config

with this content

## Actual config starts below ##
  cc=39 #if not specified it will be autodetected

Ok, we're ready for the test, Yowsup has a demo application in /home/pi/yowsup/yowsup/demos

Navigate to yowsup folder

cd /home/pi/yowsup

Start yowsup-cli demos with the command

yowsup-cli demos --yowsup --config config

You can see Yowsup prompt

If type "/help" you can see all available commands

First use the '/L' command for login; to send a message type

/message send 39xxxxxxxxxx "This is a message sent from Raspberry Pi"

replace xxx with the recipient number

If you respond with a message it will be displayed on Raspberry.

The possibilities of use are endless, for example you could use
WhatsApp to send messages in the home automation system seen in the tutorial Home Automation Raspberry and Phidgets part 2 or Home Automation Raspberry and Phidgets part 3

Follow us on social to stay informed.




    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Paper Contest 2018

      Paper Contest 2018
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.




    Hello, I did all the steps of the tutorial ...... but it worked only once, that is, I got to send the message to the destination number, but I tried to send another message a second time, but I got the Authorization error denied, and I tried to register the number again and it turned out that the number was blocked.

    It is the second number that blocks :)

    Please help me.



    i am getting this during registration:


    i m getting the same error aswell. if u found the solution plz do tell me

    I'm have the same problem.


    edit yowsup/env/env_android.py and change:

    _MD5_CLASSES to 1I2weuZmVg+uL50+HXeSJw==


    _VERSION to 2.16.328

    on yowsup/env/env.py


    DEFAULT to android

    Realice los cambios en los archivos que sugieres pero al ejecutar el comando de yowsup para el request code, me da el siguiente error:

    yowsup-cli v2.0.15

    yowsup v2.5.7

    Copyright (c) 2012-2016 Tarek Galal


    This software is provided free of charge. Copying and redistribution is


    If you appreciate this software and you would like to support future

    development please consider donating:


    Traceback (most recent call last):

    File "yowsup-cli", line 368, in <module>

    if not parser.process():

    File "yowsup-cli", line 189, in process

    self.handleRequestCode(self.args["requestcode"], config)

    File "yowsup-cli", line 206, in handleRequestCode


    File "/home/pi/yowsup/yowsup/registration/coderequest.py", line 41, in __init__

    self.addParam("token", YowsupEnv.getCurrent().getToken(p_in))

    File "/home/pi/yowsup/yowsup/env/env_android.py", line 55, in getToken

    clsDecoded = base64.b64decode(self.__class__._MD5_CLASSES)

    File "/usr/lib/python2.7/base64.py", line 78, in b64decode

    raise TypeError(msg)

    TypeError: Incorrect padding

    Agradeceria mucho su ayuda!

    Thank you very much

    Hi, Ihave problem with Yowsup. Anyone can help me to solve it? Regards

    status: fail

    reason: old_version

    login: 628xxxxxxxx

    pi@raspberrypi:~/yowsup $ ./setup.py build

    running build

    running build_py

    running egg_info

    writing requirements to yowsup2.egg-info/requires.txt

    error: [Errno 13] Permission denied: 'yowsup2.egg-info/requires.txt'

    I'm having a problem with this code:

    python yowsup-cli registration --requestcode sms --phone 39xxxxxxxxxx --cc 39 --mcc 222 --mnc 10

    If I wrote that in my terminal. The output said that it is failed because of an old_version. What can I do?