Home

Awesome

Facebook CLI

Facebook functionality from the command line.

Download the gem at https://rubygems.org/gems/facebook-cli Join the chat at https://gitter.im/facebook-cli/discuss Take a moment to thank @specious

Demo

<a href="https://asciinema.org/a/87129"><img src="https://asciinema.org/a/87129.png" width="400"/></a>

Install

gem install facebook-cli (might require sudo)

Facebook setup

To interact with the Facebook API you must create and configure a Facebook application for your personal use. Follow these instructions carefully:

Logging in

Once the Facebook app is configured, you must authorize it to access the social graph on your behalf:

Commands

Running facebook-cli or facebook-cli help shows the list of available commands:

COMMANDS
    api        - Make a direct Facebook API request
    config     - Save your Facebook API credentials
    feed       - List posts on your timeline
    help       - Shows a list of commands or help for one command
    likes      - List pages you have 'Liked'
    links      - Some useful URLs
    login      - Request Facebook permissions and receive an API access token
    logout     - Deauthorize your access token
    me         - Show your profile information
    photos     - List photos you have uploaded
    photosof   - List photos you are tagged in
    videos     - List videos you have uploaded
    videosof   - List videos you are tagged in

Run facebook-cli help <command> for more details on each command.

Converting output to HTML

Use a Markdown renderer to easily convert the output to an HTML document. For example, using Pandoc:

facebook-cli likes | pandoc -s -f markdown_github > likes.html

See: example

Things created with facebook-cli

Why can't I...?

Facebook has removed a large portion of their Graph API starting with version 2.0. Niraj Shah has done a fantastic job documenting the cutbacks and their implications in these blog posts:

An article published in October, 2012 by Facebook developer Henry Zhang provides insight into the reasoning:

Post to friends wall via the API generate a high levels of negative user feedback, including “Hides” and “Mark as Spam" and so we are removing it from the API. If you want to allow people to post to their friend’s timeline from your app, you can invoke the feed dialog.

More recent changes outlined on Facebook's developer portal cover further massive deprecations enactedin 2018, which have eliminated facebook-cli's ability to access past and upcoming events, publish content and retrieve names of taggable friends, as was still possible with the previous long-standing restriction. facebook-cli's available functions have been pruned to reflect the latest changes.

The functionality removed renders it impossible to build a full-featured interface to Facebook through the Graph API alone.

If you expand the functionality of facebook-cli in any way, please open a pull request.

Development

Clone this repository, then use Bundler to install Ruby dependencies:

gem install bundler
bundle install

You should now be able to run facebook-cli from the bin directory:

bundle exec bin/facebook-cli

facebook-cli depends on the Koala library for interfacing with Facebook's Graph API and GLI for parsing command line arguments.

Using a ruby environment manager such as rbenv or rvm is advisable to avoid environment conflicts between projects.

If you'd like to contribute, please take a brief look at the guide.

Other Facebook client software in the open source community

Applications:

Libraries:

License

ISC