Wednesday, July 13, 2016

Send messages from ubutnu Terminal to Whatsapp

What is WhatsApp

WhatsApp Messenger is a cross-platform mobile messaging app which allows you to exchange messages without having to pay for SMS.

WhatsApp Messenger is available for iPhone, BlackBerry, Android, Windows Phone and Nokia and yes, those phones can all message each other! Because WhatsApp Messenger uses the same internet data plan that you use for email and web browsing, there is no cost to message and stay in touch with your friends.

Installing and Configuring Yowsup in ubuntu

Yowsup is a python library that enables you build application which use WhatsApp service. Yowsup has been used to create an unofficial WhatsApp client Nokia N9 through the Wazapp project which was in use by 200K + users as well as another fully featured unofficial client for Blackberry 10. 

It act as a WhatsApp service under platforms like Linux, MAC and windows.

Yowsup Architecture

A running Yowsup is a stack of several layers. The previous figure is a breakdown of the core Yowsup stack. A layer is a bidirectional channel that transforms the data passing through it before passing it to underlying or the above layer. 

To know more about yowsup click

Yowsup Installation

We need to install yowsup library, it enables you to send an messages using WhatsApp.
Before we need to setup configuration for yowsup.
First step, we need to install all the dependencies using the below command as the root user
> apt-get install python python-dateutil python-argparse python-dev python-setuptools
After installation of python, then download yowsup WhatsApi on github
> git clone
After download, go to inside the yowsup folder
> cd yowsup
Provide permission to
> chmod +x
Run the following command
> python install
After finish the installation complete, you can setup whatsapp configuation by
> chmod +x yowsup-cli


yowsup-cli is a command line interface to Yowsup library. It provides you with the options of registration, and provides a few demos such as a command line client

First you need to register using your phone number and password for setup the yowsup library.
> ./yowsup-cli
This above input provides the following results
Available commmands: 
demos, registration, version
Then you need to register your phone number using yowsup with the registration command
> ./yowsup-cli registration --requestcode sms --phone xxxxxxxx --cc 49 --mcc 24 --mnc 07
You must be given your phone number with country code, for example 9196xxxxxx39 (In india country code is 91)

It provides the following output if the above command is correct. and you will receive whatsapp one time password.
status: sent
retry_after: 1805
length: 6
method: sms
Registration Option:
-m MCC, --mcc MCC Mobile Country Code. Check your mcc here:
-n MNC, --mnc MNC Mobile Network Code. Check your mnc from
-p PHONE, --phone PHONE Your full phone number including the country code you
defined in 'cc', without preceeding '+' or '00'
-C CC, --cc CC Country code. See 
Then you need to finish the registration by using the following command and provide OTP here.
./yowsup-cli registration --register 263-541 --phone 91xxxxxxx --cc 49

If the above command is correct, then you will get the following results in command
INFO:yowsup.common.http.warequest:{"status":"ok","login":"xxxxxxxxxxxxxxx","pw":"0pJj5cLaGSk6pDTa6rJR/5bDiR0=","type":"new","expiration":1471273284,"kind":"free","price":"0,89 \u20ac","cost":"0.89","currency":"EUR","price_expiration":1442376976}
status: ok
kind: free
pw: 0pJj5cLaGSk6pDTa6rJR/5bDiR0=
price: 0,89 €
price_expiration: 1442376976
currency: EUR
cost: 0.89
expiration: 1471273284
login: xxxxxxxxxxxxxx
type: new
Here you need to note the password (pw). Just copy it and paste in vim editor.

Create the config file as following.
> vim yowsup-cli.conf
Then add content as follows
cc=49 #Your country code
phone=xxxxxxxxxxxx #Your phone number with country code 91(india)
id= #This is where you insert your IMEI number (not needed)
password=0pJj5cLaGSk6pDTa6rJR/5bDiR0= #your password which you got from registration command 

Then save this file by using press Esc button and type !wq then enter to exit.
Then test your configuration by sending message by using the following command.
./yowsup-cli demos -c yowsup-cli.conf -s ************ “testing msg”
******** is the receiver number.
Thats all.

If you facing an any issue, kindly let me know.

Thanks for reading our blog.

No comments:

Post a Comment