Is it possible to send multiple invites using new Requests 2.0? Documentation as of now saing that 'to' parameter can specify only one user, so it single user or standart request dialog even without possibility to set default filter! It's huge drawback from hidious by nature, but effective in purpose FBML.
Sure.
Look in the docs for Requests 2.0:
Send to Many
From your application front-end,
execute:
FB.ui({method: 'apprequests', message: 'You should learn more about this awesome game.', data: 'tracking data: 'tracking information for the user'});
This will open the facebook Dialog:
If you meant in your question whether or not you can filter multiple id's - meaning, you choose the list of uid's to send the request to and not the user - then the answer is no, it's not possible currently.
Of course.
FB.ui({
method: 'apprequests',
message: 'text for the receiving user',
data: '127', // to know what to do with it.
title: 'title of window.'
});
see this fanpage for an example:
http://www.facebook.com/NeonFashion?sk=app_176086155780033
or i missunderstand your questions and you actual looking for something like
Facebook requests 2.0 filter
It is (now?) possible to open a request dialog targeting multiple users at once, by passing an array of ids in the "to" field.
See the "sendRequestToManyRecipients" example in https://developers.facebook.com/docs/reference/dialogs/requests/
Related
The functionality that I need is to show a list of Facebook friends to the user on the website page with custom design, where the user can select some of them and send invites.
In API v2.0 it's possible to get a list of friends this way:
FB.api('/me/taggable_friends', function (response) {
...
});
But it doesn't return real users' ID that I need for invites with the next function call:
FB.ui({
method: 'apprequests',
message: invite_text,
to: 'user_id_1, user_id_2'
}, function (response) {
...
}
);
How can I get these real IDs?
Or how to resolve this functionality in another way? Because all the answers that I found were connected with games that don't fit me.
I need a full list of friends. Not just that already use my website (analog of the invitable_friends in-game section).
You are not allowed to use taggable_friends for inviting them, obviously it is for TAGGING friends and you only get a tagging token.
There is invitable_friends, but:
The invitable_friends API is only available for games that have a Facebook Canvas app implementation using version 2.0 of the Graph API.
(https://developers.facebook.com/docs/games/invitable-friends/v2.1)
I am afraid what you want to achieve is not possible. The proper way to invite friends to your website is to use the Send Dialog: https://developers.facebook.com/docs/sharing/reference/send-dialog
You can include one User ID in the "to" parameter. Of course it must be a User who authorized your App too, you can get those with /me/friends. Or better: Just open the Dialog and let the User select on his own.
I have implemented FB Multi Friend Selector as explained on this page https://developers.facebook.com/docs/reference/dialogs/requests/
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'My Great Request'
}, requestCallback);
}
However I want to send the custom Url to the User, since my Facebook App has some parameters at the end like below
http://apps.facebook.com/MY_APP_NAME/MY_PARAMETERS
However with the above method, the user is getting the following link with the MY_PARAMETERS Omitted
I cann't see any "url" parameter in the "apprequests" method. However, this is something that Sweepstakes does successfully. They are able to pass all their parameters in the Message and I want to copy the same functionality.
Thanks in Advance.
The request will point the accepting user to your canvas URL – there is nothing you can change about that.
However, if you need to pass custom data along “with” the request – there’s the data parameter of the dialog for that. You will get the info you put in there back, after reading the details of the request object from the API.
I've noticed that BranchOut requests have a custom notification message and stand apart from other app requests in my notifications.
Is this because BranchOut has a special partnership with Facebook?
The documentation states that the "message" value will not be displayed in the notification, so I'm curious how this is being done.
No it is not possible even with new_style_apprequest parameter in FB.ui options. This used to work earlier but it has stopped working lately. It was anyways an undocumented feature. This is my guess that you might require special permissions from Facebook to be able to achieve this.
it's definitely possible, using the parameter new_style_message set to true - you can double check this by reverse engineering their Javascript API library.
This is a sample code
FB.ui({
display: 'iframe',
method: 'apprequests',
new_style_message: true,
title: "Join my network",
message: "would like you to join his network",
to: [list of user ids to invite]
});
If there any way to check in PHP SDK if user can write on specific friend's Wall?
Example:
if ($facebook_can_write_to->'123456789') echo "You can write on this friend's Wall";
Using the FQL table (http://developers.facebook.com/docs/reference/fql/user/) you can check to see if the current user can post to a friends wall by loading up the friend's user information specifically the can_post field.
can_post bool Whether or not the viewer can post to the user's Wall.
According to the documentation you can post on a user friends wall if that user granted you the *publish_stream* permission:
publish_stream
Enables your app to post content, comments, and likes to a user's
stream and to the streams of the user's friends.
There are some cases in which you won't be able to do so, for example if some user blocked your application then I guess it will fail if you try, so you should just check the response you get back from facebook for the api request and see if it worked or not.
Edit
As far as I'm aware you can not ask the api (nor via fql) "can my application post to this users wall", you can only ask "have this user granted my application the publish_stream permission".
If I understand what you want, I might have kind of a solution for you though.
I say show the user the option to post on a friends wall.
When the user chooses this option try to post on the friends wall (and I assume you are using ajax for that call), if it fails return some kind of code, then in the client side check for that code, if it returns use the javascript sdk to open a dialog.
You have two choices for dialogs, you can use the Feed Dialog like this:
var obj = {
method: 'feed',
to: "FRIEND_ID",
name: 'A message',
caption: 'Just trying something',
description: 'This is how to post on a friends wall'
};
FB.ui(obj, function(response) { console.log(response); });
Or you can use the Send Dialog:
FB.ui({
method: 'send',
to: "FRIEND_ID",
name: 'A message',
link: 'LINK_URL',
});
With this one though you have to post a link, I'm not sure if that works for you. After you tried and failed for a user you can save that data and use it later.
I am building a small board game for Facebook, and I need a way to send an app request to only one friend. I will use
FB.ui({method: 'apprequests', to: '1234', message: 'A request especially for one person.', data: 'tracking information for the user'});
But I need a way for the user to select a friend an only one from his list. Is there a way to pop the friend-selector and restrict the maximum selection to 1?
Use "max_recipients" parameter
FB.ui(
{
method : 'apprequests',
message : 'A request especially for one person.',
to: '1234',
max_recipients:1,
data: 'tracking information for the user'
}
);
You could build your own similar widget that lists all of a users friends using the graph api to retrieve all of their friends by calling /me/friends. Then let the user select a friend and clicking some kind of invite button next to the friend that calls this:
FB.ui({method: 'apprequests', to: '4', message: 'A request especially for one person.', data: 'tracking information for the user'});
And just set the 'to' parameter to the one user selected.