Firebase notification with Javascript

Asked

Viewed 162 times

1

Greetings! Well, I’m developing a Firebase-based project that uses many functions coming from it, such as Firebase Realtime Database to save data and refer to it when necessary, Firebase Authentication for login, and even Firebase Hosting for website hosting. Since the main function of the project is based on the Firebase Cloud Message, since the objective of the system is to solve problems in communication between the tenants and the employees, in this case the porters, of a condominium, since it was noticed the occurrence of certain confusions in the process of delivery of orders required by the residents, who often passed by the concierge and arrived late in the hands of the residents or, sometimes they didn’t even get to the ones who made the order.

Thus, one way to solve the problem mentioned would be to implement a system that would allow the employee to send from his workstation, that is, from a website, a notification to the resident who was waiting for the order, in this case, this notification would be received by the application on the resident’s mobile. However, that’s the problem, because since Firebase Hosting only supports static pages (.html), I can’t use, as far as I know, any language other than Javascript to send the site notifications, through a simple form that allows the employee to pass the title and the message itself to the user in the application. Thus, I would like to know if there is any way to get Javascript to contact the Firebase server and send the message through the site itself, that is, through a function triggered from the sending of the form, to the application. Once I searched deep into the Firebase documentation, I still couldn’t find another way to send notifications other than via the Firebase console.

I hope I’ve been clear and I thank you for your help!

  • Hello here is the documentation regarding the sending of messages using javascript on your page: https://firebase.google.com/docs/cloud-messaging/js/first-message?hl=pt-br But I recommend using Firebase Cloud Functions and that you have a record in the firebase Realtime database with users' tokens Here is the documentation for the Cloud Functions environment: https://firebase.google.com/docs/cloud-gingmessa/js/first-message?hl=pt-br More about cloud functions: https://firebase.google.com/docs/functions/use-cases?hl=pt-br#notify_users_when_something_interesting_happens

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.