Oracle Help Center | Oracle Responsys Mobile App Platform Cloud Service title

Passing Extra Data

Push notifications can be sent with "extra" data to further customize where the user is directed or what happens when the notification is engaged upon.

This feature can be used for custom behaviors other than deep-linking or rich push, which are already handled automatically by the SDK. Marketers and Developers must determine how to handle each key–value pair.

For APNs, you will need to make changes to your AppDelegate.m file to tell your application to act upon push notification "extra" data. In particular, you will be using the didReceiveRemoteNotification method to re-direct the user based on the extra data.

In this example, we will re-direct the user to the web if a "u" key/pair is passed along with your notification.

For iOS 9 and earlier:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    [[PushIOManager sharedInstance] didReceiveRemoteNotification:userInfo fetchCompletionResult:UIBackgroundFetchResultNewData fetchCompletionHandler:completionHandler];
    NSString *urlString = [userInfo valueForKeyPath:@"u"];
    NSURL *url = [NSURL URLWithString:urlString];
    [[UIApplication sharedApplication] openURL:url];
}
        
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]){
    PushIOManager.sharedInstance().didReceiveRemoteNotification(userInfo)
    if let urlString = userInfo["u"] as! String?{
       let url:URL = URL(string: (urlString))!
        UIApplication.shared.openURL(url)
    }
}
        

For iOS 10 support, add:

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
    [[PushIOManager sharedInstance] didReceiveRemoteNotification:userInfo];
    NSString *urlString = [userInfo valueForKeyPath:@"u"];
    NSURL *url = [NSURL URLWithString:urlString];
    [[UIApplication sharedApplication] openURL:url];
}
        
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]){
    PushIOManager.sharedInstance().didReceiveRemoteNotification(userInfo)
    if let urlString = userInfo["u"] as! String?{
        let url:URL = URL(string: (urlString))!
        UIApplication.shared.openURL(url)
    }
}
        

The extra data can be passed from through Push notifications designed in Responsys.

The following picture shows where Marketers can enter the key-value pairs to pass when they create their push campaigns in Responsys.

"Key-value pairs screenshot"