Support Channel By Joining Patreon and get Access to Exclusic Content
/ flutterflowvip
Code - https://flutterflowvip.notion.site/On...
In this video, we will learn how to send notifications using Supabase and OneSignal with Edge Function on your FlutterFlow app or any app that uses OneSignal SDK.
In the demo, we have a table called "Notification" where we add a new row with details such as Title, Content, and Big Thumb (image URL). After adding the row, our device instantly receives the notification.
Similarly, in a FlutterFlow app, we add a new post with a title, description, and image, and again, we receive the notification on our device without any delay. We don't need to do anything from the app; it automatically triggers the notification by adding a new record to the table.
To set up this functionality in your Supabase project, first, you need to setup the OneSignal SDK in your FlutterFlow app. After that, create a new table called "Notifications" with columns for Title, Content, and Big-Image. All field types should be text.
Next, we create an Edge Function for triggering the notification. Install the Supabase CLI and initialize a new project. Then create the Edge Function and replace the function code with the provided code in the description. Deploy the function to your Supabase project.
To trigger the function whenever a new record is added to the Notifications table, create a webhook. Enable webhooks, name your webhook, select the table as "notifications," enable the insert event, and add the authorization header with your Anon Key.
Now, whenever you add a new row in the Notifications table, a notification will be triggered to your apps automatically. This method eliminates the need to manually add notifications to the OneSignal dashboard.
In future videos, we will cover how to target specific users for specific events or segments using Edge Function. We are also working on a codeless solution for creating Edge Functions, so stay tuned for that.
Subscribe to the channel and enable the notification bell icon to stay updated with the latest videos. If you have any questions regarding FlutterFlow, Supabase, or OneSignal, feel free to ask in the comment section.
Keep building awesome apps!