whatisgithub

What is twitter-ruby?

sferik/twitter-ruby — explained in plain English

Analysis updated 2026-06-26

4,576RubyAudience · developerComplexity · 2/5Setup · moderate

In one sentence

A Ruby library for controlling a Twitter/X account from code, post tweets, read timelines, search posts, and receive live tweet streams, without writing raw HTTP requests.

Mindmap

mindmap
  root((twitter-ruby))
    What it does
      Post and read tweets
      Follow users
      Live tweet streaming
    Auth
      OAuth credentials
      X developer portal
    Features
      REST API calls
      Streaming clients
      Search and filters
    Notes
      Targets API v1.1
      Legacy projects
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Automate posting tweets or following users from a Ruby script.

USE CASE 2

Build a bot that monitors Twitter for keywords and responds automatically.

USE CASE 3

Stream live tweets matching a topic in real time into your application.

What is it built with?

Ruby

How does it compare?

sferik/twitter-rubyactivemerchant/active_merchanthahwul/webhackersweapons
Stars4,5764,5954,598
LanguageRubyRubyRuby
Setup difficultymoderatemoderateeasy
Complexity2/53/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires registering an app on the X developer portal to get OAuth credentials before making any API calls.

License details not mentioned in the explanation.

So what is it?

The Twitter Ruby Gem is a library that lets Ruby programs talk to the Twitter (now X) API. Instead of writing raw HTTP requests, developers call simple methods like client.update, client.follow, or client.search, and the gem handles the communication with Twitter's servers in the background. The result is that actions you would normally do in a browser, like posting a tweet, following a user, or reading a timeline, can be automated from a Ruby program. Using the library requires OAuth credentials, which you get by registering an application in the X developer portal. Once you have a consumer key, consumer secret, access token, and access token secret, you pass them to the client when setting it up. Every request you make after that is authenticated automatically. The gem covers the standard REST actions: posting tweets, fetching a user's profile or follower list, reading home and mentions timelines, looking up individual tweets by ID, and searching recent posts with filters like language or keyword exclusions. It also includes streaming clients that can receive a live feed of tweets matching certain topics, or all activity from the authenticated user's account, as it happens. The README notes that this gem targets the older API v1.1. For new projects that need the newer API v2 features, the author suggests using a separate gem called X instead. The Twitter Ruby Gem is still maintained for projects already using the v1.1 interface.

Copy-paste prompts

Prompt 1
Using the twitter Ruby gem, write a script that posts a tweet with today's date and the text 'Good morning!' using my OAuth credentials.
Prompt 2
Show me how to set up the twitter Ruby gem client with my consumer key and access token, then fetch my home timeline and print each tweet's text.
Prompt 3
Write a Ruby script using the twitter gem's streaming client to print every tweet that mentions a specific keyword as it happens.
Prompt 4
How do I search for recent tweets in a specific language using the twitter Ruby gem and filter out retweets?

Frequently asked questions

What is twitter-ruby?

A Ruby library for controlling a Twitter/X account from code, post tweets, read timelines, search posts, and receive live tweet streams, without writing raw HTTP requests.

What language is twitter-ruby written in?

Mainly Ruby. The stack also includes Ruby.

What license does twitter-ruby use?

License details not mentioned in the explanation.

How hard is twitter-ruby to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is twitter-ruby for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.