Skip to content

yowsup cli

Tarek edited this page Apr 22, 2019 · 26 revisions

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

$ yowsup-cli

Available commands:
===================
demos, registration, config, version

yowsup-cli registration

$ yowsup-cli registration --help
usage: registration [-h] [-v] [-d] [--help-config] [-E {android}] [-c path]
                    [--config-phone CONFIG_PHONE] [--config-cc CONFIG_CC]
                    [--config-pushname CONFIG_PUSHNAME]
                    [--config-id CONFIG_ID] [--config-mcc CONFIG_MCC]
                    [--config-mnc CONFIG_MNC]
                    [--config-sim_mcc CONFIG_SIM_MCC]
                    [--config-sim_mnc CONFIG_SIM_MNC]
                    [--config-client_static_keypair CONFIG_CLIENT_STATIC_KEYPAIR]
                    [--config-server_static_public CONFIG_SERVER_STATIC_PUBLIC]
                    [--config-expid CONFIG_EXPID] [--config-fdid CONFIG_FDID]
                    [--config-edge_routing_info CONFIG_EDGE_ROUTING_INFO]
                    [--config-chat_dns_domain CONFIG_CHAT_DNS_DOMAIN]
                    [--no-encrypt] [-p] [-r (sms|voice) | -R code]

WhatsApp Registration options

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Print version info and exit
  -d, --debug           Show debug messages
  --help-config         Prints a config file sample
  -E {android}, --env {android}
                        Set the environment yowsup simulates
  --no-encrypt          Don't encrypt request parameters before sending
  -p, --preview         Preview requests only, will not attempt to connect and
                        send

Configuration options:
  Only some of the configuration parameters are required depending on the
  action being performed using yowsup

  -c path, --config path
                        (optional) Path to config file. Other configuration
                        arguments have higher priority if given, and will
                        override those specified in the config file.
  --config-phone CONFIG_PHONE
                        Your full phone number including the country code you
                        defined in 'cc', without preceeding '+' or '00'
  --config-cc CONFIG_CC
                        Country code. See http://www.ipipi.com/networkList.do.
  --config-pushname CONFIG_PUSHNAME
                        Push/Display name to use
  --config-id CONFIG_ID
                        Base64 encoded Identity/Recovery token, typically
                        generated and used during registration or account
                        recovery.
  --config-mcc CONFIG_MCC
                        Mobile Country Code. Check your mcc here:
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-mnc CONFIG_MNC
                        Mobile Network Code. Check your mnc from
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-sim_mcc CONFIG_SIM_MCC
                        Mobile Country Code. Check your mcc here:
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-sim_mnc CONFIG_SIM_MNC
                        Mobile Network Code. Check your mnc from
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-client_static_keypair CONFIG_CLIENT_STATIC_KEYPAIR
                        Base64 encoded concatenation of user keypair's private
                        bytes and public bytes
  --config-server_static_public CONFIG_SERVER_STATIC_PUBLIC
                        Base64 encoded server's public key bytes
  --config-expid CONFIG_EXPID
                        Base64 encoded expid, typically generated and used
                        during registration
  --config-fdid CONFIG_FDID
                        Device UUID, typically generated for registration and
                        used at login
  --config-edge_routing_info CONFIG_EDGE_ROUTING_INFO
                        Base64 encoded edge_routing_info, normally received
                        and persisted right after a successful login
  --config-chat_dns_domain CONFIG_CHAT_DNS_DOMAIN
                        Chat DNS domain, normally received and persisted right
                        after a successful login

Modes:
  -r (sms|voice), --requestcode (sms|voice)
                        Request the digit registration code from Whatsapp.
  -R code, --register code
                        Register account on Whatsapp using the code you
                        previously received

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

Example:

yowsup-cli registration --requestcode sms --config-phone 49XXXXXXXX --config-cc 49 --config-mcc 123 --config-mnc 456
yowsup-cli registration --register 123456 --config-phone 49XXXXXXXX

Afterwards yowsup would have stored a configuration file for you at ~/.yowsup/49XXXXXXXX/config.json which will be used whenever the same phone number is specified. This also means that you don't to specified other arguments if they already exist in that config file.

yowsup-cli demos

$ yowsup-cli demos --help

usage: demos [-h] [-v] [-d] [--help-config] [-E {android}] [-c path]
             [--config-phone CONFIG_PHONE] [--config-cc CONFIG_CC]
             [--config-pushname CONFIG_PUSHNAME] [--config-id CONFIG_ID]
             [--config-mcc CONFIG_MCC] [--config-mnc CONFIG_MNC]
             [--config-sim_mcc CONFIG_SIM_MCC]
             [--config-sim_mnc CONFIG_SIM_MNC]
             [--config-client_static_keypair CONFIG_CLIENT_STATIC_KEYPAIR]
             [--config-server_static_public CONFIG_SERVER_STATIC_PUBLIC]
             [--config-expid CONFIG_EXPID] [--config-fdid CONFIG_FDID]
             [--config-edge_routing_info CONFIG_EDGE_ROUTING_INFO]
             [--config-chat_dns_domain CONFIG_CHAT_DNS_DOMAIN] [-y] [-e]
             [-s phone message] [-S contacts] [--log-dissononce]
             [--log-consonance]

Run a yowsup demo

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Print version info and exit
  -d, --debug           Show debug messages
  --help-config         Prints a config file sample
  -E {android}, --env {android}
                        Set the environment yowsup simulates

Configuration options:
  Only some of the configuration parameters are required depending on the
  action being performed using yowsup

  -c path, --config path
                        (optional) Path to config file. Other configuration
                        arguments have higher priority if given, and will
                        override those specified in the config file.
  --config-phone CONFIG_PHONE, --phone CONFIG_PHONE
                        Your full phone number including the country code you
                        defined in 'cc', without preceeding '+' or '00'
  --config-cc CONFIG_CC, --cc CONFIG_CC
                        Country code. See http://www.ipipi.com/networkList.do.
  --config-pushname CONFIG_PUSHNAME
                        Push/Display name to use
  --config-id CONFIG_ID
                        Base64 encoded Identity/Recovery token, typically
                        generated and used during registration or account
                        recovery.
  --config-mcc CONFIG_MCC, --mcc CONFIG_MCC
                        Mobile Country Code. Check your mcc here:
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-mnc CONFIG_MNC, --mnc CONFIG_MNC
                        Mobile Network Code. Check your mnc from
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-sim_mcc CONFIG_SIM_MCC
                        Mobile Country Code. Check your mcc here:
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-sim_mnc CONFIG_SIM_MNC
                        Mobile Network Code. Check your mnc from
                        https://en.wikipedia.org/wiki/Mobile_country_code
  --config-client_static_keypair CONFIG_CLIENT_STATIC_KEYPAIR
                        Base64 encoded concatenation of user keypair's private
                        bytes and public bytes
  --config-server_static_public CONFIG_SERVER_STATIC_PUBLIC
                        Base64 encoded server's public key bytes
  --config-expid CONFIG_EXPID
                        Base64 encoded expid, typically generated and used
                        during registration
  --config-fdid CONFIG_FDID
                        Device UUID, typically generated for registration and
                        used at login
  --config-edge_routing_info CONFIG_EDGE_ROUTING_INFO
                        Base64 encoded edge_routing_info, normally received
                        and persisted right after a successful login
  --config-chat_dns_domain CONFIG_CHAT_DNS_DOMAIN
                        Chat DNS domain, normally received and persisted right
                        after a successful login

Command line interface demo:
  -y, --yowsup          Start the Yowsup command line client

Echo client demo:
  -e, --echo            Start the Yowsup Echo client

Send client demo:
  -s phone message, --send phone message
                        Send a message to specified phone number, wait for
                        server receipt and exit

Sync contacts:
  -S contacts, --sync contacts
                        Sync ( check valid ) whatsapp contacts

Logging options:
  --log-dissononce      Configure logging for dissononce/noise
  --log-consonance      Configure logging for consonance

Explore the demos yourself ;) Feel free to implement and send me more demos to include in yowsup-cli

Clone this wiki locally