Created a facebook application and a fan page tab which is rendering my site.
How can I create and share a post on User's wall using facebook API.
Thanks in Advance.
Created a facebook application and a fan page tab which is rendering my site.
How can I create and share a post on User's wall using facebook API.
Thanks in Advance.
You can simply use /me/feed
-
window.fbAsyncInit = function()
{
FB.init({
appId : '{app-id}',
status : true,
cookie : true,
xfbml : true
});
FB.login(function(response){
if (response.authResponse) {
Share();
} else {
// The person cancelled the login dialog
}
},{scope: 'publish_actions'});
};
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function Share(){
FB.api(
"/me/feed",
"POST",
{
"object": {
"message": "This is a test message",
"link": "{link}",
"description": "{description}"
}
},
function (response) {
if (response && !response.error) {
// success
}
}
);
}
Permissions required: publish_actions