0

I am working on a project that's supposed to send notifications to it's users when current date is equal to a given date specified by the user. So which firebase-function method is best suited for such kind of application: onUpdate, onWrite, onCreate or https.onRequest?

Note: the app or firebase-function should always check and compare the currentDate to the dates of every record in the database and send notifications if they match.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
Mitch
  • 1,556
  • 1
  • 17
  • 17
  • on what operation do you want to send notification? or who is updating given date ? – rijin May 23 '18 at 12:00
  • The app user the one to update information. For example, the user should be able to set an "alarm" on which he/she will expect to be notified when the date and the time reaches – Mitch May 25 '18 at 21:43

2 Answers2

2

If I understand correctly that you want to regularly check if today's date (i.e. current date) is equal to a specific field date of one or more records in the database, you could indeed call a dedicated Cloud Function via an HTTP Request every day with an online CRON job like https://www.easycron.com/

You would then, in this Cloud Function, make a query to retrieve all records having this field equal to today's date and send a notification to the user.

If you give more details on your database structure and on the code you have already written, the community may be able to help you further.

PS: look also this answer from Frank van Puffelen: Cloud Functions for Firebase trigger on time?

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
1

I think I got a better site for this. Please try https://cron-job.org/en/. It's free and works / worked fine for me. Thanks to everyone who spared there time to check out and possibly try to answer this question.

Mitch
  • 1,556
  • 1
  • 17
  • 17