Put facebook photos on my webpage - facebook

I've been searching for a few months now and I'm just tired of searching...
I have a PERSONAL facebook account. It is not a business account or a fan account or anything like that. I want to automagically put the photos on my personal website. This is what I've found:
Hundreds of examples about how easy it is, but they only work with fan accounts.
A few claims that if I spend a few years making a Horoku app, I might be able to get it to work.
Many blogs about people who tried this, gave up, installed Wordpress and converted everything to Wordpress, tried all the Facebook photo widgets only to find that none of them work, and finally giving up.
So... Is there an example ANYWHERE of someone who wrote some code to fetch the names of all albums shared with the public and all the pictures shared with the public for a personal Facebook account? Also - this is NOT a request for a widget or app. I asked this question twice before and both times it was closed right away because the first person buzzing by said I was asking for a Wordpress widget or app.

Easiest way:
Get an account on IFTTT and set up a recipe that takes photos uploaded to your personal Facebook account and posts them to a public location you can access or embed on your website.
Second easiest way:
Create a Facebook Page that only you can post to.
Share your photos with that page.
Either query https://graph.facebook.com/PAGE_ID/photos (no access token required) and parse the returned json to display the photos (or use any number of tutorials / prepared scripts to display the photos).
The way that meets your request exactly:
Create a Facebook app (not a Heroku App).
Configure the app for "Website with Facebook Login" with your website information.
Login to that app with only the user_photos permission and store the short-term access token you are given.
Extend the short-term access token and store this.
Use this access token to query https://graph.facebook.com/me/albums?access_token=ACCESS_TOKEN, and find the id of the album you want to share.
Code your script to query https://graph.facebook.com/ALBUM_ID/photos.fields(source)&access_token=ACCESS_TOKEN and parse the returned json object to use the urls returned in each source object as the src for <img> tags to display these photos.
Code a reminder system for you to renew your stored access token at least once every 60 days, or whenever it expires.

Related

Facebook Graph API - Post a photo in an album with page admin access token

CONTEXT
So I have this Facebook page where I sell baby products. Every now and then we organize a photo contest as it has been proven an effective way to engage with the customers/community. Previously, we used to get photos from the customers and manually upload each and every one of them in an album.
Problem
Automate the process of
Getting an image from the customer
Uploading them into the album
Provide the customer with the URL
with:
The customer being able to upload the image on a UI(form as attached below) from the website which should upload the image in the Facebook album and return the URL back to them via Graph API. [Not sure if its a good idea, please feel free to advise :) ]
This is what I've built:
QUESTION
What should be the flow of getting the permanent access token where the customer won't have to log in. Maybe get a PageAccessToken with reading and write permission and process the automation from there?
What would your flow be if this case scenario? I want to avoid the customer having to log in as we don't need their data at all. All I need is them to post the photo in the album of my page.
Being new to the FB Graph API, I would really appreciate a step by step approach to solve the problem.
I am using VUE JS and Facebook JS SDK.
Backend PHP..
Cheers!
I have reached the conclusion after a few research and suggestions provided by #CBroe that designing the app like the way I initially imagined is not very practical and here is what I have decided to do:
The customers will be able to send the required information by filling the form
The information will be saved in a database including the image
The first thing will be to generate a user access token
Generate Long-lived user access token
Generate Long-lived page access token
I have decided, instead of pushing the photo directly to Facebook, it'll be first approved by the admin
If everything alright the admin will post it to the Facebook album with a push of a button
So, my solution is to automate posting to the Facebook where the admin has to push a approve button instead of the customer being able to directly post the photo on Facebook. I will try to post a link to git after it's done.

Facebook user profile pic no longer accessible?

(I'm aware of this question, but it's outdated to the point of no longer working, so asking again.)
With the Facebook API it used to be that all profile pictures were considered public, and you could get one for anyone without any access tokens like this:
https://graph.facebook.com/4/picture
Now in 2020 it seems that it only works for public images like Zuck there. I have a tool for Facebook page admins that shows a list of people who liked page posts, but when I try to show user pictures in the list they all now come up blank because "This object does not exist or does not support this action".
The docs now say "This document refers to a feature that was removed after Graph API v3.2". But I could not find any more information about this deprecation. Is it now just impossible to show the picture of a user without having a user access token, or has the way to call it just changed?
The feature has not been removed, but now for users that don't have their profiles set as public, you need to provide an access token.
For instance suppose you use the Page API to list all the people who commented on a post. Previously you could show the profile pics of commenters by just linking to https://graph.facebook.com/<UID>/picture. However now you need an access token for that Page, and to then access the pic as https://graph.facebook.com/<UID>/picture?access_token=<TOKEN HERE>.
I have not tested this with apps, but I would assume that also to get the profile pics of app users based on their app-scoped UID, you'd need to include an access token there as well.

How can I detect if a certain post on a Facebook page has been deleted?

I am planning to build a small side project that stores posts from particular public pages. And detect if they delete the post later. Something similar has been done for Twitter. But I couldn't find similar projects for Facebook.
Like this: http://politwoops.sunlightfoundation.com/
But for Twitter. I will do it in Python or C#
How can I go about it?
Any particular code or projects I can learn from?
The only way to check if a post is not there anymore on Facebook is to search for it with a User Access Token of the User who posted it. Every Object on Facebook gets a specific ID, you only have to check if that ID still exists. If not, you get an Error from the API.
For example: https://developers.facebook.com/tools/explorer/?method=GET&path=10203433018378479&version=v2.0
The path parameter is the ID of the Post.
Keep in mind that you need the read_stream permission for that, and you need to let Facebook approve it for other users or it will only work for Admins/Devs of your App. It is not very likely that you will get the permission approved for this though. It usually only gets approved for Apps on "Platforms without a native Facebook experience".
Edit: My bad, i was thinking about User posts, but your question was about Pages. In that case, all you need is an App Access Token (App-ID|App-Secret). The API Call would be the same, you just need to know the Post ID.
About Access Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens/
http://www.devils-heaven.com/facebook-access-tokens/
For getting the feed of a Facebook Page, see the Facebook docs (including code samples): https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed/
You can use graph api for this. If it's a public page, you can follow these steps:
Create your application in Facebook developers site
Setup the basic graph auth mechanism with your favorite language and get unexpired token.
Use your unexpired access token to do these tasks:
Enter the id of the pages you want to crawl http://graph.facebook.com/[insert page id or url here]/feed
Add post title, postID to your database.
Create a scheduled task on your server to do these tasks:
Select all / page based etc posts on your database and send a request to: http://graph.facebook.com/[insert post ID here]
if it returns it means it's still there. otherwise it will return an error.

Starting with facebook app (need guidelines)

i'm trying to make a facebook app, to make draws (like raffles) between the users who like my fan page, or eventually who likes a post.
I've been developing another app which do other stuff, but i'm stuck with this and it's really frustrating to not be able to do something so simple as this.
In the first place, i wish to make it available in a page tab (and that users doesn't need to "install" the app. Maybe this isn't needed if the user is just "looking" at a page that is loaded in my hosting)
Second, i don't know how could i get (assuming the one who enters the app/page tab is an admin) all the users who liked the page/post without using an access_token (because this damn access_token has an expiration time, and if i could, i'd try not to use an access token at all, since i assume the user who gets in into some parts is an admin
Any ideas?
You can't make an app that draws a contest winner from the people who like your page. Facebook does not allow you to query the fans of your pages anymore.
You can still query the users who like a post on your page though so you should set your contest up this way.
To get started, you'll need to create a connector app for your page. Users don't need to register for this app. As long as they like your page, your app will be able to access their public data. Your app will have an API key and secret. Using these, you'll be able to access information about your page.
To find a user who liked a post, you can query this with a variety of languages. I'm not sure which one you are using, so I'll give you instructions to do this from the Graph API Explorer: https://developers.facebook.com/tools/explorer
Make your post on a page, and type PAGE_ID_OR_USERNAME/feed where you replace PAGE_ID_OR_USERNAME with your page's id or username. Find the id of the post you just listed in there. It will look something like this: 213365490637345_40261112079719 (not a real post_id)
Now you can get all the user ids of people who liked that post by typing this into the explorer box:
fql?q=SELECT user_id FROM like WHERE post_id = "213365490637345_40261112079719"
And then choose a random id from that list and contact that particular user. You may have to use Facebook as your page when you try to contact them.

Which app do I need to display facebook feed?

I need to display the "wall posts" from Facebook page to another website's social media wall.
The problem is that I never used neither Facebook nor any other social networks and got no clues on how do they work. That's why I'm pretty confused with API and it's terms.
The API docs say that I need a pageId for the page I'd like to display and appId and appSecret to get an access token to the feed.
I understand how to get the token and how to parse the results - but what kind of Application do I need for that? Should I create a facebook profile and make an application that would generate me these app codes? Or ask a page's owner to do it?
I spent quite a time googling but it must be something too obvious to write about it in docs? Help please?
The administrator of the facebook page is the only one that has access to the posts on the page wall.
For the APP:
The application can be created in any facebook verified account - go to: https://developers.facebook.com/apps and create the new app - this will give you the app id and secret.
Use the Facebook SDK that you feel most comfortable with to develop the app.
For the wall posts: There are several Graph API requests for wall posts in the form of:
https://graph.facebook.com/[pageid]/[call] where [call] can be posts, statuses, feed, home. See http://facebook.stackoverflow.com/questions/6214535/what-is-the-difference-between-feed-posts-and-statuses-in-facebook-graph-api for details about each.
Using an access token (that you said you already know how to get) the administrator of the page will be able to call the above URLs and get the wall posts.
For the part with posting the info on another social media website you have to specify the exact environment where you want the wall posts to end up.