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.
Related
I can initiate dialog to send a link to Facebook Messenger. Everything goes fine and recepient gets the message with URL. However, when a message is added in Facebook's UI, only that message is received and URL NOT.
Message field causes link to be ignored in received message
Desktop
I have tried both methods according to
https://developers.facebook.com/docs/sharing/reference/send-dialog/
URL
https://www.facebook.com/dialog/send?display=page&link=https://developers.facebook.com/docs/sharing/reference/send-dialog&redirect_uri=https://www.facebook.com&app_id=<APP_ID>
SDK
window.fbAsyncInit = function () {
FB.init({
appId: '<APP_ID>',
autoLogAppEvents: true,
xfbml: true,
version: 'v11.0',
});
};
FB.ui({
method: 'send',
link: 'https://developers.facebook.com/docs/sharing/reference/send-dialog/',
});
I have tried different SDK versions and different APP IDs.
Mobile
Curriosly so, my setup for mobile works fine, link is received with or without a message.
fb-messenger://share?=<APP_ID>&link=<MY_LINK>
I am really confused as there does not seem much to configure... Thanks in advance for any leads on this.
It has been acknowledged as a bug by Facebook already in May https://developers.facebook.com/support/bugs/201777038410094/
Again reported in July
https://developers.facebook.com/support/bugs/2934678630125393/?join_id=f3c21b71e26d8c
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) {
});
How does Branchout custom their Request Dialog messages? There is no option for this.
The documentation https://developers.facebook.com/docs/reference/dialogs/requests/ doest mention any extra parameters, only app_id, redirect_uri, message ,to , filters , exclude_ids , max_recipients, data, title.
As im a new user, i cant post images.. Here are the links: http://i.imgur.com/37tju.png ,
Im using the following javascript to call the facebook function:
FB.ui({
method : 'apprequests',
message : 'Message itself',
title : 'Title message',
display : 'iframe',
access_token : '(access_token)',
to : uids
}, function(response) {
if (response)
{
// handle callback.....
// (...)
}
});
There are some APIs with special privileges. You have to get a way of get in touch with Facebook. I don't know any docs for it.
there is no need to have special partnership to do such a thing.
Please check Is it possible to customize the apprequest notification message similar to BranchOut?
I have a issue for facebook apprequests (oauth2, graph)
I sent a app request to my friend B.
B logged into facebook and found our request in the app list.
B clicked the accept button
B redirected to the facebook canvas page. I want to rediect to our app, not facebook's canvas, is this doable?
thanks
you can put a url in the data param
see here http://developers.facebook.com/docs/reference/dialogs/requests/ under properties at bottom.
data Optional, additional data you may pass for tracking. This will
be stored as part of the request objects created.
This will get passed back to you and you can use javascript to location.href to the url in the data.
----------Here is a sample i have used in the past
var thisimg = 'AN_IMG';
var thisurl = 'A_URL';
window.sendrequest = function(){
FB.ui({ method: 'apprequests',
title: 'A request.',
message: 'Rate Me! Request from: ' +thisname+' ',
data: ''+thisimg+' '+thisurl+' ',
filters: ['all'],
});
}
---------- Sample from Facebook with data param added.
var thisimg = 'AN_IMG';
var thisurl = 'A_URL';
function sendRequestToManyRecipients() {
FB.ui({method: 'apprequests',
message: 'My Great Request',
data: ''+thisimg+' '+thisurl+' ',
}, requestCallback);
}
function requestCallback(response) {
// Handle callback here
}
upon callback you can do a window.top.location.href=''; with the url you passed in data.
NOTE: The default redirect for a request is the canvas, this cannot be changed. After user lands on your canvas you will read the data param from the request and redirect them to your external app.
"i do not see any other way to do this, since requests2.0 does not include option for a redirect uri."
As you have already included Facebook javascript SDK in your App and you have writen this code for inviting friend for your App in a script
FB.ui({ method: 'apprequests', redirect_uri: 'APP URL',
message: 'My Message' });
This will redirect to App URL without redirecting to Facebook canvas URL.So this will not work even if you use data parameter such as
FB.ui({ method: 'apprequests', data: 'APP URL',
message: 'My Message' });
Write this code at your App landing page i.e. in index.php
$requestid=$_GET[request_ids];
if(!empty($requestid)) {
echo "<script> window.top.location.href='APP URL'; </script>";
}
This is an old question, but now there is a simpler solution.
In the Facebook app settings under "Facebook Canvas" there is a field titled "Mobile Site URL". When a user tries to open your canvas app from a mobile device (s)he will be redirected to that URL.
That URL should point to a page from which you should redirect to the App Store or Play Store (or coming soon page) based on the browser user agent.
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');
}
});