Get specific data from firebase and send notification

Hello, Is there a way to retrieve specific data from firebase and send a notification whenever a new entry in that firebase tag is made?

A python script is sending this data to firebase whenever there's an error. SO I'd like to retrieve the actual warning "its time to take your medication" and turn it into a notification to send to the user.

Can anyone help with the blocks please?

Getting the data from firebase should be straightforward enough:

Not used any notification extensions, so cannot help there.

If you only need a notifier, then set the web1.GotText to a message dialog.

Thank You,

the extension I want to use is Simple Notification Extension.

I have no blocks for it because I was unsure where to place it, I want the notification to be sent automatically if firebase gets a new entry and not based on a button being pressed.

Where should I put that block? when the screen is initialised?

You probably want the dataChanged event from the Firebase component. This may work.

Okay I will try and let you know if it worked, Thank you

Hi what was global fbUrl initialised as? and does the global fbUrl tag have the warning text in it?

Like this:

image

Yes but what would global fbUrl be initialised to? Is it the firebase link?

Yes, it is what you would place here with the firebase component

image

1 Like

I've tried the blocks above but I didn't get an alert when I manually added text to the Alerts tag in firebase. Did I miss something you mentioned?

Two things:

  1. You included .json at the end of your tag

This is not required, or in the blocks I showed you. Remove .json

  1. You may need to set data to Firebase from your app in order to activate dataChanged. You can just send a dummy tag/value to do this.

I have tried and I do not get any alerts in the app.

Should I have implemented the web.got text as well?

This should not be required

What is your ProjectBucket set to? It should be the node above Automatic_Pill_DspenserAlerts ?

Have you made any changes to the data in the console ?

Have you tried to change the message, a data change is required to trigger the dataChange event?

Just run a test, seems dataChanged cannot cope with a path to a tag, try like this:

No luck using that method either. I did it like you had it at first then I set the project bucket and still, no alerts shown

I will have to assume (without any other information) that your tag Automatic_Pill_DspenserAlerts is below your project name: automaticpilldispenser-bc076-default....

Make the following adjustments to your blocks

Remember data needs to change in order to trigger the dataChanged event

It worked! Thank you so much.

Do you think it would work with this extension Notification so the alerts can be received when the app is closed?

Why not try it and see?

It worked, Thank you so much for the help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.