Skip to main content
Use the Notifly React Native SDK to integrate Notifly into your React Native app. The SDK supports the following features:
  • Register device information with Notifly to receive push notifications and display in-app popups. In-app popups appear only while the app is in the foreground.
  • Send events and user information to Notifly for campaign targeting and analytics.
  • Log user actions as events and measure campaign performance.

Before you begin

Complete the following steps before installing the SDK.
  1. Connect your Firebase project.
    The Notifly iOS SDK uses Firebase Cloud Messaging to send push notifications.
Firebase project integration guide
  1. Register your iOS APNs credentials.
Register an APNs authentication key
  • For iOS builds, open the .xcworkspace file in Xcode.

1. Install the SDK

Install the package

Install notifly-sdk from npm. The badge below shows the latest version: npm
This adds notifly-sdk to package.json.

Configure iOS

1. Configure capabilities

  1. Open {Your_Project_Name}.xcworkspace in Xcode. Build your app from this workspace to include the Notifly SDK.
  2. Set the target’s minimum iOS version to 15.0 or later. Use the same minimum version in your Podfile.
  3. Enable Push Notifications and Background Modes, including Remote notifications and Background fetch. Add Capabilities Add Capabilities

2. Configure AppDelegate.mm

  1. Locate the file
AppDelegate.mm is located at the following path:
  1. Import notifly_sdk
  1. Add the UNUserNotificationCenterDelegate protocol
In AppDelegate.h, update the AppDelegate class to implement UNUserNotificationCenterDelegate.
Header
  1. Update the AppDelegate methods
Add the Notifly integration code to the methods in AppDelegate.mm.
AppDelegate.mm
Requires notifly-sdk 1.3.0 or later.
Configure a Notification Service Extension to use rich push notifications. Follow the Notifly Push Extension guide.

Supported features

  1. Attach images and videos to push notifications.
  2. Track push notification delivery to analyze campaign performance in more detail.
The SDK works without a Notification Service Extension, but rich push notifications and delivery tracking are unavailable.

Add initialization code

Add initialization code to your app’s entry point, index.js or App.js.
index.js
Find projectId and username on the settings page. password is a placeholder for backward compatibility. Do not enter a real password or API Secret Key. Pass the same nonempty value as username.

2. Register user information

Notifly uses the user ID (userId) and user properties (params) to personalize marketing campaigns.
Registered user information is used for segmentation and targeting across channels such as push notifications, email, and Kakao AlimTalk.

1. Set the user ID (Notifly.setUserId())

Map userId to the identifier of the signed-in user in your app.
Notifly uses this value to track user events and personalize campaigns.

Parameters

String
required
The signed-in user’s ID. Pass null on sign-out to clear the association.

Clear the user ID

On sign-out, call setUserId(null) to clear the association between the current device and the user. To retain the same user data, manage it separately on your server or in your app.
setUserId

2. Set user properties

setUserProperties registers user properties.
These properties are used for segment targeting, message personalization, and delivery channel selection.
Before sending sensitive user propertiesBefore sending custom user properties that need protection, such as names or addresses, register each key under User Management > User List > Property management in the console and enable encryption. Use the same key names as in the data you send.For setup instructions and limitations, see the property management guide.
Object
required
User property key-value pairs. Supports predefined keys such as $email, $phone_number, and $line_user_id.
  • $email is the address for email campaigns.
  • $phone_number is the phone number for SMS and Kakao campaigns.
  • $line_user_id is the LINE user ID for LINE message campaigns.
  • You can also define custom fields such as "plan", "tier", and "country".
setUserProperties

3. Log events

Record user actions for campaign triggers, segment conditions, and performance analysis.
For example, collect button clicks, page views, and completed purchases as events.

Parameters

String
required
Event name, such as "click_button" or "purchase_completed".
Object
Additional event parameters, such as "plan": "premium" and "duration": 120.
List<String>
Keys to use for segmentation. Supports at most one key.
Use segmentationEventParamKeys to make event parameters (eventParams) available for targeting and related settings. You can specify at most one key.
trackEvent

4. Test the integration

After you install the SDK, follow Test your integration to verify event collection and push notification delivery.

5. Advanced integration

Request push notification permission

Subscribe to push notification click events

In-app popup event listener

FAQ

The Notifly Android SDK can coexist with Firebase Cloud Messaging already used in your app.
Add use_frameworks! :linkage => :static to your Podfile to try static linking. If use_frameworks! already exists, add only the :linkage => :static option.
If you already use Firebase Messaging, configure firebase.json as described below.Following the React Native Firebase foreground presentation options guide, add the following code to firebase.json.
  • The iOS notifly_sdk is written in Swift. During the build, Xcode generates the Swift compatibility header notifly_sdk-Swift.h to expose it to Objective-C. Add "${PODS_CONFIGURATION_BUILD_DIR}" to Header Search Paths in the build settings for your target.
  • Import Swift into Objective-C