Description
A Twitter Node Module to authenticate and interact with the Twitter REST API from NodeJS.
Installation
npm install twitter-js-client
var Twitter = Twitter;
Usage
You need to create a Twitter app to use the API.
//Callback functions var { console; }; var { console; }; var Twitter = Twitter; //Get this data from your twitter apps dashboard var config = "consumerKey": "XXX" "consumerSecret": "XXX" "accessToken": "XXX" "accessTokenSecret": "XXX" "callBackUrl": "XXX" var twitter = config; //Example calls twitter; twitter; twitter; twitter; twitter; // // Get 10 tweets containing the hashtag haiku // twitter; // // Get 10 popular tweets with a positive attitude about a movie that is not scary // twitter;
Twitter has a comprehensive REST api if you need to use something that doesn't have a wrapper function in the library call it directly :
twitter; twitter;
To get the list of expected parameters and results, check https://dev.twitter.com/rest/public
Functions
Docs
Search Tweets.To learn how to use Twitter Search effectively read Using the Twitter Search API
twitter;
Docs
Update user's status (Tweet). twitter;
Docs
Follow another user by user_id or screen_name(handle). twitter;
Docs
Get a user's timeline twitter;
Docs
Get the latest 20 recent mentions for the authenticating user. twitter;
Docs
Get the latest tweets and retweets by the authenticating users and the ones they follow. twitter;
Docs
Get latest retweets of authenticated user. twitter;
Docs
Get a tweet by id. twitter;
Docs
Get information about a user by user_id or handle (screen_name). twitter;
Docs
Get a cursored collection of the followers of a user_id or a handle (screen_name). twitter;
Docs
Get a cursored collection of the followers' ids of a user_id or a handle (screen_name). twitter;
Docs
Upload media (images) to Twitter. twitter;
Tests
There is a test file TwitterITSpec.js
that does a basic integration tests of the client.
It uses a properties file test/spec/properties.json
to inject in the OAuth properties.
These will need to be updated with your own details before the tests will run
Running tests
make test