Discover new Facebook functionality from the command line.
gem install meetup-cli
(might require sudo)
To interact with the Facebook API you must create and configure a new Facebook application for your personal use.
- Go to https://developers.facebook.com/apps and click "Add a New App"
- Go to the "Settings" tab
- Click "Add Platform"
- Select "Website"
- Set "Site URL" to
http://localhost
- Add
localhost
to the "App Domains" - Click "Save Changes"
- Go to the "App Review" tab
- Flip the switch that says "Your app is in development and unavailable to the public."
- Click "Confirm" to make your app live (why?)
- Go to the "Dashboard" tab
-
Under "App Secret" click "Show" to reveal your app secret
-
Open a terminal and save your App ID and App Secret by running:
facebook-cli config --appid=<app-id> --appsecret=<app-secret>
-
See: detailed instructions with screenshots
Once configured, you must log into Facebook with your credentials to authorize facebook-cli to interact with your profile.
- Open a terminal
- Run
facebook-cli login
- Open the URL in a web browser, and log into your Facebook account if prompted
- Click "Continue" to approve the permissions
- Select the scope of your audience for any posts you publish using this application (read more)
- Click "Ok" to continue
- Close the browser tab
- Run
See: detailed instructions with screenshots
facebook-cli login
facebook-cli likes
Running facebook-cli help
shows the list of available commands:
COMMANDS
api - Make a Facebook API request
config - Save Facebook application ID and secret
event - Show event details
events - List your upcoming events
feed - List the posts on your profile
friends - List the people you are friends with (some limitations)
help - Shows a list of commands or help for one command
likes - List the pages you have 'Liked'
links - Some useful URLs
login - Log into Facebook and receive an access token
logout - Deauthorize your access token
me - Show your profile information
pastevents - List your past events
photos - List photos you have uploaded
photosof - List photos you are tagged in
post - Post a message or image to your timeline
postlink - Post a link to your timeline
postvideo - Post a video to your timeline
videos - List videos you have uploaded
videosof - List videos you are tagged in
Running facebook-cli help <command>
may reveal more details.
The output can easily be converted to an HTML document using a Markdown renderer. For example, with Pandoc:
facebook-cli likes | pandoc -s -f markdown_github > likes.html
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:
- Facebook API: Graph API v2.4 Released, Removes Groups, Notifications and Stream Permissions
- Facebook Announces Graph API v2.3, More Deprecations
- Facebook API: Getting Friends Using Graph API 2.0 and PHP SDK 4.0.x
In an article published in October, 2012, Facebook developer Henry Zhang wrote:
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.
With so much functionality removed, it's not possible to build a full-featured interface to Facebook through the API.
If you can get a feature to work, please contribute.
Install dependencies with Bundler:
gem install bundler
bundle install
Please read the guide on how to contribute.
ISC