Of all of the research I've done on this topic, 90% of it is outdated, which brings me to believe there have been recent changes to the Facebook JS SDK regarding explicitly sharing Open Graph stories. I have the following code:
function postToFB(desc){
FB.ui({
method: 'share_open_graph',
action_type: 'mynamespace:myaction',
action_properties: JSON.stringify({
myobject: "myobjectid"
})
}, function(response){});
}
The problem with this is that it will attempt to share myobject with only the settings I've set up in the Facebook Open Graph section of my app settings. I would like to use the same object, but change the description with a dynamic 'desc' variable each time it's shared. Does anyone know how to accomplish this? I can statically set the Caption in my Facebook Open Graph section of my app settings, but I need to dynamically set it every time I share it instead.
I've searched through the Facebook JS SDK for additional key/value pairs that can be added to action_properties, but the SDK information is very limited in this regard.
UPDATE
I've modified the code to include 2 calls, one to create the object and the second to publish the story with the new object's information. Here's the code:
function postToFB(desc){
FB.api(
'me/objects/mynamespace:myobject',
'post',
{
object: {
"app_id": myappid,
"type": "mynamespace:myobject",
"url": "myurl",
"title": "mytitle",
"image": "myimgurl",
"description": desc
}
},
function(response) {
console.log(response);
FB.ui({
method: 'share_open_graph',
action_type: 'mynamespace:myaction',
action_properties: JSON.stringify({
myobject: response.id
})
}, function(r){});
});
}
However, according to the comments on this question: Facebook object API - duplicate objects created a Facebook staff member said this approach will not be approved by Facebook because one action by a user cannot produce two posts, which this code now does. One will post the object to the Facebook user's activity log, and one will post it to the activity log and the news feed.
It would be nice if I could just make one call and stipulate what the myobject description should be from the FB.ui function itself. Does anyone know how to do this?