N
Novu5mo ago
Puvi

Sending Deep Link Push Notifications with Firebase Cloud for iOS and Android

How can I send push notifications with deep links ? I'm using Firebase Cloud as provider. going to use /v1/events/trigger/broadcast to trigger workflows for both iOS and Android Please help me on this, Thank you!!.
4 Replies
Prosper
Prosper5mo ago
Hi @Puvi Handling deeplinks depends on the technology you are using while receiving notificatons from Firebase
Prosper
Prosper5mo ago
class _Application extends State<Application> {
// In this example, suppose that all messages contain a data field with the key 'type'.
Future<void> setupInteractedMessage() async {
// Get any messages which caused the application to open from
// a terminated state.
RemoteMessage? initialMessage =
await FirebaseMessaging.instance.getInitialMessage();

// If the message also contains a data property with a "type" of "chat",
// navigate to a chat screen
if (initialMessage != null) {
_handleMessage(initialMessage);
}

// Also handle any interaction when the app is in the background via a
// Stream listener
FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage);
}

void _handleMessage(RemoteMessage message) {
if (message.data['type'] == 'chat') {
Navigator.pushNamed(context, '/chat',
arguments: ChatArguments(message),
);
}
}
class _Application extends State<Application> {
// In this example, suppose that all messages contain a data field with the key 'type'.
Future<void> setupInteractedMessage() async {
// Get any messages which caused the application to open from
// a terminated state.
RemoteMessage? initialMessage =
await FirebaseMessaging.instance.getInitialMessage();

// If the message also contains a data property with a "type" of "chat",
// navigate to a chat screen
if (initialMessage != null) {
_handleMessage(initialMessage);
}

// Also handle any interaction when the app is in the background via a
// Stream listener
FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage);
}

void _handleMessage(RemoteMessage message) {
if (message.data['type'] == 'chat') {
Navigator.pushNamed(context, '/chat',
arguments: ChatArguments(message),
);
}
}
The onMessageOpenedApp Firebase method is called and the handler takes care of redirecting to a page/activity in the app depending on the notification message
Puvi
Puvi4mo ago
How to send links from novu while triggering workflows ? { fcm: { data: { "key" : "value"} } } above Json format is working for me, we need to use this in Overrides field Thanks for the support @unicodeveloper