integrating facebook chat using graph api - javascript

I have been asked to integrate facebook chat in my application using javascript. I went through the chat api but that needs a domain url. I have to integrate the chat without the domain or the site url. I tried populating the online friends list through graph api, and I am able to successfully authenticate using the client flow example, but it does not redirect to my local host: http://localhost:8090/chatplugin/success.html. An error pops up telling me the resource is not found.
Is it possible to integrate FB chat using the graph api? I'm new to FB apis and I need more info.
Thanks:)

Short answer: no.
Longer answer: The Graph API lets you access all the information that is stored in Facebook's social graph; the social graph is the giant web that keeps all the information on people, events, messages, etc. Chat isn't part of the graph, it's a separate application, that also uses info from the graph to populate it.
While there may be other ways to sneak around (which I don't know), the Graph api doesn't provide what you need.

Please see the API available on Facebook API.
https://developers.facebook.com/docs/chat/

Related

I wonder how I can show my Facebook feed on my own website?

I wonder if it is possible to fetch a feed from a page that I am admin for.
I have created a app and I understand how the graph explorer work. But I don't understand how to display the feed (or fetch the posts) to my website.
I have looked into this and tried multiple things but I can't get it to work.
I don't know about FB javascript SDK but I researched this Url https://developers.facebook.com/docs/pages/realtime/ here FB provides webhook for real-time notifications
You have to subscribe to your FB app with a backend server so that any realtime notification, feeds, comments, and likes directly reach your server. Facebook calls your backend API and sends real-time feeds.
Now once you have feeds then you can either ping backend at a certain interval to check for any new feeds or from backend itself you can control frontend and display immediately.
Hope this helps you.

How to setup the Facebook web SDK securely

I have been making web applications for around 4 years now, and I have always had troubles setting up the Facebook web SDK.
But for my new application I really wanted to make the Facebook integration.
The problem I am facing now, is that I am using the JS SDK witch was fairly easy to set up, but now I want to build my backend to support it all. The flow I came up with was like this:
The user logs in
The user giving me their FB-id
A call from the back end create the new profile or logs if its a older user
The api gives back a api key for the other requestes.
The problem I see with this flow is, that if another person haves another users facebook id, they can obtain a api key for that user, just by sending the request with that id to the server.
How can I make this secure. I don't really thing that the docs on facebook are great, and the other tutorials on the web dos not cover this topic.
Thanks for the help guys!

Show GA stats of the website on the website itself

We need to show the number of visits for pages of our website. We already use GA for general reports and we assumed that it might make sense to use GA API to get number of visits data from GA instead of building our own counters and increase load to our database and web server.
I read documentation and already know how to build queries that I need. The main problem I'm trying to work around right now is an authorization process. Sounds like if we use OAuth 2.0 each user has to authenticate before he/she can see the statistics on the page and they will have access to statistics of their websites (if they have them registered with GA). In our case this is incorrect, everything we need is just to show our own GA stats at our own website. Easy task as we thought initially but it doesn't sound like that anymore.
Is there a way to authorize our website to Google (like we send come credentials when we use Maps API) and show stats automatically to any user? We wanted to implement it on client side via JS but if this is possible to implement it on server-side only - that's OK. The target platform for server-side implementation is ASP.NET (just in case). Can someone point us in the right direction?
Quite a few options:
You can use OOCharts and a script like this
Use a service like embedded analytics (paid)
Use SeeTheStats and it's widgets
Use google charts and JavaScript
Use explanium to embed a ga chart
Piwik can embed charts too.

Query regarding post comments using Facebook Javascript API

As per the Facebook Javascript API documentation, I need an APP Id to post comments on facebook wall. But when I log in to my Facebook account it always shows me “All Campaigns" page and I am not able to access “Apps” section to create new application and get APP Id which can be used in JavaScript API.
Can you please suggest how can I create an APP Id in my account and post comment on my facebook wall from external web pages using Facebook Javascript API.
You can view/create apps on Facebook for this purpose in the developers section. It sounds like you want to look at 'Build for Websites'. When you have made an app, it will appear in the apps section, where you can find your App ID and App Secret keys, as well as manage/edit the app.
I am not able to access “Apps” section to create new application
What exactly does „not being able” mean?
Is your account verified with Facebook (via text to mobile, credit card info)? That’s a basic requirement for becoming a developer on the FB platform.

Grabbing facebook feed in website

I develop mobile websites for my clients. This particular client would like some facebook wall activity to be displayed on the website. I have looked into the facebook graph api and am getting confused on authentication.
I need the blah in https://graphs.facebook.com/clientsfacebookid/feed?access_token=blah
in order to grab the info i want. I read about authentication and all of that but it doesn't seem to serve my purposes.. For example a lot of the stuff I read about getting a token is related to creating apps and stuff - which is not what I'm trying to do. A lot of ways to authenticate redirect users to log in or grant access to the information but this also doesn't seem like it fits my scenario.
Should I just talk to my client and get them to send me an access code or set up some stream so I can grab an updated access code anytime I need it OR is there some built in functionality in the API that I could benefit from using.
Any thoughts?
P.S. I am trying to implement this via an ajax call in javascript.
Thanks!
What you'll need to do is create a Facebook App and have your client add this to their page. You can then get an OAuth token for this app and use it to query the client's feed. See the Facebook documentation for authenticating as an app for details.
It's actually far simpler if you just want to grab the data from the page. Create an App, but you don't need to add it to the actual page. You can generate an App Access Token by following the instruction on the Facebook Developer Website.
Then, all you need to do is call the Graph API with the generated access_token. E.g.:
https://graph.facebook.com/{page_id}/feed?access_token={app_access_token}
You can then use the data returned by Facebook to display selected posts from the page.
The Page Admin doesn't need to add the app to the page, and this method can be used to scrape any published page. The posts on Pages is public anyway, you just need an access_token to access the page.
If you want a simple way to learn and have an example of a working model try out fourgefeed.com its a simple framework with a simple to implement example kinda like jquery.

Categories