How to send a friend request through the PHP Facebook API - php

I'm working on a website where I'd like to allow a user to send a Facebook friend request to another through the website. I have the Facebook account information for both. Is this possible? I know it was in the old version of the GRAPH API and also using FBML, both of which are outdated now.
Cheers!

https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friendrequests#publish
You can't publish using this edge. The Friends Dialog should be used if you want to integrate the ability to add someone as a friend in your app.
The Friend Dialog was removed with v2.0, so there is no way anymore.

Related

How to get the "publish_post" equivalent

Scenario
I'm building an application that needs the ability to post to users wall (personal profile) on behalf of a user on facebook. I remember before the way that I would do it is request a permission "publish_actions" but reading through their documentation i came to this page:
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes/#login-4-24
which states that that is being deprecated.
They recommended an alternative which is using their sharing product found here but this seems like it would break one of the functionalies of my current application (I dont want to share content i want users to post it to whenever they choose to on whichever account they choose to).
Question
Is there a way to get posting to a users wall and NOT an event, page or group. If i'm correct I can still post data to events, pages and groups via API as normal but to a users wall its different? I need to post on their wall via api but i can't seem to find the permission.
My facebook api graph version for my app is 3.0 and im using their PHP SDK to make the requests.

Like Page Photo From Website PHP SDK 5.0

Was wondering if its possible to like a page post photo on Facebook from a website using the PHP SDK version 5?
I have managed to authenticate a user using the SDK but having troubles finding out if this is possible.
Any examples would be appreciated (if its possible).
Thanks.
No, it is not. Not in the name of the app user.
Facebook has recently removed the possibility to like Facebook objects such as posts, photos and comments via API in the name of a user.
https://developers.facebook.com/docs/apps/changelog#nov-17th--2016

Php Codeigniter data share to facebook

Is it possible to share a custom data in a Facebook wall without using FB Connect?
I'm currently developing a application using CodeIgniter PHP. I wan't to share some data to the user's facebook wall using his/her email address that the user provided for his personal information in my application.
Is it possible to send data without using FB Connect? If so, can you teach me how?
You should use Facebook libraries in your application. You can't share anything on the wall without user agreement.

Is there a way for users of my website to invite their friends via Facebook Connect or the API?

Working with the Facebook API makes my ears bleed, but nonetheless I've got a specific problem here which I'm hoping someone can find a solution for. I'm using the Facebook PHP SDK to allow users of my website to link their FB account with their website account, so they can return later and log in with one click (by storing their OAuth tokens in my database). This is all working fine - what I now want is to be able to provide users with the facility to invite/recommend their friends to my site, using a form on my site.
I've tried FBML examples from many places including here - I've managed to get an invitation form to display but try as I might, all I can get it to generate is an invitation to my application, which isn't relevant. The app exists only so that I have an OAuth ID/secret to use with the Graph API. I want to invite the user's friends to my website, or at the very least to a Facebook Page plugging my website. But seemingly including this FBML on my page will only generate application invites.
My question: is there any way to accomplish this? Can I invite the user's friends to my site (ie. to a specific URL), or invite them to my FB Page? Am I approaching this from the wrong angle?
Any advice would be much appreciated. If you'd benefit from any further info, please let me know. Many thanks,
Biggs
Right. It turns out after much tearing of hair, the example I gave was the right one. The invite generates an "Application Invite", but this is not like other app invites. When the recipient clicks "Accept" they are sent to the URL you specify (in this case, my website). The "App" then disappears from their request page - it does not appear in their profile like a normal app. So a horribly nonsensical process but a positive outcome. Phew!
It seems like sending a Facebook message is the way to go at this point (Jan 2013).
https://developers.facebook.com/docs/reference/dialogs/send/
In general, applications on Facebook should use Requests when
communicating in game status (its your turn), inviting people to use
an application, or sending messages to multiple people.
FB.init({appId: 'YOUR_APP_ID', xfbml: true, cookie: true});
FB.ui({
method: 'send',
name: 'Check out this site!',
description: 'This is the best site ever!',
link: 'http://www.example.com/refer',
picture: 'http://www.example.com/image.jpg'
});
Why not go for this open source inviter which can get your work done quick . also if you are using a cms they might have already made the plugin for your cms. http://openinviter.com/

How do I send Facebook notifications using the graph api? [duplicate]

I asked this on the Facebook Developers Forum with no responses.. How do I send notifications to users so they show up in the Notifications globe icon tab on the top left of a user's Facebook page? Some applications I use have their notifications show up there, but I don't see how that mechanism works in Facebook's API docs. Neither are there any permissions which seem to be required to send users notifications.
I know this is an old post - but someone might stumble on it as I did, and find it useful:
The notifications area in FB is updated by sending Requests which can be sent by using FB dialogs. The JS SDK provides the FB.ui() method to show dialogs for posting to stream, or sending a request.
More Info on FB:
http://developers.facebook.com/docs/reference/dialogs/requests/
http://developers.facebook.com/docs/reference/javascript/FB.ui/
Apparently facebook activate again the possibility to send notifications :
https://developers.facebook.com/docs/app_notifications/#ux
POST /{recipient_userid}/notifications?access_token= … &template= … &href= …
You need to post it to -
https://graph.facebook.com/
for example -
https://graph.facebook.com/{recipient_userid}/notifications? access_token= ... href= ... & template= ...
Update : Please check oneamongu's answer below. In my old answer I was referring to the custom notifications. oneamongu defined the requests structure very well below.
Old answer : Facebook Notifications were outdated by facebook about 1 year ago. Instead, you can post on a user's wall if you wanna inform him.
because when I run the query: {recipient_userid}/notifications? access_token= ... href= ... & template= ...
it's work only in facebook WEB?
I see the notification on the web facebook, but do not see it on facebook Mobile?

Categories