Twitter4r Core

Core library for Twitter4R, which provides Ruby bindings for the Twitter REST API
Alternatives To Twitter4r Core
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Twitteroauth4,2317211653 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)...
Twitterapi906446118 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
Twitter4s258120 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
Android Oauth Handler119
2 years ago4July 10, 2021mitJava
Android OAuth Wrapper makes authenticating with APIs simple
Twitter4r Core84141311 years ago17July 11, 20118mitRuby
Core library for Twitter4R, which provides Ruby bindings for the Twitter REST API
6 months ago2HTML
Twitter RESTful avatar API
Ng Twitter55
478 years agoSeptember 02, 20155JavaScript
AngularJS library for the Twitter REST Api
Alternatives To Twitter4r Core
Select To Compare

Alternative Project Comparisons



Twitter4R provides an object based API to query or update your Twitter account via pure Ruby. It hides the ugly HTTP/REST code from your code.


gem install twitter4r

Getting Started

Add the twitter4r dependency to your Gemfile:

gem 'twitter4r', :require => 'twitter'

Set your OAuth consumer key and token like so:

Twitter.configure do |config|
  config.oauth_consumer_token = CONSUMER_KEY_HERE
  config.oauth_consumer_secret = CONSUME_SECRET_HERE

To create a client object with access tokens:

  client = => {
      :key => ACCESS\_KEY, :secret => ACCESS\_SECRET
  client.status(:post, "Your awesome less than 140 characters tweet goes here!!! #with #hashtag #goodness")

Usage Examples

Twitter4R starting with version 0.1.1 and above is organized into seven parts:


Library supports:

  • OAuth support for authentication with the REST and Search APIs
  • API access
  • Customizability of API endpoints such that any compliant API can be accessed (not just and's)
  • Uses lightweight native JSON under the hood as opposed to heavyweight XML parsing (which is what other Ruby Twitter client libraries use) REST API coverage includes:

  • Status posting and retrieving
  • User information
  • Profile updates and retrieval
  • Favorites add, remove, retrieve
  • Direct messaging post, remove, read
  • Friendship adding, removing, blocking
  • Geolocation embedding inside of statuses and reading from statuses
  • Rate limit status access
  • Trends retrieval and trend location querying Search API coverage includes:

  • Searching with various options




  • Kaiichi Matsunaga - proxy code suggestion
  • Sergio Santos <> - message paging code suggestion
  • Adam Stiles - URI.encode => CGI.escape fix
  • Carl Crawley - Friendship get => post fix
  • Christian Johansen - in_reply_to attributes in Twitter::Status
  • Harry Love - added attributes to Twitter::Status
  • Filipe Giusti - fixed users/show issue that changed from under us, also inspired the v0.5.2 bugfix release by submitting great issue example code.
  • Seth Cousins <seth.cousins at gmail dot com> - added HTTP timeout option and provided a patch that inspired the OAuth support for Twitter4R
  • John McKerrell <@mcknut on twitter> - added geo attribute to Twitter::Message.

Design Suggestions:

  • Bosco So - making Twitter::Error a RuntimeError instead of an Exception to prevent irb from crashing out.

External Dependencies

  • Ruby 1.8 (tested with 1.8.6)
  • RSpec gem 1.0.0+ (tested with 1.1.3)
  • JSON gem 0.4.3+ (tested with versions: 1.1.1 and 1.1.2)
  • jcode (for unicode support)
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.