Question

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 :)

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top