Skip to content

How to define specific action on notification or in app primary button tap(open url, deeplink)?

Alexander Boldyrev edited this page Oct 31, 2024 · 2 revisions

Supported on React Native since version 2.2.2.

Available actions:

  • Opening of the external web content in webView
  • Opening of the external web content in device browser
  • Opening of particular mobile app screen over deeplink

To set up action via Broadcast or Flow choose "Mobile Push" channel and specify action button properties:

  • Action: Choose from the list
  • URL: Provide required URL or deeplink

Also, you can set up action for push or Mirror push notification using API by specifying notificationOptions.primaryButtonAction

Implementation of action handling within the application

Opening of the external web content in webView

Will be opened automatically without additional coding for both iOS and Android platforms, to customize UI of the view you can use following approaches:

  • iOS - provide webViewSettings inside ios in configuration, while initializing MobileMessaging.
mobileMessaging.init(
{
      ...
      ios: {
          ...
          webViewSettings: {
              title: "Title", //Custom title
              barTintColor: '#ffffff', //Toolbar color
              titleColor: '#000000', //Toolbar title color
              tintColor: '#000000', //Toolbar button color
          },
      },
},
() => {
  console.log('MobileMessaging started');
},
error => {
  console.log('MobileMessaging error: ', error);
},
);

Opening of the external web content in device browser

Will be opened automatically without additional coding for both iOS and Android platforms

Opening of particular mobile app screen over deeplink

How to use "deeplink" to land user to a particular app page?

Message object

message object will contain following fields, depending on action, which is used.

message: {
    ...
    browserUrl: <string, url to open in browser>,
    deeplink: <string, deeplink url>,
    webViewUrl: <string, url to display in webView>,
}
Clone this wiki locally