Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
node-simple-twitter
tag: 1.0.3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.editorconfig
.gitignore
.jshintrc
.travis.yml
Readme.md
index.js
package.json

Readme.md

Simple Twitter Build Status NPM version

NPM

Description

Twitter simple library.
It supporst API 1.1
Currently it runs only get and post methods. (streaming is not supported)
It supports caching inside json files, and node events.

Installation

Download and place it inside node_modules.
Or use npm: npm install simple-twitter.

Usage

Constructor:

 var twitter = require('simple-twitter');
 twitter = new twitter( 'xxx', //consumer key from twitter api
                        'xxx', //consumer secret key from twitter api
                        'xxx', //acces token from twitter api
                        'xxx', //acces token secret from twitter api
                        3600  //(optional) time in seconds in which file should be cached (only for get requests), put false for no caching
                      );

Get method:

twitter.get('statuses/user_timeline',
            function(error, data) {
                console.dir(data);
           });

Get method via node events.

twitter.on('get:statuses/user_timeline', function(error, data){
    console.dir(data);
});
twitter.get("statuses/user_timeline");

Chainable get method via node events.

twitter.on('get:search/tweets', function(error, data){
    console.dir(data);
}).get("search/tweets", "?geocode=37.781157,-122.398720,100mi");

Post method:

twitter.post('statuses/update',
             {'status' : 'testing message'},
                function(error, data) {
                    console.dir(data);
                }
            );

Post method via node events.

twitter.on('post:statuses/update', function(error, data){
    console.dir(data);
});
twitter.post('statuses/update', {'status' : 'testing message'});
Something went wrong with that request. Please try again.