Send news feed with the new facebook.php class - facebook

Hi i'm new developer of fb apps and i want to know how can i send a message to the wall of my friends using the new facebook.php class http://github.com/facebook/php-sdk
I do it this
$result = $facebook->api('/me/feed/',
'post',
array($ids,'message' => 'Playing around with FB Graph..')
);
This code work for the firts time i can login in the application after i try to enter again and the application sending and error The message if duplicated.
How can i fixed or what if the best way to do?
Thanks.

The error you are having is because facebook wont let you send the same message to the same user multiple times hence the error duplicate message. Change the text of the message and the message will work.

Related

how to give the permission of manage_mailbox on facebook apps

I am newly entered into facebook application. I want to send the message to facebook's users without mailid. I didn't possible. because i found the error is manage_mailbox is not have permission.
Let you know, how to resolve this.. I need ASAP.\
I have tried below like this
$url = "/100003508406494/inbox/";
//100006378695734
$message="Hai";
$link='http://apps.facebook.com/jobsmate';
$face=$facebook->api($url,'POST',
array(
'access_token' => $face_token,
'method'=>'publish_streem',
'message'=>$message,
'link'=>$link,
'name'=>'jobsmate',
'description'=>"$link",
'picture'=>"http://jobsmate.wisdomjobs.com/images/jobsmateicon2.jpg"
));
manage_mailbox seems to be an incorrect error message from FB. I got the same message when i was trying to post a private message using Graph API which i found out later is not possible. You have to use either FB's send dialog or use XMPP chat interface to be able to send private messages now.

How to delete a photo posted by an App in Facebook

I have created an app to post a photo in Facebook. I want to delete those photos posted by my app. I have read the documentation and found that Facebook allows Apps to delete the photos posted by them. Click Here This link gives the answer for my question.
You can delete photos for a user posted from your app by issuing an HTTP DELETE request to PROFILE_ID/photos with the user access token or app access_token.
But how to issue a HTTP delete request. Don't we need the photo id for deleting the photo?
I have tried to send a HTTP DELETE REQUEST as mentioned above using PHP SDK. But I got an error like this
Fatal error: Uncaught GraphMethodException: Unsupported delete request.
This is how I send the request
$response = $facebook->api('/me/photos/','delete',array("photoid" => "$photoid"));
Please help
In order to delete a photo that was created by the application, you have to make a DELETE request to a url like this:
https://graph.facebook.com/PHOTO_ID
I'm not sure why the documentation states otherwise (might be worth a bug report).
So in the PHP SDK, it would look something like this:
$facebook->setAccessToken( YOUR_APP_TOKEN );
$response = $facebook->api( '/PHOTO_ID', 'delete' );

Send Facebook apprequest from Windows Phone

I'm trying to send an apprequest from my Windows Phone 7.5 application to a Facebook friend to invite that friend to play a gameround.
According to Facebooks official documentation, a request should be performed via dialogs:
https://developers.facebook.com/docs/reference/dialogs/requests/
Unfortunately I cannot get this to work/show on Windows Phone.
Is there another way to send an apprequest to a known facebook user (I only need to send it to one user)?
I have tested to do it by invoking the following code:
FacebookClient fb = new FacebookClient(_appAccessTooken);
var arguments = new Dictionary<string, object>();
arguments["appId"] = Consts.FaceBookAppID;
arguments["title"] = "Play a gameround!";
arguments["message"] = "Would you like to play with me?";
fb.PostAsync("/user-id/apprequests", arguments);
This works, but:
1) The user will not get a proper notification, it will only be visible from the Applicationcenter notices.
2) The request will be sent from the application name, not from me (the user)
Does anybody know how to get this working?
II'm using the Facebook SDK for .NET (http://facebooksdk.net/)
Thanks in advance.

Facebook API Send dialog

Here is my send javascript code:
function send(id, description, title) {
FB.ui({
app_id: '390841657651335',
method: 'send',
description: description,
link: http://vic.bg/Vits.aspx?vicid=' + id,
name: title
}
}
Send is always ok (i dumped the response from the callback to the console), but recients got that message
Attachment Unavailable This attachment may have been removed or the person who shared it may not have permission to share it with you
instead of the actual post. Did someone face that problem?
The problem was with the settings of the application Sandbox Mode: was checked.
I do not know why they display such strange message in that case
So, did the 'send dialog' worked for you? because from all of my research and reading all posts related, facebook currently doesn't allow to send private messages to friends through graph api..
I'm trying the 'send dialog' via a direct URL and not via JS SDK.

posting reply to inbox message?

I'm trying to post a reply to an inbox message by sending a POST request to /message_id/comments. Is this the correct way to send a reply to an inbox message ?
I'm getting the following error:
"error": {
"type": "OAuthException",
"message": "(#3) App must be on whitelist"
}
The token has every possible permission.
Do I have to ask that my app is added on a whitelist ? how to do so ?
I'm doing this in javascript+jQuery:
var params = {
access_token: token
, method: 'post'
, message: 'hi'
};
$.getJSON('https://graph.facebook.com/$message_id/comments?callback=?', params, function(json) {
});
Facebook apps by default aren't allowed to send messages on behalf of users. There is no permission you are missing. This is an extra level to prevent spam (beyond prompting the user who). You will have to contact Facebook to get your application whitelisted. I would try their developer group.
opened a support ticket right here:
http://developers.facebook.com/bugs/183144141763793?browse=search_4e8b140cbf26e6040457329
Tried all I can think of and googled for, still getting this issue
Like others have pointed out, there isn't a way to do this programmatically unless you are on Facebook's whitelist. However, I did find a way around this for my app. What I do is use Oauth to display messages from a user's FB inbox like normal. When the user clicks 'Reply' on a message, I just send them to the reply page on Facebook Mobile, like this:
$('.reply').click(function() {
var popup_window = window.open('http://touch.facebook.com/messages/compose?ids='+message_id, '_blank');
popup_window.focus();
});
Where message id is the Facebook id for the message they are replying to. In my case, I use PHP to echo the message id into a javascript variable or data-attribute when the page loads. Since the Facebook mobile page opens in a new tab, they don't even really leave my app. Since Facebook mobile has a very streamlined interface it isn't too distracting. It's not perfect, but it works and it's easier than trying to get whitelisted.