Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to globally set up alerts for when a Firebase location is changed

One of the things I'm using Firebase for in my app is to store user-submitted feedback - using push() to add children to a location. Ideally I could receive an email whenever a new child was added to that location, but this could only be done directly by some Firebase service, or perhaps somewhat indirectly by some Firebase service that could hit a URL (containing a tiny script that emails me), but I can't find any mention of either ability.

One thing I can think of is something like a little Node.js server constantly running and listening to that reference with on('child_added', cb), emailing me when something changes. I'm using Firebase to try to build this app without having a server, so I'd rather not have to do that. I'm thinking of just having a cron job on my personal computer that periodically checks the location over the REST API. Any better ideas?

like image 701
tobek Avatar asked Dec 25 '13 04:12

tobek


2 Answers

The easy solution is to use a third-party service. Firebase has really great integration with Zapier. This service allows you to easily integrate Firebase with tons of different services and technologies without writing any code. One of these technologies is email. You can create a "zap", for free, which will run on their servers and automatically watch for new children of a Firebase path then send that child's information to you as an email. It's only takes seconds to set up and you don't have to write a line of code.

like image 137
Abe Haskins Avatar answered Nov 03 '22 21:11

Abe Haskins


Unfortunately Zapier can no longer use firebase as a trigger. That said you could setup a Firebase cloud function using Node.JS. There is a pretty good list of sample functions here: https://github.com/firebase/functions-samples

like image 37
D-Sims Avatar answered Nov 03 '22 21:11

D-Sims