Using a "Poll" app on Facebook, it would post something like this to my facebook Page (Kid Task):
How can I do this using Facebook javascript SDK? As best as I can tell, this allows it https://developers.facebook.com/docs/guides/attachments/ but this says "for REST API" and that is deprecated right?
Code i've tried:
FB.api(
'https://graph.facebook.com/kidtask/feed/',
'post',
{
message: 'test question',
actions: { name: 'Vote Now', link: 'http://test.com' },
properties: { text: "test answer 1", href: "http://test.com" }
},
function(response) {
if (!response) {
alert('Error occurred.');
} else if (response.error) {
document.getElementById('result').innerHTML =
'Error: ' + response.error.message;
} else {
document.getElementById('result').innerHTML =
'<a href=\"https://www.facebook.com/kidtask/' +
response.id + '\">' +
'Story created. ID is ' +
response.id + '</a>';
}
}
);
This posts without errors, but the properties are ignored.
Figured it out finally, although i'm not sure what it was exactly. My guess is, I was trying to post as a text post and not a link post.
FB.api(
'/kidtask/feed/',
'post',
{
name: 'whatever',
link: 'http://url',
actions: { name: 'Vote Now', link: 'http://url' },
description:"\u003Cbr/\u003E",
picture:"http://imageurl",
caption:"\u003Cbr/\u003E",
properties: [{"text":"test 1","href":"http://url"},{"text":"test 2","href":"http://url"},{"text":"test 3","href":"http://url"}]
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.