Now that Twitter 1.1 and Feeds are buddies, time to move to other data sources. Next up: Facebook. Using trusty Feeds and friends, I was able to ingest my own Facebook home feed. Here's how to replicate this:
For the impatient, attached is a feature that should get you set up quickly. You'll need the following modules:
- Feeds latest HEAD from 7.x-2.x branch.
- Feeds JSONPath Parser version 7.x-1.0-beta2 - make sure to install the needed JSONPath library as per the instructions on the module page.
- Feeds OAuth latest HEAD from 7.x-1.x branch.
- php-proauth library that you install in sites/all/libraries module as such:
git clone https://github.com/infojunkie/php-proauth.git
The idea behind the setup is to create a Feeds pipeline that:
- Fetches the given resource URL (a Facebook Graph API URL) using Feeds OAuth 2.0 Fetcher. This fetcher checks for OAuth 2.0 access token for the current user and performs authorization if it's not found. It alerts the user to missing access tokens during feed creation.
- Parses the result using Feeds JSONPath Parser, since Facebook Graph API uses JSON.
- Maps the result to nodes using the standard Node Processor.
Setting up the Facebook app
Create a new Facebook application. You need to add two specific settings to it:
- Basic > Website with Facebook Login > Site URL: enter the callback URL that is reported in the Feed importer's Fetcher > HTTPS OAuth 2.0 Fetcher Settings > Site identifier description.
- Permissions > Extended Permissions: add the
Configuring the feature
- You will need to copy the App ID and App Secret strings of the Facebook app to the Fetcher > HTTPS OAuth 2.0 Fetcher Settings > Consumer key and Consumer secret settings, respectively.
- Set the fetcher's Method to GET.
- Then create a new node of type Facebook feed with the Graph API URL (e.g. your home feed). Make a note of this node's nid.
- Finally, edit the facebook view included in this feature, such that the filter Feeds item: Owner feed nid refers to the nid noted above.
That's it. This should cure your feed indigestions!