Thursday, November 29, 2007

Facebook feed.publishTemplatizedAction

Publish feed to both Mini and News feed using feed.publishTemplatizedAction. In the starting i faced lots of difficulties for this, I got mini feeds successfully but News feeds are not come. I got news feeds only after i register the feed templates. Feed templates has no ids. What ever you construct templates in coding just you register those in Feed templates, Both are exactly same. Then only you get news feeds successfully, this way allows news feeds are posted to all your friends even those who are not added application. I gave source code below, i think that is usefull for you.

fbFaceBookUID;
$body_template = '';
$body_data = '';
$body_general = '';
$image_1 = NULL;
$image_1_link = NULL;
$image_2 = NULL;
$image_2_link = NULL;
$image_3 = NULL;
$image_3_link = NULL;
$image_4 = NULL;
$image_4_link = NULL;
/*
if You you make any Changes in templates and data you must make corresponding changes in Registered Feed Templates
*/
switch($Type){
case "AddApplication":
$title_template = "{actor} added {AppName} application";
$title_data = '{"AppName":"FBAppURL.'\">'.$this->AppName.'"}';
break;
case "JoinTeam":
$title_template = "{AppName} : {actor} joined in {TeamOwnerName} team";
$title_data = '{"AppName":"FBAppURL.'\">'.$this->AppName.'","TeamOwnerName":""}';
break;
case "AnswerQuestion":
$title_template = "{AppName} : {actor} has answered a quiz sent by {Sender} and has earned points for his team";
$title_data = '{"AppName":"FBAppURL.'\">'.$this->AppName.'","Sender":""}';
break;
case "PointsFeed":
$title_template = "{AppName} : {actor} scored {Points} points";
$title_data = '{"AppName":"FBAppURL.'\">'.$this->AppName.'","Points":"'.$Points.'"}';
break;
case "PointsOverFeed":
return;
break;
default:
return;

}

$Return = $this->objFaceBook->api_client->feed_publishTemplatizedAction($actor_id, $title_template, $title_data, $body_template, $body_data, $body_general, $image_1, $image_1_link, $image_2, $image_2_link, $image_3, $image_3_link, $image_4,
$image_4_link, $target_ids);
}
?>

Hi guys if make any mistakes please let me know which helps to me to correct my self.
Please leave your comment:

1 comment:

  1. hi please tell me where to place this code?

    Thanks in advance
    Saurabh

    ReplyDelete

Yahoo! News: Technology News