2

I've been digging alot to find a solution to my problem and after a thousand of attempts I decided to ask for help.

My website app needs to send invitation to the current logged user facebook friends. In order to do this I've tryed this code according to Facebook documentation, blog and many other examples I found

FB.ui({
method: 'apprequests',
message: 'Checkout! This is cool!',
data: '???'
}, 
function(response){
    console.log(response);
    //do I need to do something else here ?
}
);

I see the popup with all my friends, and when I select few and click "send requests" button popup closes and no request is sent, I've the confirmation from all my (patience) friends.

Is there something I do wrong ?

FYI I've also tryed this call directly from browser, ajax and php

https://graph.facebook.com/<CURRENT_USER_FACEBOOK_ID>/apprequests?to=<CURRENT_USER_FRIEND_FACEBOOK_ID>&message='TestMessage'&data='trackingcode_notsure_what_i_need_it_for'&access_token=<APP_ACCESS_TOKEN>

My aim is to notify a friend of mine(current facebook user) that there is a new application and invite him.

Many thanks in advance.

musefan
  • 47,875
  • 21
  • 135
  • 185
Kladrian
  • 141
  • 6
  • do you get a response in the callback of the FB.ui method? – Lix Dec 01 '11 at 12:21
  • yes I get a correct response made of request id and friend ids array, any idea? – Kladrian Dec 01 '11 at 13:18
  • and if you query that `request_id` - what information do you receive? You can use [this great tool](https://developers.facebook.com/tools/explorer) that facebook provides : The Graph API Explorer. – Lix Dec 01 '11 at 13:20
  • I receive this object: Object { request:REQUEST_ID, to:[friendid0, friendid1]} – Kladrian Dec 01 '11 at 13:24
  • 1
    if you can query the request_id and you are able to get the correct data then the request was sent successfully. – Lix Dec 01 '11 at 13:26
  • how can I query the request by id ? and howcome I cannot see the invitation in the destination facebook user page ? – Kladrian Dec 01 '11 at 13:30
  • I just noticed another thing - what are you using the `data` parameter for? – Lix Dec 01 '11 at 13:40

2 Answers2

0

Try taking your application out of sandbox mode. If your app is in sandbox mode, only authorized users will be able to interact with it. That means that if you send a request to a non-authorized user he/she will simply not receive the request.

Lix
  • 47,311
  • 12
  • 103
  • 131
  • Interesting answer, it does make sense, now the question is... how do I do that ? how do I take my application out of sandbox mode ? and how can I see if my application is in sandbox mode ? – Kladrian Dec 01 '11 at 13:31
  • its in your app settings...`https://developers.facebook.com/apps/{APP_ID}/advanced` – Lix Dec 01 '11 at 13:33
  • ok ....just checked out in application control panel ... in advanced tab I found "application type" web (this is correct) and sandbox mode deisabled – Kladrian Dec 01 '11 at 13:33
  • then i fear the problem is on facebook's side... If you can query the request_id and get the information there is not much more you can do about it. You can [report a bug to facebook here](https://developers.facebook.com/bugs). – Lix Dec 01 '11 at 13:35
  • ok many thanks guys, so you confirm that I'm doing right ? This is the correct way to send a request to use this web app ? – Kladrian Dec 01 '11 at 13:38
  • yes and yes - a web application is correct if you are running your facebook application inside a web browser. – Lix Dec 01 '11 at 13:38
0

I saw another user asking the same question -

“apprequests” dialog reports success, recipients receive nothing

His problem was that he had not defined a canvas url in his app settings. Once he added it the problem was solved and users started recieving the requests.
Hope this helps!

Link to the aforementioned question (and its answer)

Lix
  • 47,311
  • 12
  • 103
  • 131