How to setup push notification with supabase in flutter? - flutter

I had just replaced my app with supabase from firebase in flutter app.
Firebase has firebase_messaging that provide push notification to device token.
Is there any facilities to create function in supabase and send notification to selected user with device token while changing in database.
If yes than please suggest some function else suggest some method to send notification.

Supabase does not provide a mechanism to send push notifications at this point, so you can use FCM or other push notification sending services to send them out to the users.
If you are going with FCM, you can setup your own backend using Firebase cloud functions or other backend service that you prefer to send the notifications from.
Typically, you would want to send push notifications to your users when there is some kind of change in the database, like when there was a new message sent or someone liked a post. You can listen to these events using Supabase database webhooks. With database webhooks, you can send your backend a request whenever you receive certain data change happening in your database.

Related

how to send local notifications when app is terminated in Flutter

I want to implement local notifications in my chat app, that whenever User A send message to User B then I want to send notifications,, it is possible to send local notification when the app is terminated,, As you know guys firebase functions are paid so I am trying to work with local notifications...
Thanks in advance

Can I send fcm notifications to Firebase UserIds instead of device tokens?

I see examples where you have to extract device tokens and store them in a db to be able to send notifications to that device.
I wondered if I could use Firebase user ids to send a select list of users notifications skipping the need for tokens?
No firebase is not support to send notification using userID.
You have to integrate FCM package for getting token if firebase using below link :
https://pub.dev/packages/firebase_messaging
After getting token then only you can use this token and send the notification.
Other way of sending notification is the topic.
For topic i am giving you below link :
https://www.filledstacks.com/post/push-notifications-in-flutter-using-firebase/
No, you can't. You need to implement a custom notification sender from the firebase cloud function to send by user IDs. But you can't ignore the FCM tokens. You must register a valid FCM token of the user's device to trigger per device notification. Check the following guideline:
FCM Push Notifications for Flutter

Sending push notifications when a user likes your post like Instagram

I'm practicing Swift programming by trying to build Instagram for fun. I am using firebase as my database. I was able to set up the activity page where it shows a user has liked/commented on your post.
Now I am wondering how can I actually send a push notification when that happens? I tried using FirebaseMessaging but all I can really do is send messages from firebase directly.
How do I send a specific user a push notification that someone has liked their post?
You can try using Firebase functions. Here are the basic concepts:
To receive notifications, user must subscribe to a "topic" using subscribeToTopic(String topic)
Whenever a post from that topic is created, you use firebase messaging to send message to that topic
To do that, you need to host a function to firebase. That function listens to new posts being posted at whatever node you are using
Everytime a new post is written to that node, it sends the message
Here is the link to the of an example Firebase Functions Example (the function to be hosted is sendNotificationToLocation).
Check this on how to handle subscribing/unsubscribing and handling message/notification Firebase messaging
First do the all configurations for Firebase Cloud Messaging.
Then get firebase registration token of the user whom you want to send a push notifications to.
follow this link for detailed explanation

How to correctly implement push notifications using Gmail API

I've done all steps required and I'm successfully receive push notifications on my server endpoint. I want to get message text snippet and sender to be displayed in push notification but this requires a call to history API with valid user token. Moreover I want to filter this to push only new messages not all Inbox activity. In what way should I do this to provide safe experience. Should I store Gmail auth tokens on serverside and make calls from there and then push a notification with proper message data to users ? Is token storing and handling proper and safe on my server ? Or maybe there is another way ?

Implementing Apple Push Notification without an access to a source server

I'd like to implement some push notifications from Twitter in my app. I can connect to Twitter's stream of user-related events using Sreaming API. Do I need some 'middleman' server between Twitter API and an iPhone app in order to push a notification to an app ? Maybe I can do it using Parse.com Cloud Code or something similar ?
This question may be helpful not only in the case of the Twitter API but also in case of any server that a developer don't have any access to.
To push a notification you would generally need a server of your own which has been configured to send a notification when some event occurs. If you are using Parse as a backend for your app, you can leverage their backend to allow you to implement Push Notifications or use a service like UrbanAirship
In the case of the Twitter API, you will need to implement some middleman in either case to get the data from Twitter for your user and parse it to see whether some event has occurred and then send off a notification either using your own custom logic directly to Apple's servers or using Parse or UrbanAirship (or some other service)