How to send CUSTOM invite using Facebook PHP-SDK? - php

I'm developing a simple Facebook application, and now I need to create a page where the user can invite friends.
Two questions about it:
How can I send invite using the PHP-SDK ?
Can I send custom invite? with "custom" i mean that I must to know how many users have been invited by user. How can I do it?

Have you attempted anything or do you have any code to show us? It sounds like you're just asking for the code especially as it is custom. You could try getting a list of users friends, and have a checkbox by each one, then you can access the array of who they selected. Then look at publish_actions permission - though I don't think it would be the best performance wide to loop through each friend and make a graph post to them on behalf of the user. I know you want a custom solution but to be honest your best bet maybe to use the native friend selector and the js-sdk
https://developers.facebook.com/docs/reference/dialogs/requests/
Then use the callback and some ajax to save the information you require. Look at the requests example here as well
https://developers.facebook.com/tools/console/

Related

How to send a request on facebook?

I read the Facebook dev info on how to make a request (located here) but I don't exactly understand what it does. Here's what I'd like to do. I'm using PHP and javascript.
I want a logged in user to send a request to a specific URL (with parameters attached) to multiple Facebook users (users who are already signed up for my site). Also, I need to be able to get the users that they selected and save them in the database, because only those users will have access to the URL that they're being invited to.
Are there any suggestions on how I can accomplish this?
I'm thinking you are talking about the a url request. From my experience this can be done using a simple JQuery request. You can find an example here and you can also read up on java APIs and how to use the methods(Google it). Hope this helps.
The requests dialog is for invitations to Facebook Canvas applications.
You are most likely thinking about the send dialog: https://developers.facebook.com/docs/reference/dialogs/send/
Add a callback function to FB.ui call that saves the id, this will only work if the user ids are hardcoded in. If the user manually adds them, I doubt you can track it.

can i retrieve visitor's facebook friends when he likes my site?

i have been googling since morning for an answer that meets what i need but with no luck.
i included a facebook like button to a website i am working on, but i was wondering that after a user presses the button,signs in and like the site, is there a way i can use to retrieve a list of this user's friends on facebook? and post something on their walls instantly? not just post the like on his wall.
Or if that wasn't possible, can i retrieve his friends into a csv file or something so i can later send them emails for example ? ..
what i have in mind is like how certain applications ask us for permission to access personal data in facebook and use them in thing releted to them. well same point ! so can this be done ? and if yes, how ??
if you find any links related to this or have previous experience in this domain please post an answer :)
for programming solutions, i use php, yet i am still a junior developer :).
thanx in advance
No, it isn't possible.
Bob liking you does not give you permission to spam all of Bob's friends.
No, you can't get the information you want with a simple Like button.
You would have to create an App, ask for permissions and get the user to agree.
Here is the list of permissions you can ask for.
To build your App, start here.

Post on a users wall on behalf of my app (not the user)

For several years i have managed to sort things out without posting my own question, but by readings others instead. However, after reading over 200 useless posts, i've decided it's time i get some help.
I'm building a facebook app, and what i wan't to do is extremelly simple to explain. I wan't to notify a certain user about some event in real-time. For example, "the tv show you want to watch starts in an hour". Unfortunately, facebook doesn't allow apps to send private messages to users (which was my first choice). The standard way of publishing on a users wall on HIS BEHALF is not good either, because no notification is triggered. Therefore, my idea is to post on his wall on behalf of the app (or any similar action that will trigger a notification).
I know about app requests, but they are not what i'm looking for either, as you can see, they do not match what i want to do.
Also please note that the event may be particular for each user, so making a post or something for EVERYBODY to see is not an option ("Peter, you have dinner with stacy in an hour").
Firstly, i want to know if posting on the apps behalf (or facebook page, or any other idea) is possible.
If it isn't, i would like to see any other ideas to sort this out. Remember, it's extremelly important to trigger the notification.
Thanks for your time reading this, but i have one last request.
Although what i want to do is pretty simple, there are plenty of similar issues being disscused, which may lead to confusion, so please be SURE that you fully understood what i am asking before answering.
Thanks again
What about opening an event and auto inviting the specific user to the event?
Events invites trigger a notification and the only thing you need is the user's email address which you can easily get.
I am not 100% sure if an app posting on your wall initiates a notification*. Although posting to a users wall on behalf of an app is certainly possible.
You can follow the instructions on this link, under the "App Login" title, and with that retrieve the correct access token you need to make calls as your app.
In order to have the functionality you specified, you'll have to request the offline_access permission from your users - this will allow you to post to your users wall even when he/she is not currently in or using your app. (or even logged into facebook)
*
Usually these posts on behalf of an app are user initiated - ie the user pressed "post to my wall."

Posting to User's walls as application using Facebook PHP API

I've been building a web app that uses facebook integration for easier registration/login and notifications for the users. However, for the notifications I want to be able to post to a users facebook wall when something happens on our site.
Really I see two possible problems with doing this. First being that the user will most likely not be logged in to our website when the notification needs to happen. Second I have not found a way to post to the feed using any identity other than the current logged in user.
So to reiterate exactly what I'm trying to do. When some action takes place on my site involving Bob, I want the websites application to post on Bobs wall notifying him of the action as if the application is one of Bobs friends. From some of the things I've seen while researching this, it seems as if facebook might not treat applications like users and I might have to go through a page to accomplish what I want. But really I'm ok with that.
What you need to do is to ask for the offline_access permission. Then you can store their graph id property after they login/authorize to your site's database. Then you just post to that graph id instead of instead of /me. In your case you would then POST a request to the "$user_graph_id/feed" endpoint with whatever parameters you usually have.

Change / Hack style of Facebook 'Like it' button

I want create own "Like it" Facebook button - similar with my website design.
I know that Facebook use special "secure" method to authorize "Like it" clicks.
But I think I know how to hack it and create own styled and working "Like it" Facebook button.
I hear that this it's not allowed by facebook rules and here I asking - is there any side effect from Facebook? Can they block my account?
UPDATE:
I changed my decision.
I will stay with facebook standard button.
There is no sense and not worth it to modify this button :/
Yes, they can do whatever they want if you violate their ToS. Facebook is a stickler for maintaining its brand, and modifying the Like button would definitely not make them happy. Save yourself the trouble and just use what they give you.
Hacking the like function? Assuming there was some way to "hack" this it would definitely be a TOS violation.
If you mean, however, creating custom actions for posts generated by apps, that is within the Graph API. Start out by learning to use the Facebook API by looking at its documentation. Create an app in the Facebook system first.
http://developers.facebook.com/docs/
After you've learned all about requesting permissions and proper usage of the FB dialogs and user content-control system (this includes best practices and rules), you'll find a special parameter submitted with the set for "posts" in the api called "actions." This property accepts a JSON object of the link text and link to forward to. Please note they do not allow your action names to collide with any of the Facebook core actions. Naming your custom action "like" and having it lead elsewhere is DEFINITELY a bad idea and will probably get your appID deleted.
http://developers.facebook.com/docs/reference/api/post/
You can use Facebook's share url to make your own buttons, and connect them to services like sharedcounter.com api (or build your own request to the Facebook api) to have the total "like" count. Example (hover on the heart sign on the left)

Categories