Posting app generated apprequest to other facebook users in Java

南楼画角 提交于 2020-01-14 03:16:10

问题


Ok, what I want to do seems like an extremely core part of the facebook apps experience, and yet I can't find any decent examples. I just want to generate an 'apprequest' to notify another user when something of interest has happened when a friend used the app. I'm using Java and RestFB, and have tried this code:

FacebookType publishMessageResponse =
        fbClient.publish("me/apprequests", FacebookType.class,
            Parameter.with("message", "RestFB test"));

and have tried replacing "me" with a user id, which results in an OAuthException: (#100) Invalid parameter: Unknown error. The facebook documentation describes this PHP example:

$user_id = THE_CURRENT_USER_ID;

$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='INSERT_UT8_STRING_MSG'" . 
"&data='INSERT_STRING_DATA'&"  .   
$app_access_token . "&method=post";

$result = file_get_contents($apprequest_url);

But just like everything else I'm seeing, isn't this just sending something to the current user, ie myself? What's the point of that? If anyone's done this in Java I'd love to hear from you :)


回答1:


I got a unit test working with restfb doing exactly what you describe.

I posted as an answer to another question here: Facebook: send an app invitation



来源:https://stackoverflow.com/questions/7309950/posting-app-generated-apprequest-to-other-facebook-users-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!