I have an app that allows users to invite their friends through Firebase Invites. I'd like to give invite senders rewards, but only if their invitation has been accepted and not just sent. Does Firebase support such functionality and if not, what would be the best/simplest approach to implementing it yourself?
1 Answers
It'd be pretty easy to do yourself, assuming you have a little bit of backend logic in place. You'd want to add some data to the outgoing Invitation that would link it back to the original sender. The recipient client could then extract that data and send it down to your database, which could then reward your original sender.
What data would you send with the invitation? It depends. One option would simply be to add the sender's userID to your invitation data. That's easy, but it leaks the sender's userID which may or may not be what you want. Another way might be to generate a referral code that's associated with the user, but isn't their ID (think about your typical Uber or Lyft referral code). A third way would be to ping your backend and generate a unique invitationID that links to the sender and the reward itself. Personally, I like this last option best because it also means that this URL is a lot more resistant to spoofing.
Good luck!

- 16,875
- 4
- 42
- 40
-
@Todd Kerpelman is it secure and reliable such that I can guarantee that no one can reward himself even when knowing my APIs? – Hamzeh Soboh Jan 09 '17 at 10:18
-
Actually there is a pretty good tutorial on Firebase about it: https://firebase.google.com/docs/dynamic-links/use-cases/rewarded-referral – Alexandre Nussbaumer Oct 05 '18 at 21:56