问题
Is it possible to create wallpost with more than one action link?
My code works only with one action link. Wallpost with two action links is not sent to Facebook (no error message).
var publish = {
method : 'feed',
name : name,
link : link,
picture : picture,
caption : caption,
description : description,
message : message,
actions : [{
name : 'Link 1',
link : 'http://www.example.com'
},{
name : 'Link 2',
link : 'http://www.example2.com'
}]
};
FB.api('/me/feed', 'POST', publish, function(response) {});
回答1:
I got a response from Facebook and you really can not add more than one action link.
Correct code for adding one link is:
var publish = {
// ....
actions : {
name : 'Some Action Link!',
link : 'http://www.example.com'
}
};
回答2:
Yes.
According to http://developers.facebook.com/docs/reference/rest/stream.publish/, the action_links
parameter is a "JSON-encoded array of action link objects, containing the link text and a hyperlink."
It looks like you're calling it actions
, not action_links
. Try this instead:
var publish = {
method : 'feed',
name : name,
link : link,
picture : picture,
caption : caption,
description : description,
message : message,
action_links : [{
name : 'Link 1',
link : 'http://www.example.com'
},{
name : 'Link 2',
link : 'http://www.example2.com'
}]
};
来源:https://stackoverflow.com/questions/8275428/more-action-links-in-single-wallpost