Open a URL from a Push Notification

To open a URL from a Kahuna Push Notification, you need to add code to your push receiver to process the URL from within your application.

This is implemented in the following ways for iOS and Android operating systems:


  • Implement the KahunaDelegate, and specifically the selector:
- (void) kahunaPushMessageReceived: (NSString *) 
message title: (NSString *)title withDictionary: (NSDictionary *) extras withApplicationState:(UIApplicationState) applicationState;
  • The deeplink and/or message metadata are passed to the delegate as a dictionary of key/value pairs
  • If metadata was defined in the campaign as key value pairs, coordination with the app developer needs to happen so that the app can properly handle the provided metadata. The app can process the info and navigate the user to the requested page.
  • Another option is if the mobile deeplink url was filled in during campaign creation. If so, the deeplink url will be stored under the key ‘k_url’ within the extras dictionary passed to the delegate
    • For example (key/value pairs):
      [extras objectForKey:@"your_custom_deeplink_key"]
    • For example (mobile deeplink field):
      [extras objectForKey:@"k_url"]
  • If the deeplink is in the form of a URL, the app should use the following iOS APIs to launch the user to that URL.
  • If on iOS 10 or above, use this API
- (void)openURL:(NSURL*)url options:(NSDictionary<NSString *, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion;
  • Otherwise use the legacy API:
- (BOOL)openURL:(NSURL*)url;


Whether or not your app is integrated with Kahuna’s Push Receiver or your own implementation, a deep link can be handled the same way, but where you get the data can be different.

Kahuna as the Push Processor

When Kahuna is the Push Processor, and the user clicks on the notification, the SDK will format the deep links into a bundle under the intent key Kahuna.EXTRA_LANDING_DICTIONARY_ID. Make sure you verify that the action of the intent is Kahuna.ACTION_PUSH_CLICKED because there are similar intents broadcasted when a push is received and dismissed.

public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (action.equals(Kahuna.ACTION_PUSH_CLICKED)) {
        /* Push notification was clicked. */
        Bundle extras = intent.getBundleExtra(Kahuna.EXTRA_LANDING_DICTIONARY_ID);
        for (String key: extras.keySet()) {
            Object value = extras.get(key);
            Log.d(LOG_TAG, "Push Clicked: " + String.format("%s : %s (%s)", key,
                value.toString(), value.getClass().getName()));

Your App as the Push Processor

If your app has taken charge of processing the push messages, you will have to parse out the raw backend keys from the push message bundle. There is a slight difference in key, but the method to get the deeplink key/value pairs is the same as the above example.

  • Use the string “KAHUNA_LANDING_EXTRAS_ID” to get the push deeplink data

What do do with deeplink Data

  • Deeplink data can be used in many different ways. The two frequent use cases are to launch the user to an external website, and the other to navigate the user to a specific location within your app.
  • It is important to note that coordination between the engineers integrating the the Kahuna SDK into your app and the people creating push campaigns is key. The app must be able to handle the deeplink data that is entered into the deeplink fields within the campaign creator.
  • Deeplink data can contain relevant user information used for building a URL, building the deeplink parameters as part of the URL query string. To launch that user to an external link, launch that URL by publishing the Intent.ACTION_VIEW intent
  • Deeplink data can also contain information about where to navigate the user once the notification is pressed.

Campaign Creation

  • During campaign creation, deeplink info can be passed along with the message in the form of key/value pairs as well as a deeplink url.
  • Coordinate with your engineering team on what Key holds the entry for the external website you want to launch the end user to.
  • Add the URL you want your end user to be navigated to under this Key
  • Launch the campaign and you are set
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request