Get Facebook Posts and Tweets to use on own app - facebook

I want to know if it is possible to get the Facebook Posts or Twitter Tweets from a user at the time that they are created/posted.
I know I can get the old posts/tweets from a certain user, but I need to get them when they are created. Otherwise I must check all the time to know if the user has posted or tweeted something.
Is there a way to accomplish this?

For twitter, see the streaming api - specifically user streams.
For facebook, there are real-time updates.

For Facebook, you can have your HTML code subscribe to the http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/ on the "edge.create" which says a like happened. Then you ajax to your server that the user liked it and you store that information in your database.
For Twitter, you can subscribe to events as well. See https://dev.twitter.com/docs/intents

Related

Does Facebook send notifications to my web page by the fb app?

I have searched on Google and Fb's documentation about this but didn't find anything.
I've already shared content of my page on Facebook with the Share button provided by FB's api and also made an app on Facebook.
Now I want to receive notifications in my page when someone comments the publication or likes it.
I know that I can consult the posts/comments/likes if the user gives me the permissions, but I don't want to do this every 5 minutes. I want that facebook notifies me like a push notification.
How can I do that if it's possible?
Thanks!
After the user shared something on his wall, there is no way for you to get notified about comments/likes on that wall post, unless you authorize the user with user_status or read_stream.
That being said, there is the Realtime API with the feed and statuses fields to subscribe to: https://developers.facebook.com/docs/graph-api/real-time-updates/
That´s probably the best option, although you must authorize the user with the correct permissions too.

Handling Facebook events

I would like to be able to trigger events in a Facebook account. For example, when a user inserts a post on my wall, I would like to save the post in my database. Is there a library that permits it?
Yes. You're looking for realtime updates

How to show a post also on the user stream?

I developed a simple app on Faceobok that posts something on user wall. My issue is that the post isn't seen on wall stream, so he/she will probably never read it.
I developed this app in PHP with Facebook PHP-SDK and to post on user's wall i use: $facebook->api($userId .'/feed/','post',$attachment).
Is it possible to show the post also on user' stream? (Maybe I forget to add a key/value in the attached array...)
Alternatively, is it possible to send a notification to the user in place of post or a notification linking to the wall post?
The post is personalized, so this is why I don't use a facebook page.
Thanks in advance.
Maybe you want to send them an app-to-user request …? http://developers.facebook.com/docs/requests/
But keep in mind that you have to delete these requests yourself, once the user followed them.
Posting on the user stream is not possible (posts are visible just on user's friends stream).
Notification are not allowed, just for requests.

FB Application post on user news feed as application

Not sure if this is possible (or if there is a similar way to do that):
I have an Facebook application that when a user installs it I want to generate news feeds to show to this user and only.
I would like that the news feed posts are personified by the application and not the user itself.
Is this possible?
If not, is there a way to achieve the same thing with a FB Page?
Thanks!
No, there's no way to write on a user's Timeline on behalf of an App or a Page, the posts will always be attributed to a user.
If you need to communicate directly with a user the best options are to either get their email address from the API or use Requests

Check feed/post update from user's wall without calling (pulling) graph api periodically

I know how to use graph api - https://graph.facebook.com/{id}/feed|posts to get user's and page's feed.
I also know that facebook provides an subscription API. But I can not use it to check feeds of users i am interested but not our application users (ex: A super idol I am interested but who is not our application users. I want to check not only posts by him but also messages posted by his fans)
Is there a notification service to notify me (callback) the updating of user's feed, such that I don't need to pull graph api periodically to check the updating?.
Thanks.
"I want to check not only posts by him but also messages posted by his fans" and "but not our application users"
This sounds like a stalker app. http://developers.facebook.com/policy/ Facebook says you are not allowed to do that.