-2

I want to create an automatic email notification system to notify my existing users every time his/her facebook friend registers/joins my website. I see a lot of these type of email notifications from major websites such as Pinterest. i.e. "Your friend OOO has also joined Pinterest!' Can anyone tell me how I can do this as well? Thanks in advance!

  • Well, you have your existing user’s email and FB user id, and when a new user joins your site you comapre their friends to the user ids saved in your database – where’s the _actual_ problem? – CBroe Mar 04 '13 at 14:23
  • problem lies in my website/server actually sending the email to the user automatically every time his/her fb friend joins the site. I basically repeated what I wrote. Did you read? – Mikey J Lee Mar 04 '13 at 14:32
  • "you have your existing user’s email and FB user id, and when a new user joins your site you comapre their friends to the user ids saved in your database" Of course. But I don't want to manually send my users emails myself, you know... that would be too much work. – Mikey J Lee Mar 04 '13 at 14:34
  • And what’s the problem with sending an email automatically? User joins, script looks up friends in database, sends email. – CBroe Mar 04 '13 at 14:35
  • Ok.. Easy to put it in words. Please explain how? I wouldn't be asking questions if I knew how to do that. – Mikey J Lee Mar 04 '13 at 14:39
  • If you want to develop something, you have to acquire the necessary basic knowledge first – so go do that, please! – CBroe Mar 04 '13 at 14:43

1 Answers1

2

Here's quick and dirty solution:

When user joins your website, you should ask him to let your app on Facebook access his/her basic info,email and friends. When you have access to that information, just save the list of user's friends in database. When new user joins, check database for his/her id, and if you found it, check who's friend it is and send the email.The solution isn't perfect, it gets really heavy when there are a lot of users.

Darvex
  • 3,624
  • 2
  • 23
  • 39
  • (Sorry if this is a dumb question. I'm a total noob) Is that how pinterest works also? Like for example lets say theres this guy who has 500 friends who are already using my site. And my auto email sends 500 emails to those friends when this guy joins in... would that work? With nothing more than just PHP? – Mikey J Lee Mar 04 '13 at 15:09
  • I have no idea what is ponterest and how it works i'm afraid. This is just the quick solution i've got to offer. But yeah, that's about how it works (details are up to you). The key here is to get the list of friends of each user and then save it in database. When new user joins you check who are his friends on your web and send them email. And yes, it can be done with plain PHP + SQL – Darvex Mar 04 '13 at 15:12
  • Of course my website is nowhere near that kind of userbase... im just asking if this is really as simple as you guys say: check the user's friends' id, compare it to the database's ids.. send email to matching ids - cuz I thought it just wasn't going to be that simple. – Mikey J Lee Mar 04 '13 at 15:15
  • ah okay. Thanks I'll try that first and see what happens – Mikey J Lee Mar 04 '13 at 15:17
  • Yea your 'quick and dirty solution' works pretty well with small number of users :) Any hint on what to do when there are lots of users? I don't have that many users yet but I'd still like to know. – Mikey J Lee Mar 05 '13 at 00:23
  • Well, the bottleneck is part where you need to find who are user's friends on your web with this solution. So you would need to optimize your database structure, use indexing and whatnot to make the process quicker. Or, of course, try and think of another solution :) – Darvex Mar 06 '13 at 06:58