Actions on google Notifications at certain time - firebase

Hi I found following tutorial
https://developers.google.com/actions/assistant/updates/notifications#dialogflow
And I was wondering if you can somehow also just trigger a notification after a certain time with a cloud function. Cause I do not want send them a notification when the user opt in, i want to send that notification after X minutes.
You have any idea how?

You can use Cloud Tasks to schedule some code to be run at a later time.

Related

How to schedule an update/notification using firebase cloud functions with dynamic frequency?

I have an app, where I have an admin and a customer.
Admins can invite users that are in a line.
Admins can configure maximum waiting time for which a customer should show up after he gets invited.
If he does not show up in specified period of time I need to update the database to set the status of a customer's ticket to "no-appearance" and send notification to a customer.
How can I do that using firebase cloud functions?
It looks like I cannot setTimeout because functions are limited to 540 seconds and it is not applicable in my case.
Looks like Pub-sub functions can only be created with a specific period which you have to determine statically
You can use Google Cloud Task to send a scheduled job to trigger cloud functions. Here an article about that: https://medium.com/swlh/event-driven-scheduled-jobs-using-gcp-cloud-tasks-e712c760ab95
The difference of a Pub/Sub is that you can send a task with a dynamic schedule and that task runs only once.

I want to schedule fcm notification for specific user when he add a task to database, flutter

Actually what I am working on a to-do task manager app. Currently I am adding tasks to cloud Firestore after as a new document. I want to send notification to user at the time user scheduled to do that work. I am so confused. It can be lots of tasks from a single user. And the the notification tone has to be selected by user itself.
Please help me in this..
Thanks you!
So you'll need:
A database where you keep the notification payload, user FCM token, and the time they are to be sent.
A schedule Cloud Function that runs every day or every hour based on the granularity of the task.
Now, when the Cloud Function gets triggered, it:
Runs a query against the database for notifications that are scheduled to be sent before the current time
Loops over the results send each notification in turn.
You can now delete the database entry if you want to.
Furthermore, if you want to reduce the number of cloud function triggers, you have a combination of the FCM and an alarm manager to show a notification after a delay (feasible in flutter through local notifications too). this way you can send the payload at a particular time of the day and deploy it at any time locally.
Not sure how optimized this is, looking for better ways!

React native push notification getting data from API

I'm new to react native and I need some help.
I need to implement a feature that the application informs the client if it has an appointment on the day and if it does, notify him, if not, not notify.
However, I believe that the application needs to check in the API if it has any scheduling and if it has to check if it is on the scheduling day and if it is, send a notification to the client
Correct me if I'm wrong
I'm using react-native-push-notification
But I can't make the logic for this to happen, I can offer my code so they can help me
Suggestion:
You can opt to go with the react-native-push-notification with firebase so that You can able to send the push notification whenever you want through the blackened.
Firebase documentation:Cloud Messaging

Dynamic Push Notifications

I know that Firebase has recently added support for Push Notifications and while this is a great thing, I only seem to be able to send push notifications manually via the Notifications Panel.
What I'd like to do is to send push notifications within a user scope...Let me explain that. Each User in my App has an account and then each user can join a group. Within this group the user can perform tasks and has a list of chores to do. Now when certain tasks are due for example I want to remind the user of doing it with a push notification. For 1-10 I might be able to pull this off manually, but is there a way to dynamically based on the data in the Database send out Push Notifications?
I know that certain Push Notifications can be created using the Analytics tool such as "Hey you have not visited for 3 days, please come back whatever"... but I'd like to register push notifications such as "I just created a task, this task needs to be done within 3 days. Remind me in 3 days if the task is still not done".
Is this possible with Firebase or do I need to have my own server connecting to Firebase and handling those events?
-xCoder
You need to implement FCM in your client and in a server. Let me put this straight:
First, you need that your client, or app, to register into FCM and get a FCM token that will be used to identify that device uniquely.
Then, store that token wherever you like. It can be into firebase database or other server you may like. I recommend you to store it into firebase if you are using it as a database for your users; that's my case.
Also, you need to implement a http or xmpp server in order to send FCM messages to your registered devices containing the data you are interested in. For example, you can implement a Google App Engine endpoint (can be done with Android Studio and Java) that is quite simple or a NodeJS module, depending on your preferred language.
If you are using Firebase as database you can connect from your server with the appropriate SDK and get the FCM tokens you want from your users, and then send the message to those with data. Don't forget to secure your serve.
The way you implement your server algorithm to send FCM messages depends on your app purposes.
Hope it is clear enough for you. Also you can find all the documentation with a short video that explains the general structure here: https://firebase.google.com/docs/cloud-messaging
You can use cloud functions to trigger on any create, update or delete operation in your database and in the trigger event, you can choose to send in FCM push notifications to the devices of your choice.
Here is the documentation regarding the use and structure of a cloud function: https://firebase.google.com/docs/firestore/extend-with-functions
Hope this helps!

Send Push Notification every time Data Browser changes

I have a chat that uses Parse.com to store messages.
How can I send a Push Notification every time a row has been added to a custom class called Chat? Is there a proper way of doing this?
You should check out parse.com cloud code guide, specially the part: Performing actions after a save
Also check out the send push notifications section.
Basically you can setup a method to be triggered everytime a chat is saved. This code will run automatically on parse servers.
Simply call the send code when you add your row.
There are a lot of tutorial about sending push notification, especially with a chat as example.
For example here : http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Self-Edit : Fixed bad link

Resources