How can I redirect to a specific place in my app when I send a push notification?

Database & APIs

Hello everyone, I have developed two apps from flutterflow and both share the same database made in firebase. One app is the administrator and the other is the mobile app. I set up a cloud function in which it listens when a new document is created within the publications collection, in this way when I make a new publication from the admin, the push notification arrives to the mobile app, the push notification is sent with this cloud function.

After doing some research I managed to implement this, which is what sends the notification

const message = {

notification: {

title: "This content is of interest to you", // Modified title

body: ${postTitle}, // Body of the notification with the title of the post

},

data: {

link: redirectUrl, // Redirection link

}

};

const response = await admin.messaging().sendEachForMulticast({

tokens: tokens,

...message,

});

As you can see in the data, I am attaching a link which takes me to the specific post. But this does not work, when I press the notification the link is not taken into account. How can I make it take the link into account and when I press the notification it sends me the same link and not to the home page or by default.

What have you tried so far?

I tried to implement this

const message = {

notification: {

title: This content is of interest to you,

body: New post: ${postTitle},

},

data: {

link: redirectUrl, // Redirect URL for Android and iOS

},

webpush: {

fcm_options: {

link: redirectUrl, // Redirect URL for the web

}

},

android: {

notification: {

click_action: "FLUTTER_NOTIFICATION_CLICK"

}

},

tokens: tokens

};

But it stopped sending the notification

Did you check FlutterFlow's Documentation for this topic?
Yes
1