can a fb user send an apprequest to all friends same day no matter how many? - facebook

Hi am using this function that works by a single ID (52000121) and comma separatted ID's (5000000,500002,500004,000002001)
function invite(id) {
FB.ui({method: 'apprequests',
message: '<?=get_texto_clave('wants_you_to_join')?>',
title: '<?=get_texto_clave('send_app_request')?> <?=$_SESSION['alias']?>',
to: id,
}, function(response){
if(response!=null){
var invitados = id.split(',');
for( i=0; i<invitados.length; i++){
$('#friend_'+invitados[i]).addClass('invited');
$('#friend_'+invitados[i]+' .inviteButton').addClass('invitedBtn').text('<?=get_texto_clave('Invitado')?>');
}
}
});
}
Wich seems to be working fine,
But I have just sent more than 500 invites to friends of mine, and they all got the 'ivited' class (When i completed the popup);
¿Did they all recived it?
I know the response debugging could be better, but still would like to know if user can send an invite to all of his friends same day no matter how many friends are. Or is there any user/app limitation?
Thanks

There is a no limit to the app requests you send
But if you use multi friend selector, you can select maximum of 50 and 25 in IE.
Naturally, if you're being spammy, you'll still get reported a lot and automated systems could block you, so remember to keep to a reasonable volume of requests.
Btw, You can read the response to know to whom it was delivered.

Related

Facebook Conversion "Same Event ID" error

Getting this message:
Same event ID received for many event instances
You're sending the same event ID for many instances of your ViewContent events. Event IDs are unique identifiers that are used to deduplicate identical events received from your pixel and the Conversions API so they're not counted twice. To ensure that Facebook is accurately counting your events, each unique event instance needs its own unique event ID.
This may cause issues with the measurement of your events and the attribution of your ad campaigns.
So we've added IDs, and it's got to the point we've made a ridiculous function to make generate IDs:
function timePlusUuid4() {
return (Date.now().toString()) + '-' + ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
Every conversion event is using it:
fbq('track', 'ViewContent', data, { eventID: timePlusUuid4() });
But we cannot get the error to go away. There is no other place conversions happen on the website.
Of course FB pixel helper, and FB test event function, show it working flawlessly.
Help please!
don't use time
i had the same problem using time...
or try to add '' around the value

GitHub Api: User followers - paging?

I am playing with some Javascript and Github API, and I've came to one problem.
Each time, when I try to call for followers of any user who has followers, the callback that I get from the server shows only 30 users. For example:
https://api.github.com/users/vojtajina/followers - 30 followers
and user followers from original website:
https://github.com/vojtajina/followers - 1,039 followers
My questions is - what is going on? There is no 'next page' in the callback from the server. How can I get all of his/hers followers in the callback?
The max number of items per page is 100, so using the per_page=100 querystring parameter will increase the result to have 100 users per page:
https://api.github.com/users/vojtajina/followers?per_page=100
Using the page querystring parameter, you have control to pagination. For example, to get the second page, you should add page=2:
https://api.github.com/users/vojtajina/followers?per_page=100&page=2
If you want to get all the followers you have to iterate the pages until you receive an empty array.
If you want to use this into a Node.js / JavaScript (on client) app, you can use gh.js–a library I developed which handles this:
var GitHub = require("gh.js");
var gh = new GitHub({
token: "an optional token"
});
gh.get("users/vojtajina/followers", { all: true } function (err, followers) {
console.log(err || followers); // do something with the followers
});

Graph API: event's RSVP check

I'm currently trying to get an idea of getting Facebook's RSVP for an event, but really stuck on that part:
as I see now, to get user's RSVP I have to make three requests with the following logic:
request eventID/attending/userID ->
if "data" array count == 0 ->
request eventID/maybe/userID ->
if "data" array count == 0 ->
request eventID/declined/userID
else -> means user didn't make any choice previously.
So here it looks like I have to make 3 requests to facebook's graph api to get users's RSVP for a single event.
The question is if there is any way to get an RSVP status for an event doing a single request?
I'm using the latest Facebook SDK and the latest graph api.
Many thanks in advance.
So the best solution here so far is:
one request to /eventID/attending/userID
one request to /eventID/maybe/userID
one request to /eventID/declined/userID (if needed to know if the event invitation was declined)
Call to eventID/attending(maybe/declined)/userID lets us filter rsvp to single user, so we avoid downloading and processing a large amount of data here.
After call you have two options:
If result is true, you get the following response:
{
"data": [
{
"name": "Oleskii Poplavlen",
"id": "10204715567996406",
"rsvp_status": "attending"
}
]}
If result is false, you get the following response:
{
"data": []
}
So while you still have to make multiple requests to get user's RSVP to event, you can avoid downloading loads of other users's rsvps.
Hope that helps someone!
I can get you started to do it in 2 calls:
FB.api('/'+ event_id + '?fields=id,attending{rsvp_status},maybe{rsvp_status}', function(event_response){
// here you should make a call to check if the user has the event and if so get the rsvp_status
FB.api('/'+ user_id + '/events?fields=id,rsvp_status', function(user_response){
// check if user has event, then log the rsvp_status
if(user_response.id == event_response.id) {
console.log(user_response.rsvp_status);
} else {
console.log("user is not going");
});
});
I have not tested this but I've been playing around with this API for quite a while now. This could be an answer to do it in 2 calls, not in 1 unfortunatly.
The first call doesn't need the 'attending' and 'maybe' fields but it's usefull to test with.

facebook: is possible to use send message for predefined users?

I need to send to user's friends in facebook some link from my site or predefined message.
I got the list friends by this:
FB.api(
"/me/taggable_friends",
function (response) {
if (response && !response.error) {
console.log(response.data);
}
}
);
which is OK, I'm getting some friends.
At this question Send private messages to friends
author says I need so call method sendof API:
function facebook_send_message(to) {
FB.ui({
app_id:'xxxxxxxx',
method: 'send',
name: "sdfds jj jjjsdj j j ",
link: 'https://apps.facebook.com/xxxxxxxaxsa',
to:to,
description:'sasa d d dssd ds sd s s s '
});
}
It looks simple. Having friends as array of objects:
Object
id: "AaI7nqazWWHMkCjMrKNlvyFHWBRw......HFyppVJqjg4RBZurBg"
name: "Andre ...."
picture: Object
I hoped that I could to create array with id and use array in send-method of api in to:. But trying to start dialog I'm getting error "Bad param". The same if I use the name-property of object.
What do I do wrong ?
You can't pre-populate the list of recipients, Facebook messages are meant for user-to-user communication and not to invite people to an app or spam friends. It is not a good user-experience as well. The user should always choose the audience themselves.
I'd recommend you read the documentation for the Send dialog which contains all the information you need to make a point when communicating this to the project manager.

Has the response from FB.ui requests changed?

It used to be that the response from a request gave us an array of request ids (as described here http://developers.facebook.com/docs/reference/dialogs/requests/) but it seems now the response variable returns two items insead 'to' and 'request'. To being a comma delimited string of user ids and request being a request id. Is this correct? I have seen nothing about this anywhere but it is the behavior I am seeing currently.
Update
Here is a super simplified version of my call:
FB.ui({method: 'apprequests', message: 'My Great Request'}, requestCallback);
function requestCallback(response) {
for(var key in response){
console.log(key);
console.log(response[key]);
}
}
When I make a request to one person the variable response has two keys: request and to. Request is a request id, to is the id of the person I'm sending the request to. If I make a call to the graph api using the provided request id, however, I find that the user under both 'to' and 'from' are equal to the sender's name and fbid.
Alternatively, if I request to multiple people request is equal to a single request id and to is an array containing all the fbids of the users that had requests sent to them. When I make a call to the graph api, however, I once more find that both 'to' and 'from' contain the user id and name of the requesting user.
I faced similar issue yesterday. Had to fix my code. But today request_ids were back in the response. So I updated the code again. But this time to work with both type of objects.
I found the documentation here (move down to the "Performance improvements" section)
http://developers.facebook.com/blog/post/569/
But it still doesn't explains why they reverted the change today. Or was it accidently released yesterday.
As in the documentation, the new callback will receive an object (response) that contains an array (request_ids) of request ids:
{
"request_ids": [
0: [request_id]
1: [request_id]
...
]
}
So I suppose you can loop using this modified code:
function requestCallback(response) {
for( var k in response.request_ids ) {
console.log(k);
console.log(response.request_ids[k]);
}
}
There is already a bug filed here
http://developers.facebook.com/bugs/129565473812085
There is no clear information yet whether the response is really changed or its a bug.