Facebook request not showing notifications - facebook

Im using the following code to let users invite their friends in my webapp game:
FB.ui({
method: 'apprequests',
message: 'Let's play together!'
}, function(response){
console.log(response);
});
But invited friends doesn't receive any notification, they only see the game request in the Gameroom.
The app is set as game, and is already public and visible in the gameroom.
What am I missing?
I also tried to send a notification with the notification api. I get i "success" response, but no notification is shown to the user.

Related

App request is showing up on Facebook Notifications but NOT on the "Facebook Mobile App"

App request is showing up on Facebook Notifications but NOT on the "Facebook Mobile App".
The request is shown as it should on the facebook.com website, and a click on the request works perfectly.
Having said all that the Facebook mobile app, on our android and iPhone is not displaying the app request in the notification popup.
We generate the request through the js sdk, like so: (I've changed the actual values)
FB.ui({method: 'apprequests',
message: 'This is the request text',
to: 123123123,1231231231,123123123,
data: {
uuid: 420,
}
}, function(response) {
});

Is it possible to send facebook Apps invite with message and avoid notify user who already use app

I would like to avoid a notify to user who already use this app and after the invitee accept the invitation both of them get reward.
I use facebook Requests Dialog it allow user to choose all of his/her friend and cannot display invite message, I store all invitees id to database when they join the game they get reward.
Here my code.
function facebookInvite(){
FB.ui({
method: 'apprequests',
message: 'Please join, and we’ll both get free items!”',
data: encode(Player.id)
}, function(response) {
if(response && response.request){
$.ajax({
type: "POST",
url: "call/request.php",
data: {
from : Player.id,
to : response.to.join(),
}
});
}
});
}
Is it possible to send facebook Apps invite with message
No, on invites – that is a user-to-user request to a user who is not already a user of your app – the message will not get shown, they will just receive a notification saying “X invited to you use app/play game foo.”
and avoid notify user who already use app
See filters parameter of the Request dialog; https://developers.facebook.com/docs/reference/dialogs/requests/

FB.UI apprequests inside a frame causes script access denied error

I am working on an application, which is iframed into another application (different domain). My application which is in the iframe has apprequest functionality implemented. For some reason, whenever I invoke the apprequest dialog, I get a script access denied error.
The following are all the details:
App A --> is in domainA
App B --> is in domainB and is Iframed in to App A.
App B has a button which invokes, the following code:
FB.login(function (resp) {
FB.ui({
method: 'apprequests',
message: msg,
display: 'iframe',
access_token: resp.authResponse.accessToken
}, fbRequestCallback);
});
This throws an error. Please help.
If a user clicks 'Accept' on a Request, they will be sent to the Canvas Page URL of the app that sent the Request. So the request will always be sent back to App that generated the request. You will then have to read the request at:
https://apps.facebook.com/[app_name]/?request_ids=[request_ids]
and redirect it accordingly.

Not getting notification/request using application request dialog box

I am trying to build application request on my website using request dialog box.
When i send app request to friends, notification appears for a moment & goes away. Also it is not showing any new notifications either in "App & games" and "notifications" pages.
Here Sample Code :-
FB.init({
appId : '127617823933232',
status : true,
cookie : true,
oauth: true,
});
function sendRequestToRecipients() {
var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({method: 'apprequests',
message: 'EventSeekr Join Request',
to: user_ids,
}, requestCallback);
}
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'EventSeekr Join Requestt'
}, requestCallback);
}
I answered a similar question based on some issues I was having with my app, see if it helps:
From my experience and from reading the Facebook Developer Guide, it seems like it's mandatory for you to have a Canvas defined for your Facebook app so the requests render as Notifications.
I am trying to solve a problem where these notifications show fine in the Facebook website but not on the Facebook Android client's notification popup.

Facebook API: Suggest page to friends and view which are were selected

I am developing an application which is based on user challenges. The app also requires a Facebook account to play.
I want a user to be able to select a bunch of friends he wants to challenge and send them an "invitation". But besides this, I need to find which friends did the user invite in order to save them to my database and "prepare" the challenge.
I managed to do the select-friends-dialog using this, but have no idea how to retrieve the selected users. Also, does this work on non-canvas Facebook applications? As I read that page, I am not sure whether it will work for my non-canvas application.
Here is my select-friends-dialog code:
function challengeFriends(){
FB.ui({
method: 'apprequests',
message: 'message",
title: 'title'
});
}
Any help is highly appreciated! Thank you.
I've written a tutorial that covers what you are asking for and other aspects of the Request dialog: How To: Send An Application Request Using The Facebook Graph API
The idea is to capture the request ids from the callback and save them in your DB, and within the request itself you can find the invitee id (friend id):
FB.ui({
method: 'apprequests',
message: 'Check out this application!',
title: 'Send your friends an application request',
},
function (response) {
if (response && response.request_ids) {
var requests = response.request_ids.join(',');
$.post('handle_requests.php',{uid: <?php echo $uid; ?>, request_ids: requests},function(resp) {
});
} else {
alert('canceled');
}
});