posts_id of POSTS using GRAPH API - facebook

I am posting posts on Users wall using Graph API.
How can I get the Post ID for these posts which I am doing so i can later
read or write comments on these posts?

FB.api('/me/feed', 'post', { link: body,picture:PICTURE,name:'NAME',description:'DESCRIPTION',caption:'CAPTION',message:'MESSAGE' }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id); //response.id is the post ID of the post published.
}
Sorry you are using graph api...My bad.
When the post is published you get the id in the response.
Check it. it should be in JSON fomat. "id:POST_ID" Something like that.

Related

Posting to a user's wall in FB with permission, possible?

is it possible to login to a website with a FB login and have the user post to his friend with permission? By "with permission" I mean the friend has to approve the post. Is this possible?
Yes it is possible. We have an application at my job that posts on the user's profile, as them, every week.
From the facebook doc (https://developers.facebook.com/docs/reference/javascript/FB.api/):
If you have an authenticated user with the publish_stream permission, and want to publish a story to their feed:
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});

Is there a way to post a message to a Facebook group's feed?

I'm working on a Facebook app that uses Facebook groups, and I'd like to open up a Feed dialog to let the user post a notice to the group's feed. I have a user who is in the group and I've got the relevant permissions as well.
I've tried passing the group's Facebook id in the https://developers.facebook.com/docs/reference/dialogs/feed/ feed dialog, but get a Facebook error. There doesn't appear to be a programmatic way to do it either: the group's feed (described at https://developers.facebook.com/docs/reference/api/group/) isn't documented to accept POSTs either. Is there a way to post a message to the group using the Graph API or one of the other API methods?
I just made a test and it's working as any other wall.
I made a POST to 'GROUP_ID/feed' with a message variable with a value and it worked. I logged into the app as the group owner.
Using facebook php-sdk:
$facebook->api('GROUP_ID/feed', 'POST', array(
'message' => 'Testing...'
)));
I would suggest to use javascript instead as it wont cause post back of our website.
Check out my application to see if that what you want -> WooTube
function Promote() {
var lnk =
'http://www.wootube.woolei.com?v=<?php echo $_GET["id"] ?>';
FB.login(function(response) {
if (response.authResponse) {
//Post To WooTube Group
FB.api('/271691796276524/feed', 'post', {
message: lnk,
link: lnk,
},
function(response) {
if (!response || response.error) {
//alert('You have to join the group first!');
} else {
//alert("Successfully Posted to WooTube Group!");
}
});
//Post to Wootube Page
FB.api('/173724382762792/feed', 'post', {
message: lnk,
link: lnk
},
function(response) {
if (!response || response.error) {
//alert('You have to like http://www.facebook.com/WooTubes first!');
} else {
//alert("Successfully Posted to WooTube Page!");
}
});
} else {
alert('Not logged in');
}
}, {
scope: 'publish_stream'
});
}

Facebook Javascript SDK: Tag another user in my wall post?

We are using the Facebook Javascript SDK to allow users to post content to their wall. In the message that gets posted, is it possible to tag another user, similar to how you can when typing a post on facebook.com? (using something like #person)
We are using:
FB.api('/me/feed', 'post', { message: 'This post came from a test. #someuser'}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
The end result would then be a post that tagged the #someuser user.
The Facebook API doesn't currently support tagging of users like this. That functionality is limited to the actual site itself.

Post to User Wall using offline_access in facebook Javascript Sdk

My problem is that i want to post to user wall using the offline_access.
I donot know how to do that using the facebook javascript sdk
with this method FB.api('/me/feed')
Please also give me an example how to integrate the facebook connect with asp
If the user has already authenticated and has given publish_stream or offline_access permissions, you can just call this method to publish to their feed:
var body = 'Reading Connect JS documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});

Is an onject id returned when publishing via Facebook GraphAPI?

I am planning an app that will post to a users FB wall. When posting via the GraphAPI is an object id returned for the new post? We want to use the post id later to retrieve data about the post.
If you look at FB.ui() example for stream.publish, post_id is returned with the response.
Looking at this example from their FB.api docs, it certainly seems possible.
var body = 'Reading Connect JS documentation';
FB.api('/me/feed', 'post', { body: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response);
}
});