New #facebook.com email - API Howto? - facebook

With the new #facebook.com emails being available for all users I'm wondering if there is an Graph API call that can be made to obtain a users facebook email address?
From what I've seen you can simple take the users alias (as we see in the URL) and slap on the #facbook.com to get the email. Until I cam across a friend who had his FB Id instead of the alias listed on his account.
I tested this by sending an email to myself using myid#facebook.com and myalias#facebook.com. The ID failed to send while the alias sent and was received with no issues.
Ideas?
Thanks.

Some people can receive mails from both ID#facebook.com and ALIAS#facebook.com, and some people cannot receive ID#facebook.com with an mailer error saying that it's not in their address book.
I wasn't able to see any pattern here, it was random. Not sure this is an error or a spec.

Related

Get all email addresses from GMAIL with whom I exchanged emails

I want to get email addresses from my account with API. I can get those emails from my contacts, but don't succeed to get those emails who are not in my contacts, but I had email conversations with them before. From where I can get any doc or information how to get that information from API?
I think your only option is going to be doing a user.messages.list loop though each message and run a user.messages.get and check the sender email address.
The API doesn't return the the information you are looking for. You could also just start adding these people to your contacts.
Its an interesting idea you may want to submit it as a feature request. Issue tracker

how can I send emails from facebookmail to my app users?

i would like to send my app users an email from Facebookmail, i have received such email from another app and i would like to do the same for my app users.
the email I have received was from this sender
"apps+kr4m4XXXXX5x#facebookappmail.com"
can someone please advise how it can be done? ( I'm aware that i can send them email directly but im looking to send them directly from facebookmail..?)
* another point to mention is by clicking "unsubscribe" link on the email - this is the link :
http://www.facebook.com/n/?editaccount.php&notifications&block=376XXXXXX2389556&t=1366XXXXX53&l=b&mid=7ddd6d3G5af3eff255b6G0G27&bcode=1.136XXXXX853.AbkyMvZyA7-3FDDD&n_m=my_email#url.com
therefore I'm pretty sure it can be done....
anyone???
** ( the XXXXX i added in order not to recognize the sender )
Thanks
You Can use the REST API which will be deprecated. Unfortunately it's not possible to send emails via Facebook through GRAPH API.
https://developers.facebook.com/docs/reference/rest/notifications.sendEmail/
the link above is broken
it looks like this
https://api.facebook.com/method/notifications.sendEmail?recipients=USER_ID&subject=YOUR_SUBJECT&text=YOUR_EMAIL_BODY&callback=YOUR_CALLBACK_URL&access_token=YOUR_ACCESS_TOKEN_HERE

Tracking email responses

What is the best way of tracking responses for email campaigns? I was thinking on adding something to the reply-to field of the email (for example luqita+campaigns#stackoverflow.com), but I'm not sure if there is something more neat that could avoid this?
I thought about headers too, but it's important to note that the address luqita#stackoverflow.com would send many different campaigns, and the 'in-reply-to' header info would not be useful then to differentiate (while using luqita+campaign1 or luqita+campaign2 could)
What can I do?
So you want to be able to execute some logic when someone replies to an email you have sent through SendGrid? If you have access to change the MX record of the domain of the email address at which you want to receive the replies, you could use SG's Parse API to get a POST request to a script whenever email is receive at the address.
I think you would indeed have to set a magic reply-to address for each campaign. This seems like a perfectly fine solution; it's also how SG itself tracks bounces - it sets the return-path to something like bounces+{attempted-recipient-email}#sendgrid.com. Then examine the 'to' parameter of the POST notification you receive to know which campaign the reply is associated with.
When you say "tracking responses", do you mean that you expect users will reply to the Email, or do you mean that they'll click on a link in the Email and interact with a web site?
SendGrid obviously offers click tracking and open tracking, and you can set up to 10 different categories for tracking campaign stats and see delivery/bounces/opens/clicks/etc based on those categories. They also have a Google Analytics plugin that can feed back some analytics data to Google. And as #LinusR mentioned in his answer, the SendGrid Parse API can be set up in a way that reply Emails can get parsed and posted back to your site.
If the user will be interacting with your web site, you can use the "unique args" setup at SendGrid to set a unique string/hash to append to any URLs that can help identify a particular user, campaign, or whatever else you want to track.

Having difficulties with Notifications.sendEmail from the Facebook API using PHP

I'm trying to send an email through the Facebook API. I've added the application and given it the email extended permission. I've been following the instructions at http://wiki.developers.facebook.com/index.php/Notifications.sendEmail and am using their sample code (albeit with correct userids in place of the ones they list):
$uids = array(12345,67890,13579);
$csv = implode(",", $uids);
$result=$facebook->api_client->notifications_sendEmail($csv,"Test: this should appear in the subject", "This should appear in the body (plain text)", "Test: <b><i><u>this should appear in the body</u></i></b> (HTML)");
echo "sent to $result targets of ". count(str_getcsv("$csv",",")) . "total.";
The api call returns no errors, but $result is empty indicating none of the emails were sent (confirmed by the emptiness of my inbox). I have tried this in and out of sandbox mode. Asking facebook for contact_email, proxied_email, and email, all return correct results. Attempting to send an email to the address returned by proxied_email does NOT result in an email being received.
I've also tried sending normal notifications and adding news items to the dashboard, both of those work without problem. I'm not sure what application setting or configuration I am missing. Any suggestions for troubleshooting would be very much appreciated.
Facebook is transitioning away from the ability to send emails via an API call on Mar. 1st. To compensate, they allow apps to now ask for a user's email address directly.
If you set the email domain in your app's settings, then asking for the email extended permission gives you the users email address instead the ability to send an email via the API.
As of Mar. 1, the API will stop working and you are left alone to figure out your own email solution. This goes for regular notifications, both user to user and app to user, as well

Facebook proxy email not arriving -- do I need permissions?

I'm building a website that allows user to connect using Facebook Connect. So far I'm able to log the user in and fetch data about them (name, email, pic, etc.). If I fetch the email (using Users.getInfo) I get a proxied email (apps+blahblah#facebook.com), which is absolutely great. Problem is, that email doesn't work. I've tried sending an email to it and I never received it. There are two reasons I see that could cause this:
I don't have enough permissions. Ok, I can understand that, but if I don't have enough permissions then why are they returning an email at all?
The email has to be somehow sent from the application itself (I've tried sending it from my Gmail account) -- but how would Facebook know that the email is coming from the application?
So which is it? Or is it something else?
I have recently been looking into this as well.
I did find some guidelines on http://www.insidefacebook.com/2010/01/15/facebook-platform-email-sharing-api-proxy-email-service-going-live-in-5-days/
here is the most important part:
Emails you send must clearly indicate that they are from you and must not appear to be from Facebook or anyone else. For example, you must not include Facebook logos or brand assets in your emails, and you must not mention Facebook in the subject line, “from” line, or body header. All emails to users must originate from the same domain, and you must provide us with the name of that domain in the Facebook Developer application used to manage your application.
I have already found that if you do not have the address in the from as #facebookappmail.com
might even have to be appname#facebookappmail.com the emails will bounce. So sending from your gmail will not work, the "blah blah blah" in the proxy contains the application information of the application that had the permissions to get that email.