Skip to content

rastapasta/YowJS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YowJS

Maintenance Status NPM Version Dependency Status Build Status Code Climate

What is it?

About the package

yowjs is a node module, distributed via NPM and allows you to easily intergrate yowsup (Python library) into a node application. yowjs is essantially an event based proxy and allows you easily to communicate with yowsup without any Python being involved.

Usage

Add yowjs you your package.json file and install it via npm install. yowjs is dependent on yowsup and must be install manually.

npm install yowjs --save-dev

Install/Upgrade yowsup (globally)

sudo pip install yowsup2 <--upgrade>

Example code

const YowJS = require('yowjs');

let yowsup = new YowJS();

// init the connection params
yowsup.initialize(
    config.countryCode,
    config.phoneNumber,
    config.password
)
.on('ON_MESSAGE', message => { // bind to incoming events from yowsup cli
    console.log(['incoming msg', message]);
})
.on('LINK_DEAD', () => {
    // re-init, connection lost
    console.log('connection lost');
})
.connect(); // establish connection.

Building

Clone this repo (or fork it)

git clone git@github.com:landrover/yowjs.git

Install deps

npm install

Issues:

  • Sometimes the queue of the bot is too big and requires a cleanup (encryption etc..)
    • Run few times this: yowsup-cli demos -e -d -l NUMBER:PWD
  • UTF8 support, patched manually in Yowsup:
    • in /usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py add at the top of the file:
import sys
reload(sys)
sys.setdefaultencoding('utf8')

Todo

  • comments

MIT Licenced

About

Yowsup NodeJS, Python Middleware

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%