Can't Subscribe to Facebook Page Feed via Koala & Rails

657 views Asked by At

Has anyone been able to actually subscribe to a Page Feed via Koala to Facebook? I'm able to subscribe to User Likes, Friends, Feeds etc and Page Photo, Checkins. But I can not get Facebook to subscribe and post back updates on Page Feeds. Here's what I run through the Rails Console (postback url is changed)

updates.subscribe("page", "feed", "http://domain.com/facebook_updates", FacebookUpdatesController::VERIFY_TOKEN)
Koala::Facebook::APIError: OAuthException: (#100) "feed" is an invalid field name
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/koala-1.2.1/lib/koala/graph_api.rb:217:in `block in graph_call'
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/koala-1.2.1/lib/koala.rb:69:in `api'
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/koala-1.2.1/lib/koala/graph_api.rb:215:in `graph_call'
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/koala-1.2.1/lib/koala/realtime_updates.rb:62:in `subscribe'
    from (irb):66
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start'
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start'
    from /opt/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
1

There are 1 answers

0
GreenEggs On

Ok...once again I think I figured it out. Here's what I corrected:

  1. Properly setup your Facebook application to be accessible to Facebook Pages. See tutorial http://www.hyperarts.com/blog/tutorial-add-an-iframe-application-to-your-facebook-fan-page-fall-2012/
  2. You must subscribe to 'user', 'feed' to access a Page's feed data. Example:

    updates.subscribe("user", "feed", "http://domain.com/facebook_updates", FacebookUpdatesController::VERIFY_TOKEN)

  3. Omniauth must have the proper permissions to receive the Feed realtime update. In particular I had to add 'read_stream' to the scope parameter. I'm using devise with Omniauth here's an example from the devise.rb file:

    config.omniauth :facebook, 'APP_ID', 'APP_SECRET', {:scope => 'publish_stream,email,offline_access,user_location,user_likes,user_interests,read_stream,manage_pages', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}

I do hope this helps others that were struggling like me.