Send Message using Facebook API attaching an App Link - message

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)

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/

Sending a Facebook private message within app

I already have an active Facebook session in my app, and want to be able to send a private message to a friend using the access token I already have. The closest I've gotten is to open a UIWebview to the touch interface, but the user will need to log into Facebook again before being able to send a message. Is there a way to send a private message using the session that is already active, and ideally, using my own interface? If I could send an email to the username#facebook.com programmatically, that would be perfect, but that isn't possible in iOS that I know of.
As I understand it, here are the options to send messages to friends in iOS:
Send an email using the mail composer to the username#facebook.com (unable to send email programmatically, otherwise this will be perfect)
Send an app request/post on the wall using the Facebook SDK
Open a webview (and log into Facebook again) show the touch dialog for messaging
Is there anything I'm missing?
I found that you can send private Facebook messages using the Facebook Chat API using XMPP.
https://github.com/robbiehanson/XMPPFramework
Quickblox has some sample code that demonstrates how to send FB messages.

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

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/).

How to send a message to friends inbox through fbconnect api or fbgraph api?

I want to ask that how to send message to a friend's inbox in Facebook through Facebook Connect API or Facebook graph API.
Thanks in advance.
You might want to use a send dialog. It works like the Feed Dialog (that will post to the wall) but it prompts the user to select one or more friends and sends the "post" to their inbox.
You can try it out here:
https://developers.facebook.com/docs/reference/dialogs/send/
It has an example with the JS SDK so it should be easy to follow.

Resources