Sending More Updates through the Applications and Games Dashboard

The Applications and Games Dashboard is where you can go to get updates on all the applications and games that you and your friends are using. This is the place that you, as a developer or application owner, can update your users with new news about your application. You can use a series of APIs. Below, I show the code you could use (in PHP) to add news to your application on the Dashboard (taken from http://developers.facebook.com/docs/guides/canvas/#dashboards):

$news = array(array('message' => 'Come back and see our new quotes'));
$result = json_decode(file_get_contents(
    'https://api.facebook.com/method/dashboard.addNews?' .
    'news=' . urlencode(json_encode($news)) .
    '&format=json&access_token=' .
    $cookie['oauth_access_token'])); // this cookie is assuming you got their
               access token elsewhere and have stored it for future access

The result looks like Figure 4-11 in your Applications and Games Dashboard.

Figure 4-11: Updates to your Applications and Games Dashboard look similar to this.

image

Get Facebook® Application Development For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.