Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Retreives contatct list
JavaScript
branch: master
Failed to load latest commit information.
tests Set projection only once
COPYING.MIT Add MIT licence file
README.md Improve readme
index.js Set projection only once
package.json Add package.json

README.md

Class for Node.js to download google contacts as json

How to use:

var GoogleContacts = require('googlecontacts').GoogleContacts,
    util = require('util');
var c = new GoogleContacts({
    email: 'you@exmaple.com',
    password: 'password'
});
c.on('error', function (e) {
    console.log('error', e);
});
c.on('contactsReceived', function (contacts) {
    console.log('contacts: ', util.inspect(contacts, {depth:null}));
});
c.on('contactGroupsReceived', function (contactGroups) {
    console.log('groups: ', util.inspect(contactGroups, {depth:null}));
});
c.getContacts({
    projection: 'thin',
    'max-results': 100
});
c.getContactGroups({
    projection: 'thin',
    'max-results': 200
});

_getContacts()_ and _getContactGroups()_ can get the following parameters:

other functionallities coming soon..

Contact Stream

You can handle contacts as streams.

var module = require('googlecontacts'),
    cfg = {
        email: 'you@exmaple.com',
        password: 'password',
        test_contact_id: '12345' // you can parse contact id from contacts list
    };

contactGroupsStream = new module.GoogleContactsGroupsStream({
    email: cfg.email,
    password: cfg.password
});

contactStream = new module.GoogleContactStream({
    email: cfg.email,
    password: cfg.password,
    contactId: cfg.test_contact_id
});

contactsStream = new module.GoogleContactsStream({
    email: cfg.email,
    password: cfg.password
});


contactGroupsStream.pipe(process.stdout);
contactsStream.pipe(process.stdout);
contactStream.pipe(process.stdout);
Something went wrong with that request. Please try again.