Need to call functionality based on FCM Notification, without user interacting with Notification bar

Hi Guys,

My requirement

In my ionic App i have a function which should be triggered when i receive Notification from server.

Tricky part comes now, when i receive notification weather App is in background/closed it should trigger the function in App. Without user tapping the notification bar.

How can i achieve this. Do we have other way/plugins which may help my requirement.

Kindly suggest

Thank you.