[SalesForce] Cannot redirect to a WEB URL from push notifications

We need to build a push notification that redirects to a web link when you click it. Anyway, when I create a push notification from the content builder, I have an option to select an open behavior, so I choose "Go to Web URL" and enter the URL:

enter image description here

When I receive the message on my phone (one plus 6 if it matters) and click it, it redirects me to the app, and not to google.
How do I fix the redirection behavior of my push notification? thanks.

Best Answer

While Zak's answers isn't incorrect, it does require a bit more discovery once you click the links he provided.

To be specific to the original question, in the Android SDK you will need to provide an implementation of the NotificationLaunchIntentProvider during the initialization of the SDK. In this implementation, you can build out the PendingIntent that will be used when the notification is clicked. For push messages containing OpenDirect URLs you can return something along the lines of:

PendingIntent.getActivity(
  context,
  requestCode,
  Intent(Intent.ACTION_VIEW, Uri.parse(notificationMessage.url())),
  PendingIntent.FLAG_UPDATE_CURRENT
)

However, as a security best practice, I would suggest that you check the URL in the notification and make sure it is whitelisted for your application.

More details on using the NotificationLaunchIntentProvider and how to provide one during SDK initialization can be found here: https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/notifications/customize-notifications.html

Related Topic