Appearance
Notifications Management
The Notifications Management feature provides comprehensive notification management within your iOS app. It allows users to view, manage, and interact with push notifications through an in-app notification interface.
Overview
The Notifications Management enables you to:
- Display a list of push notifications received by the user for the last 90 days
- Create a notifications section within your app with a bell icon interface
- Track notification read/unread status
- Update notification read status programmatically
- Get unread notifications count for badge display
- Present a notifications screen with customizable configuration
1. Notifications List
Upshot.ai provides the list of Push Notifications information received by the user for the last 90 days. This is used to create the Notifications section within the app. While setting up the push notifications, you can exclude certain notifications by adding the bkDeListing
key with the end date in the Unix timestamp in the deep link key value.
How to Fetch Notifications List
objective-c
// Fetch notifications list with pagination
[[BrandKinesis sharedInstance] getNotificationsWith:100 loadmore:false fromLastDays:30 onCompletion:^(NSDictionary * _Nullable response, NSString * _Nullable errorMessage) {
}];
swift
// Fetch notifications list with pagination
BrandKinesis.sharedInstance().getNotificationsWith(100, loadmore: false, fromLastDays: 30) { data, error in
}
Parameters
- limit: Number of notifications to fetch (default: 10)
- fromLastDays: Number of days to fetch (default: 90)
- loadMore: Boolean to load more notifications (false for first page, true for subsequent pages)
Sample Notifications Response
json
{
"statusCode": 200,
"pageId": "1709177173",
"status": "success",
"data": [
{
"message": "Push Message",
"title": "Push Title",
"emsg": "",
"etitle": "",
"cid": "65e5bae2f33bdd0a840b1b15",
"read": 1,
"id": "65e5bae2f33bdd0a840b1b15",
"expiry": 1709767800000,
"msg_id": "65e5ba5b0807ed84fba786f4",
"image_url": "",
"appData": {}
}
]
}
Response Field Descriptions
Field | Description |
---|---|
message | Main notification message content |
title | Notification title |
emsg | Extended message (if available) |
etitle | Extended title (if available) |
cid | Campaign ID |
read | Read status (1 = read, 0 = unread) |
id | Unique notification identifier |
expiry | Notification expiry timestamp |
msg_id | Message ID |
image_url | Notification image URL (if available) |
appData | Additional app-specific data |
2. Update Notification Read Status
The updateNotificationReadStatus
method allows you to update the notification read status when users interact with notifications.
How to Update Notification Read Status
objective-c
// Update notification read status
- (void)markNotificationAsRead:(NSString *)msgId {
[[BrandKinesis sharedInstance] updatePushNotificationReadStatus:msgId onCompletion:^(BOOL status, NSString * _Nullable error) {
}];
}
swift
// Update notification read status
func markNotificationAsRead(_ msgId: String) {
BrandKinesis.sharedInstance().updatePushNotificationReadStatus(msgId) { status, error in
}
}
3. Unread Notifications Count
Upshot.ai provides the count of unread notifications based on notification type. This is perfect for displaying badge counts on your notification bell icon.
Notification Types
- OnlyInAppNudges (1): Count of In-App Notifications
- OnlyPushNotifications (2): Count of Push Notifications
- AllNotifications (3): Combined count of Push & In-App notifications
How to Fetch Unread Notifications Count
objective-c
// Get unread notifications count
- (void)getUnreadNotificationsCount:(NSInteger)notificationType {
[[BrandKinesis sharedInstance] getUnreadNotificationsCountWithType:OnlyPushNotifications fromLastDays:30 onCompletion:^(NSInteger pushCount) {
}];
}
swift
// Get unread notifications count
func getUnreadNotificationsCount(_ notificationType: Int) {
BrandKinesis.sharedInstance().getUnreadNotificationsCount(with: .OnlyPushNotifications, fromLastDays: 30) { pushCount in
}
}
4. Present Notifications Screen
Upshot.ai presents a pre-built Notifications Screen on top of your application based on notification type and configuration setup. This provides a complete notifications interface without building custom UI.
Configuration Options
Option | Description |
---|---|
DisplayMsgCount | If true, shows UnreadNotifications Count / Total Notifications |
DisplayTime | If true, notification time is displayed |
EnableLoadMore | If true, enables pagination for loading more notifications |
PushLimit | Integer defining the number of notifications to fetch from server |
ShowReadNotifications | If true, shows both read and unread notifications |
Type | Notification type (1, 2, or 3) |
How to Show Notifications Screen
objective-c
// Configure and show notifications screen
- (void)showNotificationsScreen {
NSDictionary *options = @{
BKInboxType: [NSNumber numberWithInteger:AllNotifications],
BKEnableLoadMore: [NSNumber numberWithBool:YES],
BKShowReadNotifications: [NSNumber numberWithBool:YES]
BKPushFetchLimit: [NSNumber numberWithInteger:100],
BKDisplayMsgCount: [NSNumber numberWithBool:YES]
BKDisplayTime: [NSNumber numberWithBool:YES]
BKPushDaysLimit:[NSNumber numberWithInteger:30]
};
[[BrandKinesis sharedInstance] showInboxController: dict ];
}
swift
// Configure and show notifications screen
func showNotificationsScreen() {
let options = [
BKInboxType: BKInboxMessageType.AllNotifications,
BKShowReadNotifications: true,
BKEnableLoadMore: true,
BKPushFetchLimit: 100,
BKDisplayMsgCount: true,
BKDisplayTime: true,
BKPushDaysLimit:30,
] as [String : Any]
BrandKinesis.sharedInstance(). showInboxController(options)
}