Hi, I am developing a simple FBconnect app and I can''t figure out how to publish a one-line story to the users feed. I have templates for the stories but I don''t know which methods/classes in the Facebooker API I have to use to actually access the Feed.publishUserAction API call (http://wiki.developers.facebook.com/index.php/Feed.publishUserAction). Could someone give me a hint? thx and kind regards Jan
Mike Mangino
2009-Feb-26 21:52 UTC
[Facebooker-talk] Facebook connect and One-line stories
Give me about a day. I''ll be releasing a sample rails Facebook connect application and a bunch of enhancements to Facebooker. Mike On Feb 26, 2009, at 2:58 PM, Jan Varwig wrote:> Hi, > > I am developing a simple FBconnect app and I can''t figure out how to > publish a one-line story to the users feed. I have templates for > the stories but I don''t know which methods/classes in the Facebooker > API I have to use to actually access the Feed.publishUserAction API > call > (http://wiki.developers.facebook.com/index.php/ > Feed.publishUserAction). > > Could someone give me a hint? > > thx and kind regards > > Jan > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
A day? Is that your response time now Mike? That''s a risky precedent you''re setting there :D Mike Mangino wrote:> Give me about a day. I''ll be releasing a sample rails Facebook connect > application and a bunch of enhancements to Facebooker. > > Mike > > On Feb 26, 2009, at 2:58 PM, Jan Varwig wrote: > >> Hi, >> >> I am developing a simple FBconnect app and I can''t figure out how to >> publish a one-line story to the users feed. I have templates for >> the stories but I don''t know which methods/classes in the Facebooker >> API I have to use to actually access the Feed.publishUserAction API call >> (http://wiki.developers.facebook.com/index.php/Feed.publishUserAction). >> >> Could someone give me a hint? >> >> thx and kind regards >> >> Jan >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >
Mike Mangino
2009-Feb-26 23:47 UTC
[Facebooker-talk] Facebook connect and One-line stories
I know :) It would be much longer if I hadn''t started working on it this morning. I have a spike working, so I just need to clean up the code and add tests. Mike On Feb 26, 2009, at 6:37 PM, Alan Larkin wrote:> A day? Is that your response time now Mike? That''s a risky precedent > you''re setting there :D > > Mike Mangino wrote: >> Give me about a day. I''ll be releasing a sample rails Facebook >> connect application and a bunch of enhancements to Facebooker. >> Mike >> On Feb 26, 2009, at 2:58 PM, Jan Varwig wrote: >>> Hi, >>> >>> I am developing a simple FBconnect app and I can''t figure out how to >>> publish a one-line story to the users feed. I have templates for >>> the stories but I don''t know which methods/classes in the Facebooker >>> API I have to use to actually access the Feed.publishUserAction >>> API call >>> (http://wiki.developers.facebook.com/index.php/Feed.publishUserAction >>> ). >>> >>> Could someone give me a hint? >>> >>> thx and kind regards >>> >>> Jan >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> -- >> Mike Mangino >> http://www.elevatedrails.com >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
This is going to be great... I''m looking for feed publishing for my FB Connect app as well. I ran into the issue that FB''s policy for Connect apps is that they don''t let one-line stories get published automatically unless they are whitelisted by Facebook first. And that policy is still under review. The only other option is generating a feed dialog but I don''t see feed dialog''s in Facebooker? -- - Adeel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090226/19939161/attachment.html>
Mike Mangino
2009-Feb-27 16:38 UTC
[Facebooker-talk] Facebook connect and One-line stories
I finished a first version of the application: http://github.com/mmangino/fb_connect_example/tree/master The version of facebooker in the application is slightly different than the current public version. I''m going to work on merging these changes back in today. I''ll send another email when they are ready. Mike On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote:> This is going to be great... I''m looking for feed publishing for my > FB Connect app as well. > I ran into the issue that FB''s policy for Connect apps is that they > don''t let one-line stories get published automatically unless they > are whitelisted by Facebook first. And that policy is still under > review. > The only other option is generating a feed dialog but I don''t see > feed dialog''s in Facebooker? > > -- > - Adeel > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Mike Mangino
2009-Feb-27 21:27 UTC
[Facebooker-talk] Facebook connect and One-line stories
I just updated facebooker and my sample application. To get a facebook session for the current user, you can use: before_filter :create_facebook_session This is like the old :set_facebook_session, but it doesn''t store the session in a cookie. To actually publish notifications, I use the following code in my controller: def create @note = current_user.sent_notes.create!(params[:note]) flash[:notice] = "Note sent to #{@note.recipient.email}" if facebook_session flash[:user_action_to_publish] = UserPublisher.create_note_sent(@note,facebook_session) end redirect_to notes_path end That stores a new user action in the flash. If I wasn''t redirecting, I could assign it to @ user_action_to_publish Then, in my controller, I grab the object from the flash after a redirect: before_filter :load_actions_to_publish def load_actions_to_publish @user_action_to_publish = flash[:user_action_to_publish] flash[:user_action_to_publish]=nil end Finally, I have a bit in my view that calls these. This means that on the page after an action would create a notification, the user is prompted to allow the notification in application.html.erb <% init_fb_connect "XFBML","Api" do %> <%= fb_user_action(@user_action_to_publish) if @user_action_to_publish%> <%= yield :fb_connect%> <% end %> Mike On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote:> This is going to be great... I''m looking for feed publishing for my > FB Connect app as well. > I ran into the issue that FB''s policy for Connect apps is that they > don''t let one-line stories get published automatically unless they > are whitelisted by Facebook first. And that policy is still under > review. > The only other option is generating a feed dialog but I don''t see > feed dialog''s in Facebooker? > > -- > - Adeel > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Thanks, I''ll dig into this tonight. This will be very useful.At the end, when you list code to prompt the user if they want to allow the notification, will this work for one-line stories as well? Since FB doesn''t let us send these automatically I''m hoping a simple confirmation prompt will work. - Adeel Founder/President Proletarian Design LLC 1066 47th Ave., Suite 19 Oakland, CA 94601 t: 415.205.0274 f: 415.871.2200 skype: a2ahmad twitter: _adeel www.proletariandesign.com On Fri, Feb 27, 2009 at 1:27 PM, Mike Mangino <mmangino at elevatedrails.com>wrote:> I just updated facebooker and my sample application. > > To get a facebook session for the current user, you can use: > > before_filter :create_facebook_session > > This is like the old :set_facebook_session, but it doesn''t store the > session in a cookie. > > To actually publish notifications, I use the following code in my > controller: > def create > @note = current_user.sent_notes.create!(params[:note]) > flash[:notice] = "Note sent to #{@note.recipient.email}" > if facebook_session > flash[:user_action_to_publish] > UserPublisher.create_note_sent(@note,facebook_session) > end > redirect_to notes_path > end > > That stores a new user action in the flash. If I wasn''t redirecting, I > could assign it to @ user_action_to_publish > > Then, in my controller, I grab the object from the flash after a redirect: > > before_filter :load_actions_to_publish > def load_actions_to_publish > @user_action_to_publish = flash[:user_action_to_publish] > flash[:user_action_to_publish]=nil > end > > Finally, I have a bit in my view that calls these. This means that on the > page after an action would create a notification, the user is prompted to > allow the notification > > > in application.html.erb > > <% init_fb_connect "XFBML","Api" do %> > <%= fb_user_action(@user_action_to_publish) if > @user_action_to_publish%> > <%= yield :fb_connect%> > <% end %> > > > Mike > > > > On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: > > This is going to be great... I''m looking for feed publishing for my FB >> Connect app as well. >> I ran into the issue that FB''s policy for Connect apps is that they don''t >> let one-line stories get published automatically unless they are whitelisted >> by Facebook first. And that policy is still under review. >> The only other option is generating a feed dialog but I don''t see feed >> dialog''s in Facebooker? >> >> -- >> - Adeel >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090227/35f3ff22/attachment.html>
Mike Mangino
2009-Feb-27 21:43 UTC
[Facebooker-talk] Facebook connect and One-line stories
Yep! The code pops up a window that lets the user pick what size story to show. It defaults to short story. Mike On Feb 27, 2009, at 4:35 PM, Adeel Ahmad wrote:> Thanks, I''ll dig into this tonight. This will be very useful. > At the end, when you list code to prompt the user if they want to > allow the notification, will this work for one-line stories as > well? Since FB doesn''t let us send these automatically I''m hoping a > simple confirmation prompt will work. > > > - Adeel > > Founder/President > Proletarian Design LLC > 1066 47th Ave., Suite 19 > Oakland, CA 94601 > t: 415.205.0274 > f: 415.871.2200 > skype: a2ahmad > twitter: _adeel > www.proletariandesign.com > > > On Fri, Feb 27, 2009 at 1:27 PM, Mike Mangino <mmangino at elevatedrails.com > > wrote: > I just updated facebooker and my sample application. > > To get a facebook session for the current user, you can use: > > before_filter :create_facebook_session > > This is like the old :set_facebook_session, but it doesn''t store the > session in a cookie. > > To actually publish notifications, I use the following code in my > controller: > def create > @note = current_user.sent_notes.create!(params[:note]) > flash[:notice] = "Note sent to #{@note.recipient.email}" > if facebook_session > flash[:user_action_to_publish] = > UserPublisher.create_note_sent(@note,facebook_session) > end > redirect_to notes_path > end > > That stores a new user action in the flash. If I wasn''t redirecting, > I could assign it to @ user_action_to_publish > > Then, in my controller, I grab the object from the flash after a > redirect: > > before_filter :load_actions_to_publish > def load_actions_to_publish > @user_action_to_publish = flash[:user_action_to_publish] > flash[:user_action_to_publish]=nil > end > > Finally, I have a bit in my view that calls these. This means that > on the page after an action would create a notification, the user is > prompted to allow the notification > > > in application.html.erb > > <% init_fb_connect "XFBML","Api" do %> > <%= fb_user_action(@user_action_to_publish) if > @user_action_to_publish%> > <%= yield :fb_connect%> > <% end %> > > > > Mike > > > > On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: > > This is going to be great... I''m looking for feed publishing for my > FB Connect app as well. > I ran into the issue that FB''s policy for Connect apps is that they > don''t let one-line stories get published automatically unless they > are whitelisted by Facebook first. And that policy is still under > review. > The only other option is generating a feed dialog but I don''t see > feed dialog''s in Facebooker? > > -- > - Adeel > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-- Mike Mangino http://www.elevatedrails.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090227/8dfc8b6e/attachment-0001.html>
kevin lochner
2009-Feb-28 03:23 UTC
[Facebooker-talk] Facebook connect and One-line stories
hey mike - Can you explain what you''re doing here:?> <%= yield :fb_connect%>- kevin On Feb 27, 2009, at 4:27 PM, Mike Mangino wrote:> I just updated facebooker and my sample application. > > To get a facebook session for the current user, you can use: > > before_filter :create_facebook_session > > This is like the old :set_facebook_session, but it doesn''t store the > session in a cookie. > > To actually publish notifications, I use the following code in my > controller: > def create > @note = current_user.sent_notes.create!(params[:note]) > flash[:notice] = "Note sent to #{@note.recipient.email}" > if facebook_session > flash[:user_action_to_publish] = > UserPublisher.create_note_sent(@note,facebook_session) > end > redirect_to notes_path > end > > That stores a new user action in the flash. If I wasn''t redirecting, > I could assign it to @ user_action_to_publish > > Then, in my controller, I grab the object from the flash after a > redirect: > > before_filter :load_actions_to_publish > def load_actions_to_publish > @user_action_to_publish = flash[:user_action_to_publish] > flash[:user_action_to_publish]=nil > end > > Finally, I have a bit in my view that calls these. This means that > on the page after an action would create a notification, the user is > prompted to allow the notification > > > in application.html.erb > > <% init_fb_connect "XFBML","Api" do %> > <%= fb_user_action(@user_action_to_publish) if > @user_action_to_publish%> > <%= yield :fb_connect%> > <% end %> > > > Mike > > > > On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: > >> This is going to be great... I''m looking for feed publishing for my >> FB Connect app as well. >> I ran into the issue that FB''s policy for Connect apps is that they >> don''t let one-line stories get published automatically unless they >> are whitelisted by Facebook first. And that policy is still under >> review. >> The only other option is generating a feed dialog but I don''t see >> feed dialog''s in Facebooker? >> >> -- >> - Adeel >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
Unfortunately I haven''t been able to get very far integrating this into my app. I get the "wrong number of arguments (1 for 2)" error on the line: <% init_fb_connect "XFBML","Api" do %>in the application layout file and can''t seem to get away from it so my app never gets to the its main page. I am able to get Mike''s example app somewhat working. I''m on Rails 2.1.1 and the example app is 2.2.2. Don''t know if there is a dependency there. However even with Mike''s app, while I''m able to see the login button and click it to get the Connect prompt, it always tells me I''m unable to login. I did update the facebooker.yml file with my dev app keys. Any ideas? - Adeel Founder/President Proletarian Design LLC 1066 47th Ave., Suite 19 Oakland, CA 94601 t: 415.205.0274 f: 415.871.2200 skype: a2ahmad twitter: _adeel www.proletariandesign.com On Fri, Feb 27, 2009 at 1:43 PM, Mike Mangino <mmangino at elevatedrails.com>wrote:> Yep! > The code pops up a window that lets the user pick what size story to show. > It defaults to short story. > > Mike > > On Feb 27, 2009, at 4:35 PM, Adeel Ahmad wrote: > > Thanks, I''ll dig into this tonight. This will be very useful.At the end, > when you list code to prompt the user if they want to allow the > notification, will this work for one-line stories as well? Since FB doesn''t > let us send these automatically I''m hoping a simple confirmation prompt will > work. > > > - Adeel > > Founder/President > Proletarian Design LLC > 1066 47th Ave., Suite 19 > Oakland, CA 94601 > t: 415.205.0274 > f: 415.871.2200 > skype: a2ahmad > twitter: _adeel > www.proletariandesign.com > > > On Fri, Feb 27, 2009 at 1:27 PM, Mike Mangino <mmangino at elevatedrails.com>wrote: > >> I just updated facebooker and my sample application. >> >> To get a facebook session for the current user, you can use: >> >> before_filter :create_facebook_session >> >> This is like the old :set_facebook_session, but it doesn''t store the >> session in a cookie. >> >> To actually publish notifications, I use the following code in my >> controller: >> def create >> @note = current_user.sent_notes.create!(params[:note]) >> flash[:notice] = "Note sent to #{@note.recipient.email<%23%7B at note.recipient.email> >> }" >> if facebook_session >> flash[:user_action_to_publish] >> UserPublisher.create_note_sent(@note,facebook_session) >> end >> redirect_to notes_path >> end >> >> That stores a new user action in the flash. If I wasn''t redirecting, I >> could assign it to @ user_action_to_publish >> >> Then, in my controller, I grab the object from the flash after a redirect: >> >> before_filter :load_actions_to_publish >> def load_actions_to_publish >> @user_action_to_publish = flash[:user_action_to_publish] >> flash[:user_action_to_publish]=nil >> end >> >> Finally, I have a bit in my view that calls these. This means that on the >> page after an action would create a notification, the user is prompted to >> allow the notification >> >> >> in application.html.erb >> >> <% init_fb_connect "XFBML","Api" do %> >> <%= fb_user_action(@user_action_to_publish) if >> @user_action_to_publish%> >> <%= yield :fb_connect%> >> <% end %> >> >> >> Mike >> >> >> >> On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: >> >> This is going to be great... I''m looking for feed publishing for my FB >>> Connect app as well. >>> I ran into the issue that FB''s policy for Connect apps is that they don''t >>> let one-line stories get published automatically unless they are whitelisted >>> by Facebook first. And that policy is still under review. >>> The only other option is generating a feed dialog but I don''t see feed >>> dialog''s in Facebooker? >>> >>> -- >>> - Adeel >>> >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>> >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> >> > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090227/d245e189/attachment.html>
Ok the new changes seem to only like Rails 2.2.2.All works now after I upgraded mine from 2.1.1... now to make sure my tests are all ok... - Adeel Founder/President Proletarian Design LLC 1066 47th Ave., Suite 19 Oakland, CA 94601 t: 415.205.0274 f: 415.871.2200 skype: a2ahmad twitter: _adeel www.proletariandesign.com On Fri, Feb 27, 2009 at 11:49 PM, Adeel Ahmad <adeel at proletariandesign.com>wrote:> Unfortunately I haven''t been able to get very far integrating this into my > app. I get the "wrong number of arguments (1 for 2)" error on the line: <% > init_fb_connect "XFBML","Api" do %> > in the application layout file and can''t seem to get away from it so my app > never gets to the its main page. I am able to get Mike''s example app > somewhat working. I''m on Rails 2.1.1 and the example app is 2.2.2. Don''t > know if there is a dependency there. > However even with Mike''s app, while I''m able to see the login button and > click it to get the Connect prompt, it always tells me I''m unable to login. > I did update the facebooker.yml file with my dev app keys. > Any ideas? > > > - Adeel > > Founder/President > Proletarian Design LLC > 1066 47th Ave., Suite 19 > Oakland, CA 94601 > t: 415.205.0274 > f: 415.871.2200 > skype: a2ahmad > twitter: _adeel > www.proletariandesign.com > > > On Fri, Feb 27, 2009 at 1:43 PM, Mike Mangino <mmangino at elevatedrails.com>wrote: > >> Yep! >> The code pops up a window that lets the user pick what size story to show. >> It defaults to short story. >> >> Mike >> >> On Feb 27, 2009, at 4:35 PM, Adeel Ahmad wrote: >> >> Thanks, I''ll dig into this tonight. This will be very useful.At the end, >> when you list code to prompt the user if they want to allow the >> notification, will this work for one-line stories as well? Since FB doesn''t >> let us send these automatically I''m hoping a simple confirmation prompt will >> work. >> >> >> - Adeel >> >> Founder/President >> Proletarian Design LLC >> 1066 47th Ave., Suite 19 >> Oakland, CA 94601 >> t: 415.205.0274 >> f: 415.871.2200 >> skype: a2ahmad >> twitter: _adeel >> www.proletariandesign.com >> >> >> On Fri, Feb 27, 2009 at 1:27 PM, Mike Mangino <mmangino at elevatedrails.com >> > wrote: >> >>> I just updated facebooker and my sample application. >>> >>> To get a facebook session for the current user, you can use: >>> >>> before_filter :create_facebook_session >>> >>> This is like the old :set_facebook_session, but it doesn''t store the >>> session in a cookie. >>> >>> To actually publish notifications, I use the following code in my >>> controller: >>> def create >>> @note = current_user.sent_notes.create!(params[:note]) >>> flash[:notice] = "Note sent to #{@note.recipient.email<%23%7B at note.recipient.email> >>> }" >>> if facebook_session >>> flash[:user_action_to_publish] >>> UserPublisher.create_note_sent(@note,facebook_session) >>> end >>> redirect_to notes_path >>> end >>> >>> That stores a new user action in the flash. If I wasn''t redirecting, I >>> could assign it to @ user_action_to_publish >>> >>> Then, in my controller, I grab the object from the flash after a >>> redirect: >>> >>> before_filter :load_actions_to_publish >>> def load_actions_to_publish >>> @user_action_to_publish = flash[:user_action_to_publish] >>> flash[:user_action_to_publish]=nil >>> end >>> >>> Finally, I have a bit in my view that calls these. This means that on the >>> page after an action would create a notification, the user is prompted to >>> allow the notification >>> >>> >>> in application.html.erb >>> >>> <% init_fb_connect "XFBML","Api" do %> >>> <%= fb_user_action(@user_action_to_publish) if >>> @user_action_to_publish%> >>> <%= yield :fb_connect%> >>> <% end %> >>> >>> >>> Mike >>> >>> >>> >>> On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: >>> >>> This is going to be great... I''m looking for feed publishing for my FB >>>> Connect app as well. >>>> I ran into the issue that FB''s policy for Connect apps is that they >>>> don''t let one-line stories get published automatically unless they are >>>> whitelisted by Facebook first. And that policy is still under review. >>>> The only other option is generating a feed dialog but I don''t see feed >>>> dialog''s in Facebooker? >>>> >>>> -- >>>> - Adeel >>>> >>>> _______________________________________________ >>>> Facebooker-talk mailing list >>>> Facebooker-talk at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>>> >>> >>> -- >>> Mike Mangino >>> http://www.elevatedrails.com >>> >>> >>> >>> >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090228/a5f1f48f/attachment-0001.html>
Mike Mangino
2009-Mar-01 15:50 UTC
[Facebooker-talk] Facebook connect and One-line stories
On Feb 27, 2009, at 10:23 PM, kevin lochner wrote:> hey mike - > > Can you explain what you''re doing here:? > >> <%= yield :fb_connect%> >Sure, that''s just an extension point for me to provide extra js that I want to run in the context of the api initialization. I''m not using it yet, but I think I will when I start doing friend invitations. Mike> - kevin > > On Feb 27, 2009, at 4:27 PM, Mike Mangino wrote: > >> I just updated facebooker and my sample application. >> >> To get a facebook session for the current user, you can use: >> >> before_filter :create_facebook_session >> >> This is like the old :set_facebook_session, but it doesn''t store >> the session in a cookie. >> >> To actually publish notifications, I use the following code in my >> controller: >> def create >> @note = current_user.sent_notes.create!(params[:note]) >> flash[:notice] = "Note sent to #{@note.recipient.email}" >> if facebook_session >> flash[:user_action_to_publish] = >> UserPublisher.create_note_sent(@note,facebook_session) >> end >> redirect_to notes_path >> end >> >> That stores a new user action in the flash. If I wasn''t >> redirecting, I could assign it to @ user_action_to_publish >> >> Then, in my controller, I grab the object from the flash after a >> redirect: >> >> before_filter :load_actions_to_publish >> def load_actions_to_publish >> @user_action_to_publish = flash[:user_action_to_publish] >> flash[:user_action_to_publish]=nil >> end >> >> Finally, I have a bit in my view that calls these. This means that >> on the page after an action would create a notification, the user >> is prompted to allow the notification >> >> >> in application.html.erb >> >> <% init_fb_connect "XFBML","Api" do %> >> <%= fb_user_action(@user_action_to_publish) if >> @user_action_to_publish%> >> <%= yield :fb_connect%> >> <% end %> >> >> >> Mike >> >> >> >> On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: >> >>> This is going to be great... I''m looking for feed publishing for >>> my FB Connect app as well. >>> I ran into the issue that FB''s policy for Connect apps is that >>> they don''t let one-line stories get published automatically unless >>> they are whitelisted by Facebook first. And that policy is still >>> under review. >>> The only other option is generating a feed dialog but I don''t see >>> feed dialog''s in Facebooker? >>> >>> -- >>> - Adeel >>> >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >-- Mike Mangino http://www.elevatedrails.com
kevin lochner
2009-Mar-02 17:09 UTC
[Facebooker-talk] Facebook connect and One-line stories
thanks mike - At the risk of revealing how new I am to RoR, I hadn''t yet come across content_for, this will be really helpful - I''ve been having problems with multiple window.onload calls and didn''t have a good solution. Regarding the rest of your demo site - I think you could smooth out the account creation and login system to take better advantage of fb connect. First off, your app requires a page refresh to pick up the fb connect login status, because the cookies get set when the page is rendered. The facebook demo app (therunaround) uses a window.onload call to refresh the page if the server hasn''t picked up the user login status (that''s one of my window.onload calls). You may also want to tweak how you handle login status:> def current_user > if session[:user_id] > @current_user ||= User.find(session[:user_id]) > elsif facebook_session and @current_user.nil? > user = User.find_by_facebook_id(facebook_session.user.id) > if user > session[:user_id] = user.id > @current_user = user > end > end > endIf the user logs out of facebook they should also be logged out of your site, so you shouldn''t store the userid in the session if they''re logged in via fb connect - just pull it from the cookies every time. One other suggestion - I use the post-authorize url to handle account creation, so users aren''t forced to create a native account and subsequently link their fb account (although it''s good to offer the option if they go the native account route). -kevin On Mar 1, 2009, at 10:50 AM, Mike Mangino wrote:> > On Feb 27, 2009, at 10:23 PM, kevin lochner wrote: > >> hey mike - >> >> Can you explain what you''re doing here:? >> >>> <%= yield :fb_connect%> >> > > Sure, that''s just an extension point for me to provide extra js that > I want to run in the context of the api initialization. I''m not > using it yet, but I think I will when I start doing friend > invitations. > > Mike > > >> - kevin >> >> On Feb 27, 2009, at 4:27 PM, Mike Mangino wrote: >> >>> I just updated facebooker and my sample application. >>> >>> To get a facebook session for the current user, you can use: >>> >>> before_filter :create_facebook_session >>> >>> This is like the old :set_facebook_session, but it doesn''t store >>> the session in a cookie. >>> >>> To actually publish notifications, I use the following code in my >>> controller: >>> def create >>> @note = current_user.sent_notes.create!(params[:note]) >>> flash[:notice] = "Note sent to #{@note.recipient.email}" >>> if facebook_session >>> flash[:user_action_to_publish] = >>> UserPublisher.create_note_sent(@note,facebook_session) >>> end >>> redirect_to notes_path >>> end >>> >>> That stores a new user action in the flash. If I wasn''t >>> redirecting, I could assign it to @ user_action_to_publish >>> >>> Then, in my controller, I grab the object from the flash after a >>> redirect: >>> >>> before_filter :load_actions_to_publish >>> def load_actions_to_publish >>> @user_action_to_publish = flash[:user_action_to_publish] >>> flash[:user_action_to_publish]=nil >>> end >>> >>> Finally, I have a bit in my view that calls these. This means that >>> on the page after an action would create a notification, the user >>> is prompted to allow the notification >>> >>> >>> in application.html.erb >>> >>> <% init_fb_connect "XFBML","Api" do %> >>> <%= fb_user_action(@user_action_to_publish) if >>> @user_action_to_publish%> >>> <%= yield :fb_connect%> >>> <% end %> >>> >>> >>> Mike >>> >>> >>> >>> On Feb 27, 2009, at 2:55 AM, Adeel Ahmad wrote: >>> >>>> This is going to be great... I''m looking for feed publishing for >>>> my FB Connect app as well. >>>> I ran into the issue that FB''s policy for Connect apps is that >>>> they don''t let one-line stories get published automatically >>>> unless they are whitelisted by Facebook first. And that policy is >>>> still under review. >>>> The only other option is generating a feed dialog but I don''t see >>>> feed dialog''s in Facebooker? >>>> >>>> -- >>>> - Adeel >>>> >>>> _______________________________________________ >>>> Facebooker-talk mailing list >>>> Facebooker-talk at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>> >>> -- >>> Mike Mangino >>> http://www.elevatedrails.com >>> >>> >>> >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > -- > Mike Mangino > http://www.elevatedrails.com > > >
Hey Mike, Thanks for the sample/template app, it really helped since documentation on FB connect is close to nil at this point. It would have otherwise taken me days to figure out, instead of now only a few short hours. Would you be able to add a few examples on how to invite friends to the app through facebook, and then how to see other friends that already have the app connected? It would also be important to remove all the friends from the invitation list that already have the app connected. Thanks again, Ryan G
Mike Mangino
2009-Mar-02 18:15 UTC
[Facebooker-talk] Facebook connect and One-line stories
That''s the next thing on my list. I put the app on github to allow others to help out too. If anyone wants to improve the app, feel free to fork it and send me pull requests. Mike On Mar 2, 2009, at 12:18 PM, Ryan Ghods wrote:> Hey Mike, > > Thanks for the sample/template app, it really helped since > documentation on FB connect is close to nil at this point. It would > have otherwise taken me days to figure out, instead of now only a few > short hours. > Would you be able to add a few examples on how to invite friends to > the app through facebook, and then how to see other friends that > already have the app connected? It would also be important to remove > all the friends from the invitation list that already have the app > connected. > > Thanks again, > Ryan G > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com