2015年3月8日 星期日

Open source whatsapp library - yowsup

Yowsup is an opensource python library that can send whatsapp message
Link:
https://github.com/tgalal/yowsup/
  and
http://openwhatsapp.org/

The simple procedure is as follows:

1. install python

2. install yowsup
# easy_install yowsup2

Or if you have installed the previous version before
# easy_install -U yowsup2

3. Registration
*** As it needs a password to run the program. Registration is needed to get the password
please see the path in man help page to get the mmc and mnc for the network operator

Assume the country code is 852 (I am from Hong Kong)
And the phone number to register is 6XXXXXXX

Those mnc and mmc can be found in wiki
https://en.wikipedia.org/wiki/Mobile_country_code

$yowsup-cli registration -m 454 -n 00 -p 8526XXXXXXX -C 852 --r sms

After receive SMS send
$yowsup-cli registration -m 454 -n 00 -p 8526XXXXXXX -C 852 -R 123-123
status: ok
kind: free
pw: abc123abc123abc123abc123abc1

price: $8.00
price_expiration: 1428812312
currency: HKD
cost: 8.00
expiration: 1457345645
login: 8526XXXXXXX
type: new


and You can Get the password from the result

4. Config file

[merowoo@localhost ~]$ cat yowsup-cli.config
cc=852
phone=8526XXXXXXXX
password=abc123abc123abc123abc123abc1


5. Send Message
#yowsup-cli demos -s 8526XXXXXXX "This is my first message" -c yowsup-cli.config

This can help to make some speedy notification to mobile environment which is much better than email. The source code of yowsup-cli can be easily modify to fit on programs.

沒有留言:

張貼留言