How to enhance user engagement with iOS Notification Service and Content Extensions

Jed 1
Jed Gyeong
Software Engineer - Applications (iOS)
  • Tutorial Type: Basics
  • Reading Time: 10 min
  • Building Time: 15 min
SBM blog CTA mobile 1

Boost ops efficiency, drive revenue, & save big with omnichannel messaging

In today’s attention economy, keeping users engaged is both more important and more difficult than ever. Fortunately, the effective use of push notifications can significantly enhance user engagement.

Developers can leverage the iOS Notification Service Extension and Notification Content Extension to create compelling, interactive, and rich notifications that captivate mobile users and reliably drive more engagement.

This article explores how to use these iOS extensions with Sendbird Business Messaging to improve user engagement with rich and interactive push notifications.

What is a Notification Service Extension?

The Notification Service Extension is a feature in iOS that allows developers to intercept and modify the content of remote notifications before they are displayed to the user. Effectively, this gives developers more control over how a notification appears and functions when it arrives on the user’s screen.

This provides several beneficial capabilities:

  • Customizing notification content: Developers can modify the notification’s title, subtitle, and body text to make it more relevant and engaging for the user.

  • Adding attachments: The extension supports adding or updating attachments, such as images or videos, to enhance the notification’s appeal.

  • Updating badge numbers: It enables the adjustment of the app’s badge number, keeping the user informed about new updates.

  • Decrypting encrypted notifications: The extension can handle encrypted notifications, ensuring sensitive information is securely presented.

  • Contextual customization: Notifications can be tailored based on user preferences or app-specific context, providing a more personalized experience.

Step-by-step guide to implementing Notification Service Extensions

1. Creating a Notification Service Extension:

  • Open your project in Xcode.

  • Go to File > New > Target.

  • Select Notification Service Extension and follow the prompts to create the extension.

2. Key Methods and Usage:

Example: Modifying Notification Content

This section explains how to modify the title, subtitle, and body of a notification using the Notification Service Extension. The payload of the remote notification sent through Sendbird Business Messaging includes the title and body. In the Notification Service Extension, we will leave these two values as they are and only modify the subtitle. We’ll add the phrase “Press and hold to view more details.” to the body to encourage long-click actions.

What is a Notification Content Extension?

The Notification Content Extension is a feature in iOS that allows you to customize the appearance and functionality of push notifications delivered to a user’s device. Effectively, this gives the developer control over how the notification looks and interacts with the user beyond the standard system notification interface. Typically, this is done by creating a custom view controller within the app to manage the notification display.

Here are the key functionalities a Notification Content Extension provides:

  • Display custom content within the notification.

  • Add images, audio, and video to the notification.

  • Implement interactive elements such as buttons and switches.

  • Update the notification content dynamically before it is displayed.

Step-by-step guide to implementing Notification Content Extensions

1. Creating a Notification Content Extension:

  • Open your project in Xcode.

  • Go to File > New > Target.

  • Select Notification Content Extension and follow the prompts to create the extension.

2. Configuring Info.plist:

  • Open the Info.plist file of your Notification Content Extension.

  • Add UNNotificationExtensionCategory and set it up as follows. The sendbird_admm is a category that the remote notification includes.

Configuring Info.plist

3. Setting the Notification Category in AppDelegate.swift:

  • Initialize remote notifications and set the category:

4. Key Methods and Usage:

Implementing a simple example: Flight schedule

Now, we will implement a simple example using the Notification Service Extension, Notification Content Extension, and Sendbird Business Messaging. This example notifies the user of their flight schedule through Sendbird Business Messaging. The user's device will display the flight details as follows.

iOS push notification for a flight

How to create a notification template in the Sendbird dashboard

To create a template for the remote push notification to be sent to the device, navigate to: Sendbird dashboard > Business Messaging > Templates > Create template.

Specify the name and key for the template, and select "Push notification" as the Channel. Then, in the Design area, click the Design button to edit the template.

In this messaging template, the designable sections are the title and body, which are the texts displayed in the banner when the iOS device receives the push notification. Enter "Your Flight Schedule" in the Title field, and create two variables in the Body field to allow the departure and arrival airports to be customized.

How to create a notification template in the Sendbird dashboard

Apart from the variables used in the Body, we will add a few keys to the Data section to include more information in the push payload. The keys to be added are as follows:

Key

Description

d-airport

Departure Airport

a-airport

Arrival Airport

d-time

Departure Time

a-time

Arrival Time

airline

Airline

seat

Seat and Class

Push notification payload

When a push notification is sent using the created notification template, the iOS device will receive a payload in the following format:

Creating the notification UI

We will modify the Notification Content Extension to provide the information contained in this payload to the user. Following the previous code snippets, we will edit the MainInterface.storyboard included in the Notification Content Extension to configure the UI to display the necessary values.

The following screenshot is an example of the UI:

Notification view controller

Displaying values on the UI

Now, in the NotificationViewController class, we will retrieve the necessary values from the push notification and display them on the UI.

Now, when the user receives a remote notification, they will first see a summarized banner. By long-pressing on this banner, they will be able to view more detailed information.

Final thoughts: Using iOS Notification Service and Content Extensions to enhance engagement

Using Notification Service Extension and Notification Content Extension allows developers to deliver richer, more interactive push notifications that significantly enhance user engagement.

These technologies enable a business to deliver a variety of time-sensitive messages, from brief updates to detailed data, directly to users' devices, improving the overall user experience and increasing the perceived value of your app.

By leveraging a robust platform like Sendbird Business Messaging, businesses and developers can easily implement these features to strengthen user communications, drive app engagement, and ultimately increase user retention and satisfaction.

To learn more about Sendbird Business Messaging, contact sales or explore the Docs.