Ng Twitter

AngularJS library for the Twitter REST Api
Alternatives To Ng Twitter
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Twitteroauth4,2317211654 days ago38August 18, 202231mitPHP
The most popular PHP library for use with the Twitter OAuth REST API.
Tweetinvi960227193 months ago133April 03, 2021227mitC#
Tweetinvi, an intuitive Twitter C# library for the REST and Stream API. It supports .NET, .NETCore, UAP (Xamarin)...
Twitterapi906446119 days ago120June 06, 2022Python
Minimal python wrapper for Twitter's REST and Streaming APIs
Directory Backbone Bootstrap472
8 years ago6JavaScript
Employee Directory sample application built with Backbone.js and Twitter Bootstrap
Twitter4s258121 days ago17May 21, 202246apache-2.0Scala
An asynchronous non-blocking Scala client for both the Twitter Rest and Streaming API
Twitter V2149
a year ago20April 10, 202125mitJavaScript
An asynchronous client library for the Twitter REST and Streaming API's
Twitter4r Core84141311 years ago17July 11, 20118mitRuby
Core library for Twitter4R, which provides Ruby bindings for the Twitter REST API
Twivatar73
6 months ago2HTML
Twitter RESTful avatar API
Ng Twitter55
478 years agoSeptember 02, 20155JavaScript
AngularJS library for the Twitter REST Api
Python Face Client49
5 years ago3September 25, 20113bsd-3-clausePython
face.com REST API Python client library.
Alternatives To Ng Twitter
Select To Compare


Alternative Project Comparisons
Readme

Build Status

ngTwitter

ngTwitter is an AngularJS Twitter REST API wrapper. The purpose of this library is to quickly and easily access all the Twitter API endpoints without having to worry about the request signing and signature.

Requirements

You need to have a Twitter app and a valid OAuth token.

Installing ngTwitter

Bower

Add this repository as dependency:

$ bower install ng-twitter-api --save

This will add the dependency to your project and to the bower.json file.

The JavaScript library must then be added to your index.html file found in your projects www directory:

<script src="../ng-twitter-api/dist/ng-twitter-api.min.js"></script>

Twitter requires HMAC-SHA1 signatures in their Oauth implementation. This project install jsSHA with bower so you only have to include the file:

<script src="../bower_components/jsSHA/src/sha1.js"></script>

Injecting:

Once added to your index.html file, you must inject the library into your app.js module. Make your app.js file look something like the following:

angular.module('starter', ['ngTwitter'])

Now ngTwitter is ready to use!

Using ngTwitter In Your Project

  1. Find your ClientId and your SecretId from your Twitter app.
  2. Grab you OAuth token inside your app. If you are using the Ionic Framework you should use the ngCordova library. After including it, your request for a OAuth token could look like this:
    $cordovaOauth.twitter(clientId, clientSecret).then(function (succ) {
        $twitterApi.configure(clientId, clientSecret, succ);
      }, function(error) {
        console.log(error);
    });

For a complete Ionic integration guide also check out my Blogpost How To Easily Use The Twitter REST Api With AngularJS.

If you got your OAuth token differently, just make sure to configure ngTwitter before making any other calls like this:

    $twitterApi.configure(clientId, clientSecret, oauthToken);

After configuring you can use all the endpoint wrapper. Each API call returns a promise. The success callback is the complete Twitter Rest response.

    $twitterApi.getHomeTimeline({count: 5}).then(function(data) {
      console.log(data);
    }, function(error) {
      console.log('err: ' + error);
    });

Available methods

The options object is optional on every request. Just check out the Twitter documentation what you want to send.

configure(string clientId, string clientSecret, object token);
getHomeTimeline(object options); // GET statuses/home_timeline
getMentionsTimeline(object options) // GET statuses/mentions_timeline
getUserTimeline(object options) // GET statuses/user_timeline
searchTweets(string keyword, object options); // GET search/tweets
postStatusUpdate(string statusText, object options); // POST statuses/update
getUserDetails(string user_id, object options); // GET users/show
getRequest(string full_twitter_api_url, object options); // GET custom url
postRequest(string full_twitter_api_url, object options); // POST custom url

Contribution Rules

All contributions must be made via the development branch. This keeps the project more maintainable in terms of versioning as well as code control.

Have a question or found a bug?

Message me on Twitter - @schlimmson

Follow my Blog Devdactic - https://devdactic.com

Popular Rest Projects
Popular Twitter Projects
Popular Application Programming Interfaces Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Token
Rest
Twitter
Oauth
Angularjs