Reputation: 1
Is there any way to send apprequests if your application is a website? I reported a bug on facebook http://developers.facebook.com/bugs/182553325173000 but I do not know if this is possible or not
Upvotes: 0
Views: 646
Reputation: 43816
It's possible, as the other answers have shown, but the user will be brought to your canvas app when they accept the requests
Upvotes: 0
Reputation: 5021
yes you can do this by adding the JS API,
before <body>
add:
<script type="text/javascript">
function inviteFriends(){
var receiverUserIds = FB.ui({
method : 'apprequests',
message: 'YOUR CUSTOM MESSAGE',
},
function(receiverUserIds) {
console.log("IDS : " + receiverUserIds.request_ids);
}
);
}
</script>
after the <body>
include the API (asynchronous method):
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true //enables OAuth 2.0
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
and call it:
<a href="#" onclick="inviteFriends(); return false;"></a>
or
<a href="javascript:inviteFriends(); return false;"></a>
Upvotes: 2
Reputation: 6047
You can do that with the Javascript SDK
it is in the documentation: https://developers.facebook.com/docs/reference/dialogs/requests/
Upvotes: 0