I am working on an app that creates albums in Facebook and then adds photos to the album. That side of things is working fine.
When the photos are added to the album facebook puts on the users timeline* something like " has added new photos to the album ."
What I would like to do is suppress this message, or at least customize it a little.
Does anyone know if this possible with the Facebook API? I have not been able to find anything in their doco, and suspect it is a automated thing that facebook doesn't give control over, but would like to get confirmation.
Cheers!
*not 100% sure if this is strictly the "timeline" or just their wall.
Use the no_story = 1 parameter.
$newphotodata = array(
'access_token' => $fanPageAccessToken,
'message' => $message,
'no_story' => 1,
'aid' => $albumId,
'image' => '#' . $picturePath);
$uploadedphoto = $facebook->api('/' . $albumId . '/photos/', 'post', $newphotodata);
I am working on this topic myself at the moment. This is my latest on it: http://facebookanswers.co.uk/?p=322
Incidently, have you worked out a way to generate a proper timeline post when you create a new album. If you do it manually, you get a nice post showing four of the images. But if you use the API you cannot get that. You can nearly get it by posting to /links/ but its still not quite right, as friends will just see a single icon.
Well, looking at the facebook api I can find no mention of how to suppress these automated status updates. From this I have concluded that it is not possible to modify or suppress these status updates.
Thinking about it some more I can understand why facebook would not these messages suppressed or changed as it could be abused by apps to make posts without a user noticing.
Just close the window after uploading and open again IE.
Related
My head is currently going nuts trying to figure out the most effective way to retrieve the albums from a fan page I own, to an online page. I've seen a code that used FQL and it worked, but it's too slow and apparently it's outdated.
I've browsed around and came across the Graph API concept but it looks a bit hard to understand. By the way I already have an app registered and I also started to search around the Graph Explorer but I can't come to a conclusion.
Are there any tutorials out there?
EDIT: I've tried this code:
<?php
$album_id = 'myalbumid';
$access_token = 'accesstoken';
$url = "https://graph.facebook.com/{$album_id}/photos?access_token={$access_token}";
$image = json_decode(file_get_contents($url));
foreach($image->data as $img){
echo "<img src='{$img->images[6]->source}' /> ";
}
?>
And it works, it displays all the photos from a given album. But what if I want it to display all albums (including thumbs) and the user navigates through them?
Requesting the following will give you a reply with all albums and photos in those albums:
https://graph.facebook.com/CocaCola/albums?fields=photos
You'll want to replace CocaCola in the example with your own page name or ID.
This is called nested requests or field expansion. There are several detailed examples on the Facebook Documentation site.
A few comments for you to help you along the way:
Calls to retrieve page objects don't need an access token so long as the page does not have age and/or country restrictions. Unless you legally need them, I wouldn't recommend adding restrictions.
Using file_get_contents() is okay for sandbox testing, but you should use the Facebook PHP SDK for production code.
I am new here, I have read through all possible solutions to this and I can't find anything that answers our problem. I am an admin for a facebook group and we want to show the wall posts on a feed for the charities website. We have allowed anyone to see the posts on the facebook group settings. However, we cannot get it to work on the website feed to show the wall entries.
One problem maybe that no one has the original settings when the group was set up. There are now group two admins but both admins don't have any setup logins to see data from the group. Can we change this so we can get all the data that is available? We don't have any access to group users and data that is usual with pages so I think we are missing something major here.
The group is https://www.facebook.com/groups/borntoosoonkh/
Any help for a workaround on the access issue and also if it is possible to show wall posts from a group on a website feed.
Really hope you all have brilliant ideas.
Thank you for reading and your time.
one last thing, please.......I know that you cannot like a post unless you are a member of the group but I also can't find a join button for people to request membership.
You can programmatically access the wall posts of a group, but you'll need an access_token, acquired from a Facebook Connect button.
For an example, see the Graph Api Debug Console: group Born too soon
read this it will get you there
https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed
$request = new FacebookRequest(
$session,
'GET',
'/groups/feed'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
// handle the result
I am currently researching the same problem. You have to find a way to get an access token without a specific user. How to do this? Still working at it. But like the user above said get it from the Gragh API explorer on the facebook developers site, problem is it times out.
What I did was create a facebook app. Use this site below as a guide...
http://ranacse05.wordpress.com/2011/02/04/show-facebook-group-wall-on-web-site/
its old but it should bring you up to speed. And you can have something like the code below some where:
$token = $access_token; //$access_token is created in facebook app
$token ='?access_token='.$access_token; //append '?access_token field' from included php file
$url1 = 'https://graph.facebook.com/'.$group_id.$token;
$des = json_decode(file_get_contents($url1));
Wallflux.com provides feeds for facebook groups, not sure about your question about the join button, though.
warning, im affiliated with Wallflux
Can I do something like this?
I want to have all the photos from my fan page, embedded on my website.
Want to have the option to like each photo - must.
Want that each photo will have a link to the real URL on Facebook - must.
Would like to share and comment as well but not as important.
Please let me know if you have an idea of how I can do it.
I saw a lot of examples but nothing that include these things.
Thanks!
Getting some of the photos is easy. Getting all of the photos is nearly impossible. Start with a Graph API call to the photos object.
To get the photos, create and app, install the PHP SDK on your site. This code should get you started.
$config = array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
);
if (!class_exists('Facebook'))
include_once 'PATH_TO_SDK/facebook.php';
$fb_object = new Facebook($config);
$photos = $fb_object->api('PAGE_ID_OR_USERNAME/photos', 'GET');
printf('<pre>%s</pre>', print_r($photos, true));
You'll need to iterate through these results to get more than 15 of your photos. Photos that aren't marked as "Public" won't be returned by this API call.
To create a like or a comment, you need to auth the user and then POST to the Graph API using the photo id.
I am trying to create an application that posts specific information on a user's wall. This message should also be visible in the newsfeed, but this part is where it goes wrong.
I 'post' following information to the feed graph:
<?php
array(
'link' => string 'https://www.facebook.com/page' ,
'picture' => string 'http://...../picture.png' ,
'name' => string 'Name' ,
'caption' => string 'caption' ,
'description' => string 'info text' ,
'message' => string 'message'
)
?>
(All the information is filled in with usefull information, but for this question I made it quicker readable).
The information comes on the user's wall, but not in the news feed. This happens also from the user's side of the story: He can see the post on his wall, but not in any feed. Also when we try with other friends.
I also tried to only post a message (without link and picture), but it still is not visible in the general newsfeed.
The auth permissions are set and available (publish_stream) and the permissions are also correct when I look at them on the wall. I use the same code as an older app. Maybe it is a setting on the developer page? Sandbox mode is off...
Can somebody please help me?
Thank you!
I think it may be releated to the fact you're sending a link, apparently FB doesn't like this anymore :
"
Updating a User's Status
You can use this method to simply update a user's status. When you do so, the status message appears at the top of the user's profile and on the Friends > Status Updates page. The message also appears in the stream with your application icon.
To use this method to set a user's status do the following:
* Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user's Wall only. It won't appear at the top of the profile or in the Status Updates page.
* Make sure the message is no longer than 420 characters. Otherwise, an error gets returned.
"
as per http://developers.facebook.com/docs/fbjs/streamPublish/
What Facebook chooses to display on the newfeed is done via algorithm. There are options each user can set to view items in the news feed. Recent Stories first and Popular stories first. If the popular is selected, then facebook algorithms kick into overdrive. If recent stories, then it should display all available stream items (based on other privacy settings) into the feed.
Read this if your still wondering why auto posts and api feeds are not showing on the main news feed to others! Facebook dont like us saving our time they want us to sit on there site and supply quality posts and not focus on our own website!
https://developers.facebook.com/docs/public_feed/
I want to get the posts (only from the band, not others) from a Facebook Page Wall (its a Band, so no private profile) and publish it on MY own site.
I hoped to get the Posts as XML or JSON and then parse them.
So I wanted to use Facebook as a news System.
But I didn't find a solution - I don't want to have the user to log in with his account to see anything - it should be just a public stream.
The only idea I found was to use twitter as an export mechanism, but that's kind of elaborate.
Does anybody have an idea?
You could use the Facebook php sdk: https://github.com/facebook/facebook-php-sdk
It ends up looking like this:
//
include('facebook.php');
$fb_config = array(
'appId' => $yourAppId,
'secret' => $yourSecret,
);
$facebook = new Facebook($fb_config);
$feed = $facebook->api("/{$nameOfFaceBookPage}/feed");
That will give you an array of feed stories.
I assume you created a facebook page for your band and it has url in such format:
http://www.facebook.com/pages/<band_name>/<page_id>
In this case you can read wall posts in json format using Graph API (no login required):
https://graph.facebook.com/<page_id>/feed
If you only want posts from "me", can't you just use the Like Box social plugin and show the stream? This plugin will only show posts from the page owner.
http://developers.facebook.com/docs/reference/plugins/like-box
I am developing a similar app and after a lot of searching finally accomplished
https://graph.facebook.com/194466683916784/feed?access_token=AAACTzPZAxblQBAHND7fo1rA58VqQawuJb806Q6BeIFhTroyGSYIe5i0R5fZAZBtffNvkkZB7ayvV7Vw7j7ZBf7vGt6xHx2gjx4FhO8d27sAZDZD
enter your page wall id after .com and in the access token get your own access token from Graph - API explorer
Then exchange that token for a longer for a longer lived one that is for 60 days and you are good to go
Some time ago I had your same problem and I was looking for something very simple to publish feeds of facebook pages, but I didn’t find any solution on the web.
What I want to achieve are the post (only from my personal fan page, not the other) of the bulletin board (facebook wall) of a FB page (this is a fan page, not private profiles) and publish it on my site.
I was hoping to get the posts in JSON or XML format and then encode them so as to use FB as a news system. Unfortunately I haven’t found any kind of solution because I don’t want the user has to log in his account to see something so it must be a flow of pubblic feed.
So, I decided to code the plugin. Here the link to the tutorial:
http://www.lorenzodedonato.com/freebies/facebook-plugin-per-visualizzare-i-post-della-bacheca-di-una-pagina-fan-creato-in-php-json/