0

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.

5

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

| improve this answer | |
2

You need to have OpenDirect configured in your Mobile App to be able to redirect to External Web URLs.

This is done by enabling the functionnality in the Mobile Push SDK for your APP.

Documentation for Android : https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/sdk-implementation/url-handling.html

Documentation for iOS : https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/push-notifications/opendirect.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.