Search through all our blogs and become a FlutterFlow expert in no time! We cover all things from beginner to expoert.
Sending notifications in FlutterFlow using Firebase is straightforward with the built-in “Send Notification” action. However, for more advanced control, such as sending notifications based on specific parameters, at scheduled times, or between multiple apps connected to the same backend, you need a more sophisticated system. This guide will walk you through setting up an advanced notification system using API calls and Cloud Functions, providing you with the flexibility and control you need.
Imagine you have an Uber-like system with separate apps for drivers and users. When a driver accepts a ride in the “Uber Driver” app, the user should receive a notification in the “Uber” app. The built-in notification system in FlutterFlow doesn’t support this cross-app communication, but with this advanced setup, you can achieve this seamlessly.
FlutterFlow’s push notification functionality is essentially a Cloud Function triggered by a document insert into the “ff_push_notifications” (or “ff_user_push_notifications”) collection. Here’s how you can replicate and enhance this setup.
The function could look something like this (the function below isn’t the complete function):
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.sendNotification = functions.https.onCall(async (data, context) => {
const { userId, title, body } = data;
await admin.firestore().collection('ff_push_notifications').add({
userId: userId,
title: title,
body: body,
timestamp: admin.firestore.FieldValue.serverTimestamp()
});
return { success: true };
});
By integrating Google Tasks and Cloud Functions, you can automate the entire notification process. Personalize the content based on user data, schedule reminders, and ensure that notifications are sent even if users are not actively using the app. E.g., if a user starts an order but doesn’t finish it, you might want to remind them in 15 minutes.
Use Google Tasks to manage and schedule notifications. Your Google Tasks might look something like this:
These are all queued up to be sent at specific times. When the time comes, these functions trigger a proxy function, which is just a function that does the same thing but are “onRequest” functions, not “on Call” functions.
Conclusion
Advanced notification systems in FlutterFlow provide the flexibility and control needed for complex applications. Whether you need cross-app communication, scheduled notifications, or personalized messages, this setup allows you to manage notifications effectively. Our marketplace item includes a fully functional implementation of this system, ready to be implemented in to your app!
Sed at tellus, pharetra lacus, aenean risus non nisl ultricies commodo diam aliquet arcu enim eu leo porttitor habitasse adipiscing porttitor varius ultricies facilisis viverra lacus neque.