Fbtt Facebooker Tutorial

Next Lesson → News Feed

3.1) Mini Feed


This lesson covers the Facebooker Publisher Api and shows how to send a message to a user's Mini-Feed. When you publish a story to the Mini-Feed, there is also a chance that the story will be published to friends of that user that have also added the app. See Feed.publishActionOfUser for more details.

  1. I am pretty sure that the permissions around the the Mini Feed, require that the user hass added the application. Put this call at the top of the controller.
    
    
    ensure_application_is_installed_by_facebook_user
    Note: Facebook will fail silently if the user has not added the app
  2. Create a class that extends Facebooker::Rails::Publisher. You can put this class anywhere but Rails will auto load it if you put it in RAILS_ROOT/lib.
    1
    2
    3
    
    #File: lib/facebooker_publisher.rb
    class FacebookerPublisher < Facebooker::Rails::Publisher
      
    
  3. Define a method that will handle your Mini Feed message. This method can take any number of arguments. For a Mini Feed you typically would need to pass in the user that the message is for. You must set which user's Mini-Feed is being published to with the from method. It is best if the first line in you method indicates which type of message to publish to Facebook, in this case this is done via "send_as :action".
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    #File: lib/facebooker_publisher.rb Method: mini_feed
    def mini_feed(user)
      send_as :action
      self.from( user)
      title "just learned how to send a Mini-Feed Story using Facebooker."
      body "#{fb_name(user)} just checked out the #{link_to("Facebooker Tutorial", :controller => "messaging", :action => "mini_feed")} Mini-Feed lesson."
      image_1(image_path("fbtt.png"))
      image_1_link(outline_path(:only_path => false))
      RAILS_DEFAULT_LOGGER.debug("Sending mini feed story for user #{user.id}")
    end
    
    The Publisher instance that gets created is a proxy for each of the Facebooker messaging types. You can look at the code or documentation so see what methods are supported. The following options are supported by "send_as" and the class to look at for available methods.
    • :action => Facebooker::Feed::Action
    • :story => Facebooker::Feed::Story
    • :templatized_action => Facebooker::Feed::TemplatizedAction
    • :email => Facebooker::User send_email method
    • :notification => Facebooker::Session send_notification method
  4. Now you can deliver your Mini-Feed news item by calling deliver_<method>
    1
    2
    3
    4
    5
    6
    7
    
    #File: app/controllers/messaging_controller.rb Method: test_mini_feed
    def test_mini_feed
        FacebookerPublisher.deliver_mini_feed(facebook_session.user)
        flash[:notice] = "Check your Mini-Feed in a little while. You should see a news item from Facebooker."
        redirect_to(:action => "mini_feed")
    end
    
    

Test Mini Feed Now!

Next Lesson → News Feed
Peepcodead
Comment Section for Mini Feed

Security Check

Enter both words below, separated by a space.
Can't read the words below? Try different words or an audio captcha.
Loading...

Srikanth PagadalaFeb 23, 2009

Hi David

Thanks for great plugin.

One feature request (i have posted the same on sourceforge feature request page too).

http://wiki.developers.facebook.com/index.php/Mobile

fb mobile is relatively new, which is somehow completely missing from facebooker.
if you check out the above url there are supposedly two new apis

1) sms.send(uid uid, string message, i32 session_id, bool req_session)
2) sms.canSend(uid uid)

I think SMS support should be part of facebooker publisher apis. Any chance of putting in a patch?

Thanks
Sriks
 

Daniele BonifaziFeb 18, 2009

Is there any way to send an "app_to_user" notification in Facebooker ?
That kind of notification doesn't require a session, I'm new to Facebooker and I'm stuck, I need to send app_to_user notifications from cron_jobs . Can you help me ?
 

Adam Berlinsky-SchineJan 17, 2009

I got this working with new profiles using the "user_action" publisher. See the first example here: http://facebooker.rubyforge.org/classes/Facebooker/Rails/Publisher.html
 

Elías Emilio Orozco ChagüiJan 15, 2009

Me too! Does anyone has any insight on this?
 

Helmut FritzJan 15, 2009

yeah i'm having the same problem that mario... this is not working or maybe i'm doing something wrong... please help!
 

Mario TatisJan 15, 2009

class BlogsController < ApplicationController

ensure_authenticated_to_facebook

def index



FacebookerPublisher.deliver_mini_feed(session[:facebook_session].user)



@blogs = Blog.search(params[:search], params[:page])
end
.
.
.
end
 

Mario TatisJan 15, 2009

Hello, everyone
Thanks for the tutorial!

i'm having some problems with the mini_feed method. i always get this error

StandardError in BlogsController#index

This method is deprecated
 

Srikanth PagadalaNov 2, 2008

Hi David. I got peepcode and managed to get mini-feed working in the new format. Unfortunately I'm still unable to get News-feed working. reference to page# in peepcode pdf will be great.
 

David ClementsNov 1, 2008

Facebook moved to a new format and jsut recently turned off the old one. I keep meaning to update the tutorial, haven't had the time yet.

It is in the PeepCode book, you can get it for 9 bucks if you can't wait for some help on the tutorial.
 

Srikanth PagadalaNov 1, 2008

Mini feed sample used to work fine. Now, it is neither working in my app nor in here...what could have gone wrong?
 

David ClementsOct 28, 2008

Facebooker totally supports this. I haven't had a chance to update the tutorial... Soon though I hope.
 

Forrest GrantOct 28, 2008

publishActionOfUser has been deprecated and replaced by publishUserAction any plans to update facebooker to accommodate this?
 

David ClementsAug 15, 2008

There is a bug being talked about on the facebooker-talk email list.

http://rubyforge.org/pipermail/facebooker-talk/2008-August/000913.html

I don't konw the full details yet.
 

Gray NoodleAug 14, 2008

I keep getting a message about nil.post. Turns out that the bebo_adapter.rb is getting used. Shouldn't this get used only when using bebo?
 

Prabha PattabiramanAug 13, 2008

All my requests are finite.I don't know where and how can i ask my users to set an infinite session.please help me. Is the code below to set the session work only when the user session is infinite.
 

David ClementsAug 12, 2008

Email is pretty hard to debug. My first suggestion is to make sure that the email only has text in it.

I am not sure what you mean about configuring your app for receiving. I wouldn't even try that until you can get a simple email from your application to a standard email account. Also check your spam folder and make sure it isn't landing there.
 

Birba RaniAug 12, 2008

i had to send emails to my users. I created the sessions as said above as i am sending emails offline. I am able to get users information.but still i don't get emails to my inbox.I have not exceeded my facebook email limit and i have enabled the receive email setting for my app.cannot figure out the problem.can anybody help?
 

Ivan Acosta-RubioJul 5, 2008

Wicked!!!! Thanks for the tutorial!
 

Brad HubbardMar 19, 2008

Whenever I try to post my action, I get:
Facebooker::Session::SessionExpired (Session key invalid or no longer valid):

Any clues?
 

Jorge MiramontesMar 11, 2008

sweet man. Thanks!
 
Displaying 20 of 24 posts.