Posting to a Facebook page from a .CFM file - facebook

Ok, I have been racking my brain over this, and I am digging myself deep into a hole of access tokens and cfhttp tags, so I need some help with this one.
My goal at the moment is simple (in words). I want the wall of my Facebook PAGE (not user) to reflect what is entered into a form on a .CFM file. Immediately I thought, oh, easy, I can just do an http post on submit. That worked fine. I used the access token I found on the Graph API Explorer and it posted to Facebook with no problem.
The problem is, the access token expires...
I realize that offline access is deprecated. So I went to the help page on Facebook for that, and now my problem is, pages dont have app_secrets, which is required to change the expiration time on an access_token. How can I continually renew my access token so that my .cfm page will constantly have access to my Facebook Page?

If you have an app, you have the sercet bit for it, just check the top of the app's settings. :)
You can read more about "The deprecated offline_access" here: https://developers.facebook.com/docs/offline-access-deprecation/

Related

How Do I Share to Facebook With Custom Text

I have a task to add links to a web page to enable the user to post a short message to Facebook. There may be multiple messages on the page, each with its own link. The intent is to launch a Facebook share dialog pre-populated with the text of the message which the user can then modify, accept and/or reject.
I'm pretty new to programming anything for Facebook. I'm fairly confused and am not sure what to ask first, so I'll go with a very basic question: what's the simplest way to do this? I gather from Facebook's documentation that I probably have to use the Javascript SDK and/or the Open Graph technology. Is this correct, or is there another option I'm missing? Is there a really clear example of this kind of solution anywhere?
Thanks!
You have to create a facebook app first so you have your app_id and app_secret.
After that you need to request permissions to the user to publish_actions. If the user accepts, you'll receive a token (you need to store it in db). If you need to publish actions in a user page instead of his own page, you also need the manage_pages permission.
You need to read the facebook graph api documentation to understand how all this works.
The access token you receive expires after certain time. So, when you receive it, you can ask for a long lived token. The page tokens doesn't expire.
Facebook evaluates your app before approving it to be in production. They ask a couple of questions about how you'll use the user's token and data. You might have to put pictures of the flow too.
As far as I know, Facebook won't allow you to send pre populated messages to the user's wall. They user has to write it.
Hope it helped a bit!

How to get all the pictures my facebook page is tagged in?

I have a page and I want to run a contest for that page I am the admin of that page. I want people to post pictures on their wall and tag my page in their picture. at the end i want to get all the pictures my page is tagged in using graph api. Is there a way to do this ?. I have tried all the things. I created a app the i got the access token with all the permissions including manage_pages. then i got the page access toke using me/accounts endpoint. then using that access token me/photos/tagged. no luck so far. I am not getting all the pictures.
A little help would be appreciated Thanks.
Your question (and additional info in the comments) suggests that this stems from how Facebook deals with privacy. There are many scenarios in which using a page access token people cannot access content that is owned by a personal profile, even if the admin (personal profile) of the page owns that content.
If you have reason to believe that the API is not returning all the information that it should, you can file a bug with Facebook. If you do, please be sure to include all the necessary steps for them to reproduce the issue or they won't be able to fix it.

Facebook Graph Api me/home Seems To Return Same as me/feed

I know there have already been a lot of questions asked about replicating the users home feed and using me/home, but my question is slightly different.
A few months ago I wrote code to authenticate with Facebook (get user access token) and then retrieve their home feed with me/home. This worked fine at the time as far as I can recall. I've just gone back to the code today, and it doesn't appear to work. The result I get back looks almost the same as me/feed, which is to say it is almost entirely posts from the same account and not posts from 'friends'. Just one post from someone else, a change to their profile pic, shows up but the rest are all 'self posts'.
This only happens with tokens for my own app. If I use graph explorer using the same token, I get the same result. If I use graph explorer with it's own token then it shows me something much more like the actual home feed on the Facebook site. Generating new tokens doesn't help. I have checked the permissions on the tokens used are the same, in fact I even copied the permission list from the generated graph token into my app and re-authenticated, but it didn't help. If my app does the request, then I get almost nothing from other people from me/home. This is the same if I use myuserid/home. Makes no difference.
So my question is, why? Have Facebook changed something and is there a way to change my app so it gets a better version of the home feed?
Secondly, while researching this I've discovered posts saying read_stream won't be granted by Facebook to any app on any platform that has an 'official facebook app'. Does this mean I'm out of luck anyway, even if I get this working for testing purposes using the account that owns the app, I won't actually be able to publish it so others can use it?
Thanks.

How to show your own facebook data on a website

I got "The question you're asking appears subjective and is likely to be closed." when I started to write my this and a lot of similar titles popped up.
So I've browsed them all and only two might actually help me solve the problem, but they weren't answered.
So... I will continue to ask my question and hope that it wont be closed.
Here it goes:
All I want is to show the feed of a facebook page on a separate website. I.e. status updates, photos, videos, events, comments and likes, all public.
I've googled and also looked at some docs on the facebook developer pages, but all I found was about how to make the visitor grant my fb-app rights to do stuff. Then I would get an access_token which I could use, BUT this token expires.
Never mind... I DONT want to make the visitor grant stuff, I only want to show MY stuff, which is already public.
Preferably I would like to do it with javascript and ajax. PHP might not be supported where I have my site. So if you have an answer for me please say it in javascript first :)
Although ALL answers are more than welcome.
Please, pretty please, with sugar on top, help me with this one.
Getting public data of a facebook page is easy, you don't even have to own the page for that.
You will need a facebook application for that, once you have that you can then authenticate against facebook as the application (from your servers) as explained in the Authenticating as an App guide. You can try it with a simple curl request to:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
After you authenticate you receive an app access token and you can use it to make api requests for public data.
For example, try the South Park page object, feed connection, photos connection and events connection.
The token used in the graph explorer is a user token, but you can paste there the access token you got from the curl request for example and it will work.

How can i show the wall (feed) of my page to app on facebook?

How can i show the wall (feed) of my page to app on facebook? As i see in the page
www.facebook.com/kesha?sk=app_178091127385 and
www.facebook.com/pages/Khanduna-Yengu-Nangsu-Amuktang/187317137978077
I want show the wall(feed) of my page to my app of facebook. Please Help me.
I also try and see graph api as below
graph.facebook.com//feed
But Fail,
Please Help any one.
As I understand your question, you want to take the wall of your page and show the content of that on another page controlled by an app you have made, so that is the question I will answer.
There are a couple of things you need to do.
Facebook now requires you to have an access_token to get that information. You can get this in two different ways. Either you get your users permission to grab an access_token for them, or you create an access_token for one of the admin users with offline_access and manage_pages permissions.
There are problems with both cases:
1: Getting an access_token per user requires people to give permissions to your app which is quite annoying if they just gain access to the contents of the feed.
2: Having one access_token is also a problem seeing as Facebook puts a limit on how many requests you can make per access_token in a given time.
You need to balance these things out if you want the feed to be shown. Which case would you most likely use? If you don't have many users the second case might be the best, but if you go over the request limit no content will be shown and that could confuse your users.
Anyways.. Once you are past the access_token problem, you can access the information by getting the content from the page:
https://graph.facebook.com/YOUR_PAGE_ID/feed?access_token=YOUR_ACCESS_TOKEN.
You then get a nice json output you can use. If you are using the Javascript API you can simply use the information here:
http://developers.facebook.com/docs/reference/javascript/FB.api/
If you are ever unsure how to get the information you need there is a nice tool for that developed by Facebook called Graph API Explorer which you can find here:
http://developers.facebook.com/tools/explorer/