Get Facebook UserID - c#

Using Facebook's new Open Graph technologies launched just recently at their F8 Conference, how do I retrieve the facebook user id when a facebook user hits my open graph object? Is this even possible at all?
As per this video:
http://developers.facebook.com/blog/post/564/
I've created the object
I've also initialized the object and action on facebook:
object --> video
action --> recommend
If you go to the above .htm file and go view source, you will see the meta tags that I am using. I am referring to my pazooza:video object type, the one I created on facebook.
But the point of this is that when a facebook user hits the .htm page to view the video, then I want to record that users hit in the database.
Does fb send a signed_request or user id via the querystring or do I subscribe to the .htm file somehow and my server gets a response from facebook? I'm a lil confused any help would be appreciated.
I'm using ASP.Net MVC (Facebook C# SDK).

Never mind I found the answer, well part of it.
My architectural approach to the problem was wrong. I've spoken to one of the developers on the facebook c# sdk and some of the samples he gave made me realise how the open graph works. Or "facebooks" version of it anyway.
The MVC design pattern reigns supreme in this case. By having actions mimic the actions in your facebook open graph implementation you can now publish real-time events into the graph and have them available to new and existing users.
See this post: http://facebooksdk.codeplex.com/discussions/274238

Related

Instagram Mention API - not able to retrieve media details in DEV mode

Since the existing instagram APIs are deprecated, I am switching to the graph api.
Below is what i want to achieve and what the issue is.
Requirement.
I would like to track the number of likes and comments on instagram posts in which my business account is mentioned using #. I have setup the faccebook and instagram accounts along with the webhook. The webhook is going to send me the "mediaid" in which i my business account is tagged.
Since the app is in the development mode i am not receiving the webhooks if i mention the business account in any of the post, but i am able to send the test webhook from the developer account console. So i assume once the app is in LIVE mode it will start sending the webhooks to my server.
Once the "mediaid" is received i would like to make a call to another api https://developers.facebook.com/docs/instagram-api/reference/user/mentioned_media
in order to get the number of likes and comments.
I am facing an issue on the 2nd part. Whenever i call the api mentioned in the 2nd part i am getting the error
This api call works fine when i pass the mediaid that my instagram business account owns. But as soon as i pass the mediaid of the post which mentioned my business i am getting the above error.
I just wanted to check if this is also a limitation of my facebook app being in a development mode ? Please suggest a solution to achieve this scenario.
I tried the same what you did but with a live facebook app. From the webhook, I got an event when any other user mentioned my instagram business handle in caption and am able to fetch the mentioned media details using the mentioned media API https://developers.facebook.com/docs/instagram-api/reference/user/mentioned_media.
As you didn't share the webhook event payload, I am just assuming you are using the correct user id while making the API call. The JSON path of the user id in event payload is entry[0].id

Facebook JS SDK + C# SDK Logic

I've been playing around with Facebook JavaScript SDK and Facebook SDK for .NET (Web) to try and create a simple Page tab app which does the below:
Show welcome page
If user likes the page, ask for proper extended permissions and redirect to another page reserved for fans only
Use the access token from the login to do things on the user behalf.
Anyway, my problem is with the logic of the whole thing, as the user enters the page what should I do after loading the JS SDK? It automatically shows the permissions box so that I could get the extended permissions user_likes instead of showing the welcome page.
My other issue is with the access token that is going to be used later in time. Should i store it in session state? if yes, how? What happens if i try to access it and it's expired?
I know this is a general question but please could someone guide me through the best practices to initialize and use the facebook SDK in a .NET WebForms tab app?
Thanks a lot.
(I've read through both docs on Facebook and C# SDK. Great for browsing the API but not much documentations or examples about .NET WebForms)

Is it possible to post a picture to facebook,twitter using Microsoft.Phone.Task library in wp 7.5

I am using ShareLinkTask to post URL to social websites like twitter and facebook. Along with the URL ,i want to add a picture URI and the picture should display in sites.Is it possible ? Also is it possible to share when a different user is using the app ?since only one account is in sync and always the posting to sites happens with the account in sync with the phone.Can we have the login again while sharing so that the person using the app can post to his wall?
No. Tasks are somewhat more limited compared to a direct API layer implementation that you would get through a service-based SDK. They are always bound to the accounts that are associated with the device and you cannot log the user in/out with those from the app, unless the user himself decides to switch the accounts.
Also, at this point you cannot attach media content to a ShareLinkTask unless you already uploaded it through a service (such as IMGUR) and just posting a link to it.

Query facebook wall of a specific profile

I need to post on a website the wall notifications of a Facebook group, the group and the website belong to the same entity.
I've looked at many of the options available, but I would apreciate if someone with a bit Facebook developing experience told me what is the best path (most straighforward).
The website is not intented to interact with Facebook in any other way, there would exist no Facebook login button, and this one wall would be the only one being consulted.
I've looked at the possibility of grabbing an rss feed from the wall, but that option doesn't seem to exist.
The website is being done with asp.net (c#).
And Social Plug-ins are Exactly for that purpose. For your requirement you can use Live Stream Plugin. Look Here: http://developers.facebook.com/docs/reference/plugins/live-stream/enter link description here
Similar to your choice of getting an RSS feed of the group activity, you can use the Graph API to get the activity as JSON objects, at which point you can render them to your page.

Creating a hook into my facebook app from another site

new to facebook dev and I have read the basics to get a site up and running using the canvas setup. Nice and simple, I have also got the integration with users working ok (i.e. the signed_request).
I was wondering how it works with "sending/posting" data from one site that is anonymous (my own external to facebook) to the facebook site.
The flow I'm after is a user is looking at some content my site A (my own external site) and then clicks the "share on facebook" button (or whatever), which sends the user (and the data they were looking at) to the site B (my facebook app) to which they authenticate and then (and this is the part I dont get) can see that content on their personalised homepage within site B.
So is there a way to POST some kind of data to the facebook site? Or do I need to do something else here?
Thanks a lot.
You use the facebook API located here:
http://github.com/facebook/csharp-sdk
The .zip download includes the api that you can compile, as well as a sample project that uses it.
Reference: http://developers.facebook.com/blog/post/395/
EDIT
Here is some more info regarding the facebook graph api. I think you'll find everything you need in here: http://developers.facebook.com/docs/reference/api/

Categories