Sarav's Weblog

Technical Articles for RoR Developers

blackbook gem (Contact Importer gem for Ruby on Rails)

Blackbook automates the nitty-gritty of importing contacts from various services and files and exporting them as VCard, XML, or simple Hash. Utilize those contacts from services like AOL, GMail, Yahoo Mail, Hotmail or CSV to help your social networking site become GIGANTIC overnight! You‘ll be able to get big and sell for millions before anyone figures out it‘s just like every other social network.



The current list of supported services and file types:


  • AOL
  • CSV files
  • Gmail
  • Hotmail
  • Yahoo! Mail


  • Simple hash (default)
  • Vcard
  • XML

If you create an additional importer or exporter – or simply find a bug – please consider submitting it as a patch to the project so the community can all benefit from your hard work and ingenuity.


# An example of fetching Gmail contacts – by default, returns an array of hashes with :name and :email

  contacts = Blackbook.get :username => '', :password => 'whatever'

# or returning XML

  contacts = Blackbook.get :username => '', :password => 'whatever', :as =>  :x ml

# or importing from a CSV file

  contacts = Blackbook.get :csv, :file => #<File:/path/to/file.csv>


  • Mechanize and its dependencies, for interacting with online providers
  • Fastercsv for reading CSV, Mechanize >= 0.7.0 for page scraping


  • sudo gem install blackbook


5 responses to “blackbook gem (Contact Importer gem for Ruby on Rails)

  1. Dhanuja March 13, 2009 at 7:01 am

    Hi Sarav,

    Good work!

  2. mojombo April 7, 2009 at 12:43 pm

    hi siruvani

    nice work

  3. senthil December 6, 2012 at 3:11 pm

    hi when i run this sample code, i got following error “uninitialized constant WWW::Mechanize::SyncEnumerator (NameError)”. how to solve this issue?


    require “rubygems”
    require ‘blackbook’

    @contacts = Blackbook.get :username => ‘xxxxxxx’, :password => ‘xxxxxxxxxx’


  4. Ann June 27, 2013 at 7:14 pm

    Hi, after reading this amazing article i am as well happy to share
    my knowledge here with mates.

  5. bellewaters qingjian realty August 27, 2014 at 3:16 pm

    I got this web page from my friend who told me about this
    site and at the moment this time I am browsing this web site and reading very informative articles or reviews at this place.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: