Request dialog improvements - facebook

I want improve my request dialog multi selector.
This is the actual dialog request of my application:
But I have seen others request dialog here:
this request dialog select automaticly 50 friends.
How I can do it?
This is my actual dialog code:
<script>
FB.init({
appId : '290349771061160',
frictionlessRequests: true,
});
function sendRequestToRecipients() {
var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({method: 'apprequests',
message: 'SELEZIONA 25 AMICI',
to: user_ids,
}, requestCallback);
}
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'SELEZIONA 25 AMICI'
}, requestCallback);
}
function requestCallback(response) {
// Handle callback here
}
function requestCallback(response) {
if((response != null) &&(response != false))
{
alert('ADESSO CLICCA IN ALTO A DESTRA SU MI PIACE');
}
// Handle callback here
}
</script>

Requests Dialog allow you to specify to which friends you want the request to be sent by specifying comma separated friends ids in to field (see direct request) (this is exactly what you can see on second picture).
The only difference between first and second is the to parameter which is empty for first one and filled for second.

Related

"Games Request only are available for games" - alternative .appInvite

Hello i always use the function() below to invite people to an app:
facebookConnectPlugin.showDialog(
{
method: 'apprequests',
message: 'Check out Givvia!'
},
function(response) {
log(JSON.stringify(response));
httpService.logAppRequest(response);
},
function() {
log('Could not send Message');
}
);
Unfortunately, this function not work anymore for normal App which is NOT A GAME.
I was looking around and i found the these code:
var fbOptions={
url: "URL LINK",
picture:"PICTURE LINK"
};
facebookConnectPlugin.appInvite(fbOptions,
function(postId){
console.log("success");
},
function(error){
console.log("failure");
console.log(error);
alert(JSON.stringify(error));
}
);
Now, i'm able to invite friends but i do not get the response i was get with 'aprrequest'. here i get the refer and the receiver ID of facebook. do anyone know how to get these information with appInvite?

Facebook Feed Dialog does not open

I am building a custom multi friend selector in order to send posts to friend's walls on Facebook based on this tutorial
https://developers.facebook.com/docs/guides/games/custom-muti-friend-selector/
I have been able to load my list of friends and create a CSV list of people I want to post to but the last step of opening the feed dialog is failing and I don't understand why. The dialog does not open.
this is my sendRequest function
var sendUIDs = '';
$('.cbFriendId').each(function(index){
if($(this).prop('checked') == true){
var addId = $(this).attr('value');
sendUIDs += addId + ',';
}
});
console.log(sendUIDs);
openSendDialog(sendUIDs);
}
function openSendDialog(sendUIDs){
console.log('open send dialog');
FB.ui({
method: 'feed',
to: sendUIDs,
link: 'http://www.mydomain.com',
display: 'iframe',
message: 'Hello from My Domain',
name: 'Click to view my app',
caption: 'Hello my app'
},
function (response) {
if (response) {
alert('Post was published.');
console.log('Post was published.');
} else {
alert('Post was not published.');
console.log('Post was not published.');
}
}
);
}
The last console log entry is 'open send dialog'. I get no errors in IE9 dev tools but I do get an 'Unsafe Javascript attempt to access frame ...' error in chrome.
just for sanity sake here is my graph init
window.fbAsyncInit = function () {
FB.init({
appId: '462750593765445', // App ID
channelUrl: '//www.mydomain.com/channel.html', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
frictionlessRequests: false
});
};
Also I should mention that the app is in sandbox mode.
Thanks for the help
What you're trying to do is called Send Dialog, So you need to change your method from feed to send and it should work.
Check out their docs for more information: https://developers.facebook.com/docs/reference/dialogs/send/

Facebook API feed dialog - prevent unnecessary click

hi,
Using Facebook's API it's possible to prompt a user to post to his/her wall using the feed dialog. However, using the javascript SDK, this requires two clicks: one on the button which brings up the dialog, the other on the "Share" button within the dialog.
Is it possible to get rid of one of these clicks? I thought of two approaches:
Embedding the dialog within an iframe, as Facebook provides a URL for a full page dialog. That will require the user to click only on the "Share" button. Apparently Facebook blocks that option.
Using an access token and display=iframe, but I want to avoid the user having to authorize my application.
Any ideas?
i would suggest you to use fb.api instead.
function PostToMyWall(){
FB.login(function(response)
{
if (response.authResponse)
{
//Post to my wall
FB.api('/me/feed', 'post', {
message: lnk,link: lnk
},
function(response) {
if (!response || response.error) {
// //alert('Error occured');
} else {
// //alert("Successfully Posted to My Wall!");
}
});}else
{
alert('Not logged in');
}}, { scope : 'publish_stream' });
}
My application got a similar function, check it out at www.wootube.woolei.com - "Post to WooTube Page and Group"
or popup when the page using jquery
$(document).ready(function() { FB.ui({method: 'feed',
name: mdtxt,
link: lnk,
picture: hackImageUrl(img,fld),
caption: '<?php echo $clickme; ?>',
description: '<?php echo $app_desc; ?>'
},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert("Successfully Posted to Group");
}
});});

Sencha Touch and Facebook button

I need to create a button to submit a comment on Face Book wall.
I am using MVC in Sencha touch and in my controller I use a function as
facebookComment: function()
{
--------
}
This function is to be called when a button is pressed.
Can any body please throw some light on how to go about this?
i am using following code to post on friends wall see if it is useful to you or not
var postParams = {
method: 'stream.publish'
, target_id: friend_id
, display: 'popup'
, message: message
, user_message_prompt: "Post message!"
}
FB.api(postParams, function(response) {
if(response.error_code || !response) {
to handle error
}
});
or refer this link https://developers.facebook.com/docs/reference/rest/stream.publish/
Well, first you should already be using the Javascript SDK. Then just issue a HTTP POST request to the feed connection of the current user using the FB.api() method with the message field set to your comment:
var body = comment_var;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
Obviously, should be taking care of the user login status (maybe using the method FB.getLoginStatus()).

Building an in-app request dialog

Is there a way of building a custom request dialog, and sending the selected userid(s), the app request. I don't want to be using the multi-friend selector form.
This function here should provide you the ability to send a request to a single person.
<script>
function sendFriendInvite(message,title,to,data){
FB.ui({method: 'apprequests',
to: to,
message: message,
title: title,
data: data
},
function(response) {
if (response && response.request_ids) {
//Sent!
} else {
//Not Sent
}
});
}
</script>
<a onclick="sendFriendInvite('Here is an invite','Send to Invite to Friend', 123456);">Send request to friend 123456</a>