Can a facebook friend request be sent from my own app? - ios

I am creating an app and want to know if my app can send a Facebook friend request (say I know the other users id/name) or does Facebook not allow this?

The short answer is "no."
The Facebook API does not allow you to programmatically send friend requests, but with some work, you may be able to use a WebView to load a Friend Request dialog via Javascript (For info on the request dialog, check https://developers.facebook.com/docs/reference/dialogs/requests/).

Related

Is there a way to send app request to Facebook friends without the app request dialog?

I am creating an app that is connected to Facebook.
One functionality of this app is to send notifications to Facebook friends (they will able to see using any browser when they log in to Facebook, or in Facebook app) to try and download the app.
I was able to create a table list of Facebook friends who don't have the app. And in each UITableViewCell, I added a UIButton titled "Invite" that will call an function to invite that particular friend in the cell.
I want that when the user tapped the button, the Facebook SDK will send a notification to that Facebook friend.
I don't want to use the default app request dialog the Facebook SDK has. I want to customise my own.
Is it possible?
It is not possible what you are looking for.. See my below answer which would clarify you..
There is option of frictionless requests.
On Facebook developer site they mentioned in section of Invites and Requests
We touched on a scenario where users exchange requests back and forth. If this scenario is typical in your game, it can be a bad user experience to force them through the request dialog every time they want to send a request. The solution for this is frictionless requests.
Frictionless requests let users send requests to friends from an app without having to click on a pop-up confirmation dialog. When sending a request to a friend, a user can authorize the app to send subsequent requests to the same friend without another dialog. This streamlines the process of sharing with friends.
For more reference see Facebook Invites and Requests

"Gifting and Social Trading" Facebook Requests

Facebook has an example of adding a gifting loop to an app here: https://developers.facebook.com/docs/games/requests/
See "Gifting and Social Trading"
My question is how to check for incoming gift requests so that they can be displayed. All of the examples I have found require that you click on the incoming message within facebook in order to get the request into your app. But that's clearly not what they are demonstrating here.
How do I check for the incoming requests so that I can display them in an inbox without going through the facebook app?
I am guessing that the user in this example did not have to click on each request in the facebook app to get them to show up in their inbox.
The requests a user has received from your app you can be queried via /me/apprequests
https://developers.facebook.com/docs/graph-api/reference/user/apprequests/

Facebook SDK iOS invite user without FBWebDialogs

I want to get list of my friends from Facebook who are not users of my app, and be able to invite them.
Using FBWebDialogs I can pick users, but I'm wondering how foursquare did it?
Screenshot:
There is option of frictionless requests.
On Facebook developer site they mentioned in section of Invites and Requests
We touched on a scenario where users exchange requests back and forth. If this scenario is typical in your game, it can be a bad user experience to force them through the request dialog every time they want to send a request. The solution for this is frictionless requests.
Frictionless requests let users send requests to friends from an app without having to click on a pop-up confirmation dialog. When sending a request to a friend, a user can authorize the app to send subsequent requests to the same friend without another dialog. This streamlines the process of sharing with friends.
For more reference see Facebook Invites and Requests
You are asking two questions here:
How to invite Facebook friends without web dialogs?
Unfortunately, the web dialogs you are referring to are the best way to send invites to friends. There was a time when we had to resort to ugly hacks just to get this functionality in applications. Facebook added this functionality to iOS SDK after developers created bug reports and were literally behind them.
Get a list of friends who are not using the app and invite them
Foursquare IMO is not using the requests API. What they do is, whenever somebody links their Facebook account to their Foursquare account they make a note of the users friends who are using/not using the app. This is possible if the user grants the app permissions.
Then in the invite screen, they simply build a UITableView with list of friends who they think are not using the app. When you tap Invite they will just send an email invitation and not the Facebook request you are referring to.
I think FourSquare syncing the user's friend list(friend ids) to its own server.. Then after they are checking it to create the custom interface like the screen shot you shared.
Maybe I didn't get the question right, but from what I know after you tap the invite button on Foursquare the Facebook invite dialog (apprequest) will pop up.
In general this dialog will let you select friends if you didn't specify any friends ids before presenting it, or show you the selected friends like in Foursquare example.
There is an API to get your FB friends, so it's possible for your server to check witch of then already has the app...
I've been researching this for a while and the main solution I have found is frictionless requests, as Rahul Patel noted. You can do a direct request to the graph API and see who has your app installed.
From there you could fairly easily implement any sort of filtering. For example, using the Friend Picker UI Control and implementing the method friendPickerViewController:shouldIncludeUser: and checking against a list of facebook ids who are not on the app that you cache somewhere else in your application and actively update it (for example in a simple core data model that is updated when appDidFinishLaunching), returning no if the user is not displayed. This would only allow users to select individuals who are not on the app, and then you could send a request to them under the hood with frictionless requests.
I do think that it is not a great idea to spam people, however, without at least allowing them to check the names of their friends, or see who they are.

Send Message using Facebook API attaching an App Link

I need to send a Facebook new message using Facebook PHP sdk or Javascript sdk. This message should be attached a link for a Facebook app. please check this image, Then you can understand about what I exactly want.
New Message with Link Attachment Image
Please anyone can help me?
This is not currently possible. Applications are prevented from sending private messages to their users (or any users for that matter) because it would be a serious vulnerability for spam.
One Alternative
would be to request the email permission from your applications users and then using
Graph API
or
FQL - Facebook Query Language
you'll be able to request the email of the user and send him an email using some code on the server.
You can read more about requesting permissions for facebook applications at these links :
https://developers.facebook.com/docs/reference/api/permissions/
https://developers.facebook.com/docs/authentication/
Another Alternative
would be to utilize facebook dialogs and initiate a 'request' or 'apprequest' dialog. For this you'll need to implement the Facebook JavaScript SDK and the Request Dialog.
The Request Dialog
When you initiate this dialog you can specify a message to be sent along with the request. When a user responds to one of these requests they are redirected to your application.
(source: fbcdn.net)

Inviting Facebook friends through iPhone App

I've been searching this question, and I haven't been able to find anything that works. I have an iPhone app that allows users to link their Facebook account. It would look something like this:
Once a user has successfully linked to FB, I want to present them with a list of their FB friends and an option to invite selected friends.
FB Friend 1........... Invite
FB Friend 2........... Invite
...
FB Friend 1000..... Invite
Basically, I want to send a message to FB friends that says something like "Check out this app". I'm pretty sure this has to go to either their notifications or wall and cannot go as a FB message, but I can't figure out how to do it.
Also, I don't need to select a group of friends to invite -- this can be done one at a time. So it would look like this:
FB Friend 1........... invited
FB Friend 2........... Invite
...
FB Friend 1000..... Invite
Thanks so much for any help you can provide.
Unfortunately there isn't anything in the iOS SDK that presents the apprequests dialog, and a user has to have installed/approved your application before you can send them application notifications via a POST request...
Requests are a great way to enable users to invite their friends,
accept a gift or help them complete a mission in your app. There are
now two types of requests that can be sent from an app:
User-generated requests: These requests are confirmed by a user’s
explicit action on a request dialog. These requests update the
bookmark count for the recipient. You send requests by using the
recently launched Request Dialog.
App-generated requests: These
requests can be initiated and sent only to users who have authorized
your app. Developers can send these requests using the Graph API. Use
these requests to update the bookmark count to encourage a user to
re-engage in the app (e.g., your friend finished her move in a game
and it’s now your turn).
The only way to get this is via Facebook's Requests 2.0 dialog (which is not currently available to the Facebook iOS SDK):
http://developers.facebook.com/blog/post/453
See more here in this related question...
Sending application requests that appear in the left column on Facebook home page?

Resources