I want to create a notification for a user that isn't logged in

Feb 12, 2010 at 1:37 AM

I want to create a notification for a user that isn't logged in. 

Here is the flow:

  1. A user logs into my website using my site's .NET authentication.
  2. The user authorizes my site's facebook authentication to facebook and I store the user's userID and associate that ID with their account.
  3. At certain intervals, I want to send  a Dashboard.AddNews and Dashboard.IncrementCounter to the Facebook user.  During this send, the active user would be logged onto the site and given my app authorization, but not be logged into Facebook.

Any help would be appreciated.  If someone was able to help beyond the scope of a forum reply, we may be interested in a couple hours of consultation.

Thanks,

Kevin

Feb 12, 2010 at 5:04 PM

Here is some code that works for adding dashboard news:

 

                string APIKey = ConfigurationManager.AppSettings["API_Key"];
                string APISecret = ConfigurationManager.AppSettings["API_Secret"];

                Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession(APIKey, APISecret);
                Facebook.Rest.Api api = new Facebook.Rest.Api(connectsession);

                var message = @"[{""message"":""Your message goes here"", ""action_link"":{""href"":""http://apps.facebook.com/yourapp/page"", ""text"":""Friendly description for action hyperlink""}}]";

                var newsparams = new Dictionary<string, string>();
                newsparams.Add("method", "Dashboard.addNews");
                newsparams.Add("uid", target_userid);
                newsparams.Add("news", message);
                var newsresponse = api.SendRequest(newsparams);
                Debug.WriteLine(string.Format("news response is {0}", newsresponse));

I don't think it matters if the user is logged in or not.

 

Feb 12, 2010 at 10:13 PM

Thanks you.  That worked great.  This will help out another thread.  I'll give you credit!

Mar 18, 2010 at 3:10 AM

I used your code and I get back a valid response code but I don't see the news item anywhere on the user page, I should see it under the news section right?  Do you know the status of the Dashboard API?  Is this functionality still available and working properly?

Mar 18, 2010 at 4:34 PM

Well that's kinda the problem with the dashboard notifications.  You have to work really really hard to find them once they are created.  Sort of defeats the purpose of a "notification" if you ask me.  

Here is a link to the applications dashboard:  http://www.facebook.com/home.php?#!/?sk=apps

If you look at the Dashboards Roadmap page http://wiki.developers.facebook.com/index.php/Roadmap_Dashboards  it says "Available now for testing. Will launch to users in February 2010."

Mar 19, 2010 at 5:24 PM
patja wrote:

Well that's kinda the problem with the dashboard notifications.  You have to work really really hard to find them once they are created.  Sort of defeats the purpose of a "notification" if you ask me.  

Here is a link to the applications dashboard:  http://www.facebook.com/home.php?#!/?sk=apps

If you look at the Dashboards Roadmap page http://wiki.developers.facebook.com/index.php/Roadmap_Dashboards  it says "Available now for testing. Will launch to users in February 2010."

 Hey patja,

Thanks again for the reply.  I have read about capturing the permanent session key and passing that with my request but I notice you don't have that parameter in your request.  Here's the background of my application:

I have a web site where people can subscribe to a notification service and they can choose to recieve this through facebook.  I used to use facebook notifications which worked great until the brain trust at facebook decided not to support them anymore.  So once the user connects to facebook I capture their uid and store that in a database, now I think I have to include some extended permissions and prompt for offline access so I can send them information even when they aren't logged in.  My problem is understanding the session, I think that I also need to capture the permanent session key and pass that along with my request but I'm not clear on how to do that.  Do you know the steps to get this session key?  One more question, do you know how to automatically pop up the extended permission dialogue or is this not possible using the fb:login control which means I'll have to use the facebook login url to do this?