Problems of inviting friends through Facebook email - facebook

I want my users to invite their friends by sending them Facebook private massage. I am thinking of using send button, but the problem is that each invitation url is different and unique, so if I use send button to do it, I might need to create many send buttons each of which carries an unique href. I think this should work? But ideally, I want users to just select their friends in a multi friend selector and everything's done by just clicking the sending button. Any ideas?
Thanks for any help!

You can generate a unique URL for the message that includes the IDs for all the users the user wants to send the message to. Then, when the recipient accesses the URL and authenticates themselves, you can cross reference the URL and their User ID to what you have in your database.
Without knowing what the message contains, its purpose and what you want to achieve, this is the best approach I can think of.
You won't be able to tell who the message is actually sent to, as Facebook doesn't return the User IDs in the callback, but if you have read_inbox permissions, you should be able to look the User IDs up that way.

i think an better way to approach this is set up an invite system, have an invitation code field in your register.php that you sign into, store that info in user account database and set an number of times it can be used

Related

User data in event for Facebook server to server

I plan to generate Facebook events (Conversion API) on server side when the user completes registration process. These events will be used for advertising my solution in Facebook and tuning target audience on registration events.
I use POST request to https://graph.facebook.com/v9.0/289777498957502/events to send events. I have to pass user_data entity inside a body of this request. This user data can be email address, click id, user IP address or something else.
I don't have any of these on server side but I can get it.
The problem is that I don't understand why Facebook needs user data and what exactly it needs as data. I can send everything to Facebook but I need to understand mandatory information it requires.
Do you know what should be sent as user data?
As an option I can send internal ID in my system of each user inside user data but I'm not sure Facebook will be happy with that.
Facebook manuals are a pure joke. Literally all are outdated and no information on user data content and why it's required.
The problem is that I don't understand why Facebook needs user data
Because your conversion is (ideally) supposed to get connected to an actual user account. Facebook knows, who the user is, as long as we are on the client side, and their pixel is embedded somewhere - they can make the cross-domain requests in the background, to see who is currently logged-in to Facebook on the device. But if you send conversion data later, from your server - how would they be supposed to associate that with a specific user then, if you don’t send them any data that could identify one?
and what exactly it needs as data.
If you have anything that can uniquely identify the Facebook user, then send that.
Otherwise, send as much data as you can – to increase the posibility, that Facebook will be able to match this to a specific individual.
Check the list they provide under https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters
If the user is logged in to your Facebook app while they are on your site, then send the fb_login_id – that is as unique and specific, as can be.
If you don’t use Facebook login on your site, or the user can also perform the action in question without being logged into your Facebook app - then send whatever you have, that identifies them on your end.
In case no unique match is possible, then send as much as possible - first & last name, phone number, date of birth - all those help to narrow down who the user might be on Facebook’s side.
The same data, or at least as much of it as is available at this time, should also be send with the pixel tracking code on the client side already. https://developers.facebook.com/docs/facebook-pixel/advanced/advanced-matching/ has details on that.

How to send message to specific facebook user from website?

My goal is to make a website, in which user could customize a photo and then provide his friends indicators like name or id. My next task is to fetch that info from database and send messages on specific date to provided users. Ex birthday wishes, greetings, and so on.
I studied facebook send api for a few days now and couldn't find solution for myself. If I want to send message, I need to have Page-scoped id of user, which is acquired when the person text you first, which is not desired, because person wouldn't know what it is.
Also I was looking into Customer matching API, also seems to require the same PSID. The next thing I checked was Send Dialog API, which seems to send messages instantly, but not on the specific date. Also I checked unofficial facebook-chat-api, which asks for user ID, whereas I can find my id, I couldn't find ids of my friends.
So I just want to know is it even possible, if yes, I'd really appreciate your help.
User to User communication is not possible (and not allowed) in an automatic way, there is no API for it except for the Send Dialog. The Messenger platform is for page to user communication only.
Do not use inofficial tools, they are not allowed and might get you banned.

Is it possible to determine the #Facebook.com email address of a user?

Is it possible to figure out reliably what the Facebook email of any Facebook user would be? I know earlier this was not possible because not all users had a username. But I believe that has changed since...
I'm trying to figure out a way to let a user send a direct message to their friend through my app. The Request feature is pretty messed up now as you cannot send a custom message, which means most friends are probably going to ignore the request.
The type of messages that I am trying to let my users send to their friends would not be considered spam by Facebook, as these are messages sent directly from the user to their friend, except it is done through the app. But it's pointless if the message just says "Joe wants you to try this app..." The usefulness of an app on the Facebook platform is becoming questionable now.
I think that facebook terms and conditions disallow this...
Facebook messaging (i.e., email sent to an #facebook.com address) is designed for communication between users, and not a channel for applications to communicate directly with users."
Despite your caveat at the end of your post I believe that facebook would consider this a message from your app to the user.
In terms of your question, then the user data returned includes 'username' which is the information you need to create the email address.
Is it possible to figure out reliably what the Facebook email of any Facebook user would be? I know earlier this was not possible because not all users had a username. But I believe that has changed since...
Yes, now every user should have a username set – if not by themselves, than FB will have chosen one for them.
Besides that, I think writing to userid#facebook also works.
But I agree with combinatorial’s answer – Facebook explicitly says that this should not be used for app-to-user communication. To judge if your case is OK is up to you – otherwise you might consider using the send dialog instead, that’s more of the “designated” way to have users communicate “through” your app.
If what you are looking for is to give them a new message notification, it is not going to work. Because, if you send an email to the facebook email, it will land in the Others folder in the message box, which is like a spam box.Try mailing your own #facebook id and see what happens.
And Facebook doesnt give any documentation of how to get users #facebook email, most probably because they dont want developers to use it.
Why dont you mail them directly? You can easily get their email by adding email to the scope, and you can catch the email easily too.
$data = file_get_contents("https://graph.facebook.com/me?access_token=xxxxxx");
$data = json_decode($data,true);
$email = $data['email'];
Is that a viable option in your case?

How can my app facilitate a message to multiple friends?

I have a facebook app that needs to allow a user to send a message to multiple friends (potentially all their friends) at once. This isn't any kind of spam, and I don't need the app to send the message incognito (behind the scenes), I just need to open a dialog with specific friends pre-populated (that the user has selected within my app in a prior step) and then send them a custom message. Is this possible? I see the api for sending a message to a single friend, and I see the API for inviting users to my app (but that's limited to some very small number of invitations per day)... what I need is a dialog that lets me send messages to as many of the user's friends as they want, but for me to control *which friends are selected... I don't want to give them control to add/remove from the friends list.
Is this possible?
No, the Send Dialog allows prefilling only a single friend, but would otherwise be the best option here if you need a custom message displayed to the recipient. You could get the user to send to several friends in a loop by prefilling this - or fire the dialog without prefilling and let the user chose who to send to - your app won't receive a callback with the recipient IDs but you could put a referrer param in the URL sent?
Failing that, the Requests dialog / 'invites' are the only thing you can prefill with multiple recipients without the expectation that your app will be shut down for spam shortly thereafter - there's no limit per day on the number of requests sent, but you don't get to set the message shown to the recipient.
In case this is helpful to anyone else, I just found this... it's a relatively new API (still in beta) that allows for (just about) exactly what I was asking for. I've tested it and it appears to work...
https://developers.facebook.com/blog/post/2012/08/31/reach-users-1-1-with-the-notifications-api/

Sending messages through application

In a Facebook application, is there anyway I can let a user send a message to another user (to his Inbox)? Even if there is no direct access, is there some kind of a link structure I can use such as:
"facebook.com/example?sendTO=user-id" that will prompt a facebook popup to send a message a user?
Joel
You can't send a message to another user via facebook's apis as no function exist for this. The only way to send personal and private messages are via emails (proxified or not), then the user must install your application and accept to share its email.
Just add "messages" in between the link:
If the persons id is https://www.facebook.com/some.one.007 then write
https://www.facebook.com/messages/some.one.007
Thats it.