Scheduling Facebook posts for future - c#

I am developing an application by which we can schedule our posts for future & which will be automatically posted to facebook on scheduled time.
I am able to post when I am logged in to facebook using my web application but I have no idea how will i post on scheduled time when i am not logged in to the facebook.
How will facebook identify that post should be posted on my wall & not on others wall.
Can any one help me.
I am using c#, asp.net for my application.

You create a facebook application using the Facebook API, you will then add that application your account providing it with the ability to post to your wall.
Then simply have the application check a database with your pre written content in, and when it's time post the content.
Have a look at the getting started guide: http://developers.facebook.com/docs/
If more than one person is using the application then there will a public token saved in the database assigned to each user, which facebook will authenticate against to see if that token/app has permission to post to that particular users wall.

Related

Logging out of Facebook with WebAuthenticationBroker

I'm building a Windows Store 8.1 application in C#. It's a photo booth application, so many different people are going to be walking up to a single device and getting their pictures taken.
One of the features of the application is the ability to share your photo on social media sites. I was able to implement a Facebook login using WebAuthenticationBroker. However, what I need to do next is post their photo and then log out of Facebook. The last thing I want is for somebody else coming up to the photo booth with a different person's cached credentials.
I could use any advice on how to proceed here. Below is the code I used to log in:
WebAuthenticationResult authenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, new Uri("https://www.facebook.com/dialog/oauth?client_id=MyAppId&response_type=token&scope=publish_actions&redirect_uri=" + WebAuthenticationBroker.GetCurrentApplicationCallbackUri()));
Through great pains I was also able to capture what the Facebook logout URL should look like:
https://www.facebook.com/logout.php?access_token=MyAccessToken&next=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html
Has anybody figured this one out yet?
What is your exact question? How to post photos to Facebook?
Although there is no official C# SDK by Facebook, the following might be the easiest to use: http://facebooksdk.net/docs/windows/
Otherwise, you can implement raw API calls and POST to {user_id}/photos, as described here: https://developers.facebook.com/docs/graph-api/reference/user/photos/#Creating
When you app is live, you also need to submit for review and request the publish_actions and user_photos permissisons.

Getting my own data from facebook using C# WITHOUT an application

I've been googling for a couple of days, and I could not find any clue how to achieve that:
I have a desktop application(C#) in which I'd like to be able to login to my facebook profile, and pull some data from it(e.g. profile information, wall posts, likes on my posts, etc.)
Note that I DO NOT want to develop a facebook application, I simply would like to access my own user data.
As far as I see, the Graph API was designed to develop FB apps, and Graph API calls always need an access token, but I do not have token, since I do not use any Facebook application.
By now, the only way I see for that is to add a web browser component to my application, and login to the facebook through it, but it's quite inconvenient to process the pure HTML, and, since the HTML itself can change at any time, the maintenance of the application would be a horror.
So I'd like to find some way to pull data from facebook in JSON format, like the Graph API, but without having a Facebook application.
Thanks in advance for the answers.
It's not possible to access the data without a facebook application.
As you wrote, you need an access token for most graph requests, and in order to have an access token you need an application.
More than that, from what you wrote you'll need extra permissions which are not granted by default (for the user photos, wall posts, likes and so on).
Facebook can't just give you the info you see, the user has to grant a specific application the right to access their data, and because of that you must have a facebook app.
I don't see what the problem is though, just create a facebook app, it's not that complicated.

Proper way to get the Token Key for Facebook Graph API

I normally use a dirty method to get my Facebook Graph API token key in applications that fetches facebook data. I download the Graph API example page at graph dot facebook dot com then I locate the token key in the page. (The account is already connected)
Now, I need to program (for someone else) a commercial application that uses Graph API and I'm afraid such an hacky way could become non-functional if Facebook website changes.
Is there a static URL more common than the example page where the Graph API token_key resides, or do you think my method will be safe for a long time?
[Edit]
Just to comment my question, and the answer to my question:
I was trying to build a desktop application fetching data on Facebook using only Graph Explorer and the Graph API example page instead of doing the web request in the answer. I didn't want to have a desktop application that depends on a Facebook App so that's why I was always asking the user to connect via two text boxes (which is against Facebook t&c) then I was downloading the Graph API examples page to get the proper token.
But Graph Explorer and its examples are using a 'Facebook App' too. So it's not clear if the access_token are going to be valid for a long time or not: It's not a good practice.
The answer is: Redirecting a user to an authentification page then fetching an access token is safer, easy to handle and a lot more stable than connecting a user via text boxes and several WebBrowsers navigation.
You can get an application access token to query public data on Facebook from this URL:
https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={yourappid}&client_secret={yourappscret}
You need to create an application on Facebook and pass it's ID and secret key.
More information on: http://developers.facebook.com/docs/authentication/applications/

Facebook API allowing deauthorization of application

I know this question has been asked in the past, but times have changed and I am hoping the facebook SDK has progressed. I have seen other websites with the ability to deauthorize their app from the website rather than having the user sign in to facebook to do it. An example is glassdoor.com. If you create an account and then sync your FB account you can then deauthorize on the Account page. Any ideas on how this works because I have searched facebook docs and find only the deauthorization callback.
In graph API you can issue an HTTP DELETE request to /UID/permissions to revoke authorization for an app. Or you can use auth.revokeAuthorization from legacy REST API.
https://developers.facebook.com/docs/reference/rest/auth.revokeAuthorization/
hope this helps

How to post to Facebook user's profile?

On my site, user's post goods for sale (similar to Craigslis). I want to create the capability for user's to have it post to their facebook profile automatically from my site.
The scenario I'm imagining is this.
User creates an account on my site. In their profile, they allow my site to post to their facebook profile. From then on, anytime they post an ad, it automatically posts it to the facebook profile as well.
What do I need to do to create that agreement between my site and their facebook profile?
How do I actually post it to facebook? I'm developing in .NET/C# on ASP.NET MVC
Been hearing multiple stories on how to do this, not quite sure which to take and run with. Thus, I'm asking the experts here on StackOverflow! Thanks in advance!
A few resources that you might find helpful to get started :
Facebook Developer Site - Documentation for the API, forums, etc.
Facebook Developer Toolkit - a .NET library that provides access to the Facebook API
If you're looking to provide integration with facebook features on your site, you might want to look into Facebook Connect and its capabilities..
A while back I was looking at Facebook Connect and ASP.NET MVC and found these links helpful as well:
Making Facebook Connect work with ASP.Net MVC
http://singulartechnologies.com/integration-of-facebook-connect-with-asp-net-mvc
http://singulartechnologies.com/custom-asp-net-mvc-authorization-with-facebook-connect

Categories

Resources