Skip to content

yowsup cli

tgalal edited this page Nov 7, 2012 · 26 revisions

yowsup-cli is a command line interface that makes use of the Yowsup library. It provides you with the options of registration, reading/sending messages, and even engaging in an interactive conversation. Here is a quick glimpse at different options supported by yowsup-cli

usage: yowsup-cli [-h] [-l | -s <phone> <message> | -i <phone>] [-w] [-a] [-k]
	          [-r (sms|voice) | -R code] [-c file] [-p] [-D] [-d] [-v]

yowsup-cli Command line options

optional arguments:
  -h, --help            show this help message and exit
  -c file, --config file
	                Path to config file. Config file should contain full
	                phone number including country code without '+' or
	                '00', and Identity, separated by a colon. Identity is
	                the phone's IMEI if your account is setup on a Nokia
	                or Android device, or your phone's WLAN's MAC Address
	                for iphone devices. Example:
	                123456789:FF:FF:FF:FF:FF:FF
  -p, --assumepassword  Assume provided identity is the actual login password
  -D, --dbus            Start DBUS interface
  -d, --debug           Enable debug messages
  -v, --version         show program's version number and exit

Client options:
  -l, --listen          Listen to messages
  -s <phone> <message>, --send <phone> <message>
	                Send message to phone number and close connection.
	                Phone is full number including country code, without
	                '+' or '00'
  -i <phone>, --interactive <phone>
	                Start an interactive conversation with a contact.
	                Phone is full number including country code, without
	                '+' or '00'
  -w, --wait            If used with -s, then connection will not close until
	                server confirms reception of the message
  -a, --autoack         If used with -l or -i, then a message received ack
	                would be automatically sent for received messages
  -k, --keepalive       When used with -l or -i, Yowsup will automatically
	                respond to server's ping requests to keep connection
	                alive

Registration options:
  -r (sms|voice), --requestcode (sms|voice)
	                Request the 3 digit registration code from Whatsapp.
  -R code, --register code
	                Register account on Whatsapp using the provided 3
	                digit code
## Your Credentials Whatsapp protocol is basically a modified version of XMPP. It uses JID and password for login. Your JID is the phone number you registered with, which is a combination of your phone number and country code. Your password is generated from your phone's IMEI in case of Nokia or Android, or from your phone's Wlan MAC Address in case of iOS. yowsup-cli is able to generate the same exact password used by your phone's Whatsapp client for login. Therefore if you are able to obtain these info, you'll be able to login using yowsup-cli and send and receive messages without affecting your Whatsapp's setup on phone. You should save these info in a text file, in the following format:
PhoneNumber:IMEI

or

PhoneNumber:MAC

If you are not able to obtain these info or using an unsupported phone, you might want to register first. To tell yowsup-cli about your config file, you just pass the path to that file using the -c switch. The config file is used everytime you login, in order to obtain your credentials, and during registration.

Registration

Registration is done through 2 steps similar to how it works on official Whatsapp clients. First you request a registration code from Whatsapp:

yowsup-cli --requestcode sms

The code will then be delivered to your phone number via your preferred method (sms/voice). Once you have obtained the code, you proceed with the 2nd step, which is to send that code using --register argument:

yowsup-cli --register 123

Your phone number and password are those stored in the config file specified by -c (see how your config file should look like)

Clone this wiki locally