How can a Facebook application notify a user of something? - facebook

The example is a website allowing users (who are associated with Facebook users) to create a blog post. The commenting system is the fb:comments social plugin.
When someone leaves a comment, the writer of the blog post should be notified that there is something new to read.
What I would expect as a writer is that I would get a notification (ie. "x has commented on your blog post."). There doesn't seem to be a way to generate those notifications though.
What methods are there in the Graph API for the writer to learn about the new comment? Which is the "best"?

Do one or both of the following:
Send App-to-User Requests. They won't generate notifications, but
they will increment some app counters. Among other places, the user will see the counter at the top-right corner of her wall.
Use the email permission to get the user's e-mail address. Store the address on your server and send the user an email whenever she needs to be notified.

Related

Forward my received Facebook messages (chat + messages) to my email inbox, and subsequently delete them from my Facebook inbox

Facebook does not offer a feature which forwards ALL my received messages to my email inbox, and subsequently deletes them from my facebook inbox. Is there an existing application or online service which offers this functionality? If no:
I want to write a script which does exactly that. It should poll regularly if a new message has arrived. If yes, it should forward it to my email address and delete it from my FB inbox automatically, without user interaction.
Which scripting languages are suited for that task, which classes and methods? Is it advisable to move that script to a web server so it runs continuously without user interaction? How can one go about that?
Facebook does not delete anything, only you can delete inbox messages.
Anyway, what you are trying to achieve is not possible, access to the inbox is not possible anymore. Facebook removed the API endpoint for it.
You will need to use facebook graph extended permissions "read_mailbox" to read the facebook messages.
Please note that this extended permission is available only for facebook graph API version 2.3 (not available for version 2.4 and up).
You can read the facebook messages every 5/10 minutes (via graph API) and in the case of a new message you can create a new self email message with the facebook message.
You will NOT be able to delete the facebook message (read mode only)
Hope this helps.
Good luck!

Graph API Facebook : user id

I am working on a business application which is using facebook and I need to send a private message to a connected user friend.
For getting all the user friends, I am using me/taggable_friends. In this way I have all the user friends but I can't retrieve the real friend user id. I need to know this field for sending a private message (or request or notification).
Regarding the FB documentation, this feature is only available for the "games" product but it's look like strange.
Maybe i'm doing something wrong but I don't understand how should I proceed.
Thank's for your answers.
taggable_friends can (and should) only be used for tagging friends, you donĀ“t even get an ID with it, only a tagging token (see Facebook docs).
For sending private messages, the best (and only) way is to use the Send Dialog of the JavaScript SDK: https://developers.facebook.com/docs/sharing/reference/send-dialog
The user has to input the target friend and the message on his own, which is a requirement for the message anyway. It always has to be 100% user generated.
The Chat API is deprecated and should not be used anymore: https://developers.facebook.com/docs/chat
On iOS, if you want to send a private message to another Facebook user, you should use the Message Dialog: https://developers.facebook.com/docs/ios/share#message-dialog
This lets a user share a message with any of their FB friends, then return to your app. You can ensure the message contains a link which the recipients will be able to click on.

Workflow for a message/item sending Facebook canvas app using new Request 2.0

Working on my second app and the first using the new Request 2.0 and other recent features.
I've managed to get the app to log a user in and grant the extended permissions.
My app is simple: I want a user to be able to send a message to a friend along with a user-selected graphic to go along with the message. I guess the basic metaphor is a gifting app.
I'm not wrapping my head around the workflow especially as examples using the new Request 2 dialog seem few and far between.
Here's what I'm thinking the beginning of the workflow looks like:
User arrives at app page. Logged in, permissions granted if needed
User selects a graphic (via an html radio button form) to go along with message they enter into an html text form
User selects friend(s) to send the message/graphic to.
I'm assuming I should toss the senderid, receiverid(s), link to graphic (or id), and message into a database.
How do I get the info from my users' selections? Does hitting Send Requests on the FB dialog POST the FB and form POST info to the same page so I can read them via PHP $_POST variables?
When the person receives the request, they accept it, but how do I get them to go through the requests outstanding and display the graphic and message? i.e. Archie logs in and has 6 friends sending him items through my app. How does he, in FB methods, see the message/items that Veronica, Betty and Jughead have sent him?
I don't mean that in a basic way. I know how to do this all if I was just writing a PHP app on my own site. I'd be finished in a few minutes. The part that's causing a head-shaped dent in my desk is trying to work out how it works adding Facebook to the workflow. I've been looking for examples and tutorials but they seem to be out-of-date to the new methods FB wants us to use.
Thanks for any pointers!
When a user follows a request you have access to that request ID. If you need to access additional requests the user needs to "Connect" with your app so you can read that info from the user object. The request ID for the acted upon request will be available to you on your canvas page and it will be up to you to develop a work flow that authenticates the user to be able to access any other requests for that user.
The related blog post that discusses the process is available here:
https://developers.facebook.com/blog/post/464

How to use Facebook Application to write a notification to Users

i'm developing an application for a university exam, using Appengine and Gwt (Google products) and i'd like to implement Facebook this way:
- give the ability to a FB user to login to the application through facebook (did this implementing the oAuth2.0 flow, so now i have the user's access token and his permissions)
- since the application is for being notified when a professor publishes some material for his course (this is all handled by appengine), i'd like to notify the user when a professor publishes some material, through a wall post or a note from my application in a way that it writes to the user something about the new published material.
I've been looking through EVERY single resource online, and couldn't find an answer: a lot of similar questions but no answers.
Writing the POST is not a problem, and for the moment i'm trying with the api graph explorer.
I manage to write on the user's wall/note as if he's writing himself or (if the user likes the application) write all the likers a wall post/note (but the same to everyone).
But i don't find a way to send personalized wall posts/notes to every user in response to some specific material published.
FB doesn't allow to do this because is considered spamming?
You can't directly post things to your user's wall as a way of notifying them - wall posts are intended to be things the user posts from within your app (for instance, they find something in your app interesting and choose to share it with their friends, so they click a 'Share' button).
You could try using an App-Generated Request (http://developers.facebook.com/docs/channels/#requests). This will increment the user's Bookmark Counter, and when they click on it they will enter your app and you can show them the latest news.
OR, you could ask for the 'email' permission for your app, and send the user an email notification when something is new.

Facebook: Best way to allow one Facebook user to send a secure link to another Facebook user?

Hey, I'm a product management guy looking to understand how we can deliver audio clips into Facebook. Specifically, I'd like to allow a user (a "sender") who is logged into my iPhone app through Facebook connect to send a link for an audio file to another Facebook user (a "recipient" who has never logged into my app). I understand that it's not currently possible for this link to be sent as an outside email to the recipient, or even as an internal Facebook message. Is that still true?
If so, I'm wondering if it's possible (and advisable?) to post it as a chat message, or as an invite that is posted to the recipient's wall. For the chat message, if it's possible then what are the downsides of that method? For the invite, I realize the wall post will only be visible to the recipient, but I'm concerned that the recipient may not realize that and will think that the audio file is available to anyone who views his profile.
As such, for the invite method, I'd like to require the recipient (after they click a link in the wall post invite) to login to our web site where the audio is hosted via Facebook connect before listening to the audio. Is it possible to accomplish that? In other words, will I be able to know when the person logs in through Facebook connect that he is the recipient? In addition to a token in the audio link URL, how do I track that? Will I need to track a user ID or something?
Thanks in advance for your thoughts!
I'd go with the wallpost method.
I'd implement it by letting the initial user share a link on a friend's wall saying "User has shared a song with you! Click here to open it!" or something like that. When any user clicks that link, prompt for install and once they're authenticated, show them any files that are theirs (and yes, you'll need to check their user ID vs. the user IDs that were stored as links in your database).
If it's not the friend who clicks the link, they won't see anything (or they'll see something different). You could even use a customized link and show an error if an unauthorized user clicks to that page.
For what it's worth, this is how Amazon handles giving Amazon gift cards via Facebook.
If this is unclear or too vague, let me know and I'll clarify.