AppboyKit (also known as the Objective-C SDK) is no longer supported and has been replaced by the Swift SDK. It will no longer receive new features, bug fixes, security updates, or technical support—however, messaging and analytics will continue to function as normal. To learn more, see Introducing the New Braze Swift SDK.
Action buttons
The Braze iOS SDK supports default push categories, including URL handling support for each push action button. Currently, the default categories have four sets of push action buttons: Accept
/Decline
, Yes
/No
, Confirm
/Cancel
, and More
.
To register our default push categories, follow the integration instructions:
Step 1: Adding Braze default push categories
Use the following code to register for our default push categories when you register for push:
1
2
3
4
5
6
7
8
9
// For UserNotification.framework (iOS 10+ only)
NSSet *appboyCategories = [ABKPushUtils getAppboyUNNotificationCategorySet];
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:appboyCategories];
// For UIUserNotificationSettings (before iOS 10)
NSSet *appboyCategories = [ABKPushUtils getAppboyUIUserNotificationCategorySet];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge
categories:appboyCategories];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
1
2
3
4
5
6
7
8
// For UserNotification.framework (iOS 10+ only)
let appboyCategories = ABKPushUtils.getAppboyUNNotificationCategorySet()
UNUserNotificationCenter.current().setNotificationCategories(appboyCategories)
// For UIUserNotificationSettings (before iOS 10)
let appboyCategories = ABKPushUtils.getAppboyUIUserNotificationCategorySet()
let settings = UIUserNotificationSettings.init(types: .badge, categories: appboyCategories)
UIApplication.shared.registerUserNotificationSettings(settings)
Clicking on push action buttons with background activation mode will only dismiss the notification and not open the app. The next time the user opens the app, the button click analytics for these actions will be flushed to the server.
If you want to create your own custom notification categories, see action button customization.
Step 2: Enable interactive push handling
If you use the UNNotification
framework and have implemented Braze delegates, you should already have this method integrated.
To enable our push action button handling, including click analytics and URL routing, add the following code to your app’s (void)userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
delegate method:
1
2
3
[[Appboy sharedInstance] userNotificationCenter:center
didReceiveNotificationResponse:response
withCompletionHandler:completionHandler];
1
2
3
Appboy.sharedInstance()?.userNotificationCenter(center,
didReceive: response,
withCompletionHandler: completionHandler)
If you are not using UNNotification Framework, you will need to add the following code to your app’s application:handleActionWithIdentifier:forRemoteNotification:completionHandler:
to enable our push action button handling:
1
2
3
[[Appboy sharedInstance] getActionWithIdentifier:identifier
forRemoteNotification:userInfo
completionHandler:completionHandler];
1
2
3
Appboy.sharedInstance()?.getActionWithIdentifier(identifier,
forRemoteNotification: userInfo,,
completionHandler: completionHandler)
We strongly recommend that people using handleActionWithIdentifier
begin using UNNotification
framework. We recommend this due to the deprecation of handleActionWithIdentifier
.
Push category customization
In addition to providing a set of default push categories, Braze supports custom notification categories and actions. After you register categories in your application, you can use the Braze dashboard to send notification categories to your users.
If you are not using the UserNotifications
framework, see the alternative categories documentation.
These categories can then be assigned to push notifications via our dashboard to trigger the action button configurations of your design. Here’s an example that leverages the LIKE_CATEGORY
displayed on the device: